This file contains hidden or 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 unicode_it(data): | |
# Take a string of data and convert it to unicode | |
try: | |
return unicode(data, errors="replace").strip() | |
except TypeError as E: | |
return u"" | |
def extract(msg, msg_obj, attachments): | |
if msg.is_multipart(): | |
for part in msg.get_payload(): |
This file contains hidden or 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.auth.models import Group, Permission | |
from django.contrib.contenttypes.models import ContentType | |
from users.models import User | |
new_group, created = Group.objects.get_or_create(name ='new_group') | |
# Code to add permission to group ??? | |
ct = ContentType.objects.get_for_model(User) | |
# Now what - Say I want to add 'Can go Haridwar' permission to level0? | |
permission = Permission.objects.create(codename ='can_go_haridwar', name ='Can go to Haridwar', content_type = ct) |
This file contains hidden or 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.auth.models import AbstractUser | |
from django.utils import timezone | |
from django.db import models | |
class User(AbstractUser): | |
"""Define the extra fields related to User here""" | |
first_name = models.CharField(_('First Name of User'), blank = True, max_length = 20) | |
last_name = models.CharField(_('Last Name of User'), blank = True, max_length = 20) | |
# - - - Some more User fields according to your need s |
This file contains hidden or 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
# Base Image | |
FROM python:3.5-alpine | |
# Initialize | |
RUN mkdir -p /data/web | |
COPY . /data/web/ | |
RUN mkdir -p mydjango/static/admin | |
# Setup | |
RUN apk update |
This file contains hidden or 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
#!/user/bin/python | |
def custom_generator(x): | |
for i in range(10): | |
if i == 5: | |
return | |
else: | |
yield i |
This file contains hidden or 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
============================= | |
**http://kickass.to/infiniteskills-learning-jquery-mobile-working-files-t7967156.html | |
**http://kickass.to/lynda-bootstrap-3-advanced-web-development-2013-eng-t8167587.html | |
**http://kickass.to/lynda-css-advanced-typographic-techniques-t7928210.html | |
**http://kickass.to/lynda-html5-projects-interactive-charts-2013-eng-t8167670.html | |
**http://kickass.to/vtc-html5-css3-responsive-web-design-course-t7922533.html | |
*http://kickass.to/10gen-m101js-mongodb-for-node-js-developers-2013-eng-t8165205.html | |
*http://kickass.to/cbt-nuggets-amazon-web-services-aws-foundations-t7839734.html |