Content:
Click ⭐if you like the project. Pull Request are highly appreciated.
No. | Questions |
---|---|
1 | Why python is not support Overloading concept? |
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
/* | |
* Handle Django serializers errors and return error in html (ul/li) format. | |
* | |
* Error structure examples | |
* // The most simple case | |
* { detail: "Authentication is required" } | |
* | |
* // Simple form validation error | |
* { title: ["This field is required."], "description": ["This field is required."]} | |
* |
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 | |
class AbstractDateTime(models.Model): | |
''' | |
Abstract model for created_on and updated_on field in models | |
''' | |
created_on = models.DateTimeField(auto_now_add=True) | |
updated_on = models.DateTimeField(auto_now=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
# setting.py file | |
''' | |
JS logger configuration used in application | |
''' | |
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': True, | |
'formatters': { | |
'standard': { |
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
''' | |
Ref blog | |
- https://www.programiz.com/python-programming/user-defined-exception | |
- https://stackoverflow.com/questions/1319615/proper-way-to-declare-custom-exceptions-in-modern-python | |
''' | |
# Basic use | |
class CustomError(Exception): | |
pass |
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
pip install boto3 | |
python manage.py runserver | |
pip install awscli | |
aws --version | |
aws configure # set configuration of user | |
aws s3 ls # get listing of all buckets | |
aws s3 ls s3://imageprocess-python/ # access certain bucket |
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
# check attachment files | |
# find_distance.py | |
import os | |
from datetime import datetime | |
import googlemaps | |
from django.conf import settings | |
from packages.common_func import get_or_none, convert_float | |
from network.models import Distance, LatLong |
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
# -*- coding: utf-8 -*- | |
""" | |
Created on Sat Jun 8 17:19:13 2019 | |
@author: 63315 | |
""" | |
import googlemaps | |
from datetime import datetime |
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 os | |
from datetime import datetime | |
from django.conf import settings | |
from django.db import connection | |
from django.core.files.storage import FileSystemStorage | |
def get_dict_wise_data(columns,cursor): | |
results = [] | |
for row in cursor.fetchall(): |
NewerOlder