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 viewsets | |
from .mixins import GetSerializerClassMixin | |
from .models import User, Company, SystemUserRole | |
from .serializers import ( | |
CompanySerializer, | |
CompanyDetailSerializer, | |
UserSerializer, | |
UserDetailSerializer, | |
) |
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 viewsets | |
from .mixins import GetSerializerClassMixin | |
from .models import User, Company, SystemUserRole | |
from .serializers import ( | |
CompanySerializer, | |
CompanyDetailSerializer, | |
UserSerializer, | |
UserDetailSerializer, | |
) |
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 GetSerializerClassMixin(object): | |
def get_serializer_class(self): | |
""" | |
A class which inhertis this mixins should have variable | |
`serializer_action_classes`. | |
Look for serializer class in self.serializer_action_classes, which | |
should be a dict mapping action name (key) to serializer class (value), | |
i.e.: |
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 serializers | |
from enumfields.drf.serializers import EnumSupportSerializerMixin | |
from .models import User, Company | |
class CompanySerializer(serializers.ModelSerializer): | |
full_address = serializers.CharField(read_only=True) | |
class Meta: | |
model = Company |
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.conf import settings | |
from django.db import models | |
from django.contrib.auth.models import AbstractUser | |
from django.utils.translation import ugettext_lazy as _ | |
from enumfields import EnumField | |
from enumfields import Enum | |
class SystemUserRole(Enum): | |
SYS_ADMIN = "SYS_ADMIN" | |
SYS_USER = "SYS_USER" |
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 GetSerializerClassMixin(object): | |
def get_serializer_class(self): | |
""" | |
under class which inhertis this mixins should have variable | |
`serializer_action_classes`. | |
Look for serializer class in self.serializer_action_classes, which | |
should be a dict mapping action name (key) to serializer class (value), | |
i.e.: |
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
<template lang="pug"> | |
div | |
button.pronto-btn.add(disabled="true" ref="gAPIAuthBtn") Authenticate | |
div(ref="gAPIResult") | |
</template> | |
<script> | |
export default { | |
data() { | |
return { |
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
#!/usr/bin/env python3 | |
# Get your files that Gmail block. Warning message: | |
# "Anti-virus warning - 1 attachment contains a virus or blocked file. Downloading this attachment is disabled." | |
# Based on: https://spapas.github.io/2014/10/23/retrieve-gmail-blocked-attachments/ | |
# Instructions: | |
# Go to your emails, click the arrow button in the top right, "Show original", then "Download Original". | |
# Move the files to the same directory as this program, then run it. | |
import email |
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
go-mysql-json-ex/ | |
|-- dbm/ // contains all database related operations | |
| |-- internal/ // internal only accessible to dbm | |
| | |-- base.go // contains db conf, manager | |
| | |-- prepsql.go // all prepared statements used in entire app | |
| |-- conn.go // db init, close API call | |
| |-- delete.go // delete db resource APIs | |
| |-- get.go // get db resource APIs | |
| |-- insert.go // insert db resource APIs | |
| |-- models.go // models in go representing db tables structrure |
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 mysql.connector | |
import json | |
config = { | |
"user": "", | |
"password": "", | |
"host": "localhost", | |
"database": "test", | |
"use_pure": True, | |
} |
NewerOlder