This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
var resultCollector = Quagga.ResultCollector.create({ | |
capture: true, | |
capacity: 20, | |
blacklist: [{code: "2167361334", format: "i2of5"}], | |
filter: function(codeResult) { | |
// only store results which match this constraint | |
// e.g.: codeResult | |
return true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import functools | |
@functools.total_ordering | |
class GIRow: | |
def __init__(self, dmd_name: str, md_name: str, rtr_name: str, | |
province: str, district: str, sub_district: str, address: str, node_type: str, node_alive: bool, imei: str, | |
goodsmovement_dt: str, active_user: str, user_node: str, profile_name: str, product_code: str): | |
self.dmd_name = dmd_name | |
self.md_name = md_name | |
self.rtr_name = rtr_name | |
self.province = province |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Location(models.Model): | |
mac = models.CharField(max_length=17) | |
timestamp = models.DateTimeField() | |
floor_number = models.PositiveSmallIntegerField() | |
x = models.IntegerField() | |
y = models.IntegerField() | |
located_inside = models.BooleanField() | |
zones = JSONField() | |
class MemberToMac(models.Model): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from django.contrib.auth.models import User | |
from django.utils.translation import ugettext_lazy as _ | |
class AbstractTimeStampMarker(models.Model): | |
created_at = models.DateTimeField(auto_now_add=True, verbose_name=_("Created at")) | |
updated_at = models.DateTimeField(auto_now=True, verbose_name=_("Updated at")) | |
class Meta: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from soken_web.apps.uploaded_files.models import CustomerFromExcel | |
from rest_framework import serializers | |
class ModelControllerSerializer(serializers.ModelSerializer): | |
class Meta: | |
abstract = True | |
def create(self, validated_data): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rest_framework import status | |
from rest_framework.response import Response | |
from rest_framework.viewsets import ModelViewSet | |
from soken_web.apps.uploaded_files.api.serializers import CustomerFromExcelSerializer | |
from soken_web.apps.uploaded_files.models import CustomerFromExcel | |
class CustomerFromExcelViewset(ModelViewSet): | |
queryset = CustomerFromExcel.objects.all() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from django.utils.translation import ugettext_lazy as _ | |
from model_controller.models import AbstractModelController | |
from django.contrib.auth.models import User | |
class AbstractTimeStampMarker(models.Model): | |
created_at = models.DateTimeField(auto_now_add=True, verbose_name=_("Created at")) | |
updated_at = models.DateTimeField(auto_now=True, verbose_name=_("Updated at")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib import admin | |
from django.contrib.auth.models import User | |
from import_export import resources, fields, widgets | |
from import_export.admin import ImportExportMixin | |
from model_controller.admins import ModelControllerAdmin | |
from reversion.admin import VersionAdmin | |
from soken_web.apps.zipcodes.models import ZIPCodeAddress, ZIPCodeAddressImportExport | |
ZIPCODE_BASIC_FIELDS = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
from soken_web.apps.shops.api.serializers import ShopSerializer | |
from soken_web.apps.userprofiles.api.serializers import UserProfileSerializer | |
from soken_web.apps.userprofiles.models import UserProfile | |
logger = logging.getLogger('django') | |
# token.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_mobile_update_customer(self): | |
user = User.objects.create(username='warhead') | |
self.client.force_authenticate(user=user) | |
mommy.make(Customer, family_name='IBM', created_user=self.soken_staff, updated_user=self.soken_staff) | |
data = { | |
"family_name": "C0D1UM" | |
} | |
customer = Customer.objects.first() | |
res = self.client.patch(reverse('api:customer-detail', kwargs={'pk': customer.id}), data=data) | |
self.assertEqual(200, res.status_code) |
OlderNewer