code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
#!/usr/bin/env python
# http://www.execommsys.com/VEC%20Professional%20Foot%20Pedals.htm
# 05f3:00ff PI Engineering, Inc.
signal_chars = [4, 12, 20]
WORD_LENGTH = 24
def open_device():
hid_dev_index = 0
import sys
if len(sys.argv) > 1:
hid_dev_index = int(sys.argv[1])
hidfilename = "/dev/usb/hiddev%d" % (hid_... | Python |
#!/usr/bin/env python
#
# Copyright 2006, 2007 Google Inc. All Rights Reserved.
# Author: danderson@google.com (David Anderson)
#
# Script for uploading files to a Google Code project.
#
# This is intended to be both a useful script for people who want to
# streamline project uploads and a reference implementation for
... | Python |
#!/usr/bin/env python
#
# Copyright 2006, 2007 Google Inc. All Rights Reserved.
# Author: danderson@google.com (David Anderson)
#
# Script for uploading files to a Google Code project.
#
# This is intended to be both a useful script for people who want to
# streamline project uploads and a reference implementation for
... | Python |
# main.py
from google.appengine.ext import webapp
from google.appengine.ext.webapp import RequestHandler
from google.appengine.ext.webapp.util import run_wsgi_app
from simple_login import SimpleLoginHandler
from acct_lookup import AcctLookupHandler
from unit_test import UnitTestHandler
from create_contact import Creat... | Python |
"""beatbox: Makes the salesforce.com SOAP API easily accessible."""
__version__ = "0.9"
__author__ = "Simon Fell, Ron Hess"
__credits__ = "Mad shouts to the sforce possie"
__copyright__ = "(C) 2006 Simon Fell. GNU GPL 2."
import sys
from urlparse import urlparse
from StringIO import StringIO
import gzip
import dateti... | Python |
from _beatbox import _tPartnerNS, _tSObjectNS, _tSoapNS
from _beatbox import Client as BaseClient
from marshall import marshall
from types import TupleType, ListType
import re
import copy
from xmltramp import Namespace, Element
import sys
import logging
import pickle
_tSchemaInstanceNS = Namespace('http://w... | Python |
from _beatbox import _tPartnerNS, _tSObjectNS, _tSoapNS
import python_client
from types import ListType, TupleType
import datetime, re
dateregx = re.compile(r'(\d{4})-(\d{2})-(\d{2})')
datetimeregx = re.compile(
r'(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d+)(.*)')
doubleregx = re.compil... | Python |
"""xmltramp: Make XML documents easily accessible."""
__version__ = "2.16"
__author__ = "Aaron Swartz"
__credits__ = "Many thanks to pjz, bitsko, and DanC."
__copyright__ = "(C) 2003 Aaron Swartz. GNU GPL 2."
if not hasattr(__builtins__, 'True'): True, False = 1, 0
def isstr(f): return isinstance(f, type('')) or isin... | Python |
from _beatbox import _tPartnerNS, _tSObjectNS, _tSoapNS, SoapFaultError, SessionTimeoutError
from _beatbox import Client as XMLClient
#from _beatbox import MetaClient
from python_client import Client as PythonClient
from python_client import MetaClient as PythonMetaClient
__all__ = ('XMLClient', '_tPartnerNS', '_tS... | Python |
# acct_lookup.py
import os
import beatbox
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp import RequestHandler
class AcctLookupHandler(RequestHandler):
def get(self):
path = os.path.join(os.path.dirname(__file__), 'templates/acct_lookup.html')
self.response.out.write(template.... | Python |
# create_contact.py
import os
import beatbox
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp import RequestHandler
class CreateContactHandler(RequestHandler):
def get(self):
self.redirect('/static/create_contact_input.html')
def post(self):
# Retriev... | Python |
# unit_test.py
import os
import beatbox
from datetime import datetime
import logging
from google.appengine.api import memcache
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp import RequestHandler
class UnitTestHandler(RequestHandler):
def get(self):
op = self.request.get('op')
... | Python |
# simple_login.py
import os
import beatbox
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp import RequestHandler
class SimpleLoginHandler(RequestHandler):
def post(self):
# Retrieve username and password from post data
username = self.request.get('uid')
password = self.reques... | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
import imp
try:
imp.find_module('settings') # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized t... | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
import imp
try:
imp.find_module('settings') # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized t... | Python |
from django.conf.urls.defaults import patterns, include, url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'mysite.views.home', name='home'),
# url(r'^mysite/', include('mysite.foo.urls')),
... | Python |
# Django settings for mysite project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '... | Python |
import cgi
import datetime
import urllib
import wsgiref.handlers
from google.appengine.ext import db
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
class Greeting(db.Model):
"""Models an individual Guestbook entry with an aut... | Python |
from django.db import models
# Create your models here.
| Python |
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
... | Python |
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('misc.views',
(r'^about/', 'about'),
) | Python |
from django.http import Http404, HttpResponseRedirect, HttpResponse
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.contrib.auth import logout, login, authenticate
from django.contrib.auth.models import User
from django.contrib.auth.decorato... | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
import sys
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized thin... | Python |
from django.db import models
# Create your models here.
| Python |
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
... | Python |
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('accounts.views',
# Example:
# (r'^dishpop/', include('dishpop.foo.urls')),
# Uncomment the admin/doc line below to enable adm... | Python |
from django.http import Http404, HttpResponseRedirect, HttpResponse
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.contrib.auth import logout, login, authenticate
from django.contrib.auth.models import User
from django.contrib.auth.decorato... | Python |
from django import forms
from django.forms import ModelForm
from reviews.models import DishImage
import re
from django.contrib.auth.models import User
RATING_CHOICES = (
('1', '1 Horrible'),
('2', '2 Poor'),
('3', '3 Just ok'),
('4', '4 Good'),
('5', '5 Excellent'),
)
class SearchFor... | Python |
from imagekit.specs import ImageSpec
from imagekit import processors
# first we define our thumbnail resize processor
class ResizeThumb(processors.Resize):
width = 100
height = 75
crop = True
class ResizeMedium(processors.Resize):
width = 275
height = 275
crop = True
# no... | Python |
from django.db import models
from tagging.models import Tag
from common.models import NameSlugModel, DateAwareModel, MyImageModel, UserOwnedModel
from django.contrib.gis.db import models
class Place(NameSlugModel, DateAwareModel):
geometry = models.PointField(srid=4326)
objects = models.GeoManager()
... | Python |
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
... | Python |
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('reviews.views',
# Example:
# (r'^dishpop/', include('dishpop.foo.urls')),
# Uncomment the admin/doc line below to enable admi... | Python |
from django.contrib import admin
from reviews.models import Place, Dish, PlaceImage, DishImage, Review
from tagging.models import Tag, Tag_Relation
class ImageAdmin(admin.ModelAdmin):
list_display = ('name', 'admin_thumbnail_view',)
class PlaceAdmin(admin.ModelAdmin):
exclude = ('modified_date', 'crea... | Python |
from django.http import Http404, HttpResponseRedirect, HttpResponse
from django.template import RequestContext
from django.contrib.auth import logout, login, authenticate
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import Pass... | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
import sys
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized thin... | Python |
from django.conf.urls.defaults import *
import os
# Uncomment the next two lines to enable the admin:##
from django.contrib import admin
admin.autodiscover()
site_media = os.path.join(os.path.dirname(__file__), 'site_media')
urlpatterns = patterns('',
# Example:
# (r'^kokoomi/', include('kokoomi.f... | Python |
from django import forms
from django.forms import ModelForm
from django.contrib.auth.models import User
from profile.models import ProfileImage, UserProfile
class UploadProfilePhotoForm(ModelForm):
class Meta:
model = ProfileImage
exclude = ('user', 'isPrimary', 'name')
class EditProfile... | Python |
from imagekit.specs import ImageSpec
from imagekit import processors
# first we define our thumbnail resize processor
class ResizeThumb(processors.Resize):
width = 100
height = 75
crop = True
# now we define a display size resize processor
class ResizeDisplay(processors.Resize):
width ... | Python |
from django.db import models
from django.db.models.signals import post_save
from django.contrib.auth.models import User
from common.models import MyImageModel, UserOwnedModel
class ProfileImage(MyImageModel, UserOwnedModel):
isPrimary = models.BooleanField()
class IKOptions:
# This inner class i... | Python |
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
... | Python |
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('profile.views',
# Example:
# (r'^dishpop/', include('dishpop.foo.urls')),
# Uncomment the admin/doc line below to enable admi... | Python |
from django.http import Http404, HttpResponseRedirect, HttpResponse
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.contrib.auth import logout, login, authenticate
from django.contrib.auth.models import User
from django.contrib.auth.decorato... | Python |
# Django settings for kokoomi project.
import os
SITE_ROOT = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'postgresql_psycopg2', # Add 'pos... | Python |
from django.db import models
class Tag(models.Model):
name = models.CharField(max_length=200, unique=True)
related_tags = models.ManyToManyField('self', blank=True, symmetrical=False, through='Tag_Relation')
def rec_lookup(self, f, st):
for obj in f():
st.add(obj)
... | Python |
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
... | Python |
from django.utils.encoding import force_unicode
def parse_tags(tagstring):
"""
Parses tag input, with multiple word input being activated and
delineated by commas and double quotes. Quotes take precedence, so
they may contain commas.
Returns a sorted list of unique tag names.
Ported from Jona... | Python |
# Create your views here.
| Python |
import settings
def GetGenericAvatarImgURL():
return settings.MEDIA_URL + 'images/generic.jpg'
def GetGenericFoodImgURL():
return settings.MEDIA_URL + 'images/common/missingfoodpicture.jpg' | Python |
from datetime import datetime
from django.db import models, IntegrityError, transaction
from django.contrib.gis.db import models
from django.contrib.auth.models import User
from django.template.defaultfilters import slugify
from imagekit.models import ImageModel
class NameSlugModel(models.Model):
name = mo... | Python |
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
... | Python |
# Create your views here.
| Python |
"""
Serialize data to/from JSON
"""
from django.utils import simplejson
from python import Serializer as PythonSerializer
from django.core.serializers.json import Deserializer as JSONDeserializer, \
DjangoJSONEncoder
class Serializer(PythonSerializer):
"""
Convert a queryset to JSON.
"""
... | Python |
"""
Full Python serializer for Django.
"""
import base
from django.utils.encoding import smart_unicode, is_protected_type
from django.core.serializers.python import Deserializer as PythonDeserializer
from django.db import models
class Serializer(base.Serializer):
"""
Python serializer for Django modelled after ... | Python |
"""New base serializer class to handle full serialization of model objects."""
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django.core.serializers import base
class Serializer(base.Serializer):
"""Serializer for Django models inspired by Ruby on Rails serial... | Python |
__version__ = '1.0.0'
| Python |
from django.db import models
# Create your models here.
| Python |
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
... | Python |
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('misc.views',
(r'^about/', 'about'),
) | Python |
from django.http import Http404, HttpResponseRedirect, HttpResponse
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.contrib.auth import logout, login, authenticate
from django.contrib.auth.models import User
from django.contrib.auth.decorato... | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
import sys
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized thin... | Python |
from django.db import models
# Create your models here.
| Python |
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
... | Python |
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('accounts.views',
# Example:
# (r'^dishpop/', include('dishpop.foo.urls')),
# Uncomment the admin/doc line below to enable adm... | Python |
from django.http import Http404, HttpResponseRedirect, HttpResponse
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.contrib.auth import logout, login, authenticate
from django.contrib.auth.models import User
from django.contrib.auth.decorato... | Python |
from django import forms
from django.forms import ModelForm
from reviews.models import DishImage, Dish
import re
from django.contrib.auth.models import User
RATING_CHOICES = (
('1', '1 Horrible'),
('2', '2 Poor'),
('3', '3 Just ok'),
('4', '4 Good'),
('5', '5 Excellent'),
)
class Bul... | Python |
from imagekit.specs import ImageSpec
from imagekit import processors
# first we define our thumbnail resize processor
class ResizeThumb(processors.Resize):
width = 130
height = 100
crop = True
class ResizeMedium(processors.Resize):
width = 375
height = 375
crop = True
# now... | Python |
from datetime import datetime
from django.contrib.gis.db import models
from django.contrib.auth.models import User
from tagging.models import Tag
from common.models import NameSlugModel, DateAwareModel, MyImageModel, UserOwnedModel
class PlaceManager(models.GeoManager):
def get_by_natural_key(self, name, sl... | Python |
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
... | Python |
from django.core import serializers
def serialize_dishes(dishes, user):
# if (user.is_authenticated()):
# for d in dishes:
# d.set_user_dependent_flags(user)
return serializers.serialize('json', dishes, extras=('get_thumbnail_url', 'medium_img_url', 'is_liked_by_curr_user', 'is_disl... | Python |
from django.conf.urls.defaults import *
from reviews.api import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('reviews.views',
# Example:
# (r'^dishpop/', include('dishpop.foo.urls')),
# Uncomment the admin/do... | Python |
from django.conf.urls.defaults import *
from django.contrib import admin
from django.contrib.gis.geos import fromstr
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from geopy import geocoders
from reviews.forms import BulkAd... | Python |
from django.http import Http404, HttpResponseRedirect, HttpResponse
from django.template import RequestContext
from django.contrib.auth import logout, login, authenticate
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import Pass... | Python |
from django.http import HttpResponse
from reviews.models import Dish, DishImage
from reviews.serialization_helpers import *
from tagging.models import Tag
def get_feed(request, dish_id):
try:
feed_items = Rank.objects.filter(dish__id__exact=dish_id).order_by('modified_date')
# sorted(user... | Python |
from reviews.forms import SearchForm
def add_search_form_processor(request):
form = SearchForm()
return {'search_form': form } | Python |
from common.models import NameSlugModel, DateAwareModel, MyImageModel, UserOwnedModel
from datetime import datetime
from django.contrib.gis.db import models
from django.db import models
from reviews.models import Dish
from tagging.models import Tag
# Create your models here.
class List(NameSlugModel, DateAwareModel, ... | Python |
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
... | Python |
from django.conf.urls.defaults import *
from django.contrib import admin
from sorting.models import List, ListMembership, Sorting, Item, SortDelta
class ListMembershipInline(admin.StackedInline):
model = ListMembership
extra = 3
class ListAdmin(admin.ModelAdmin):
inlines = [
ListMembers... | Python |
# Create your views here.
| Python |
#!/usr/bin/env python
from django.core.management import execute_manager
import sys
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized thin... | Python |
from django.conf.urls.defaults import *
import os
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
site_media = os.path.join(os.path.dirname(__file__), 'site_media')
urlpatterns = patterns('',
# Example:
# (r'^kokoomi/', include('kokoomi.foo... | Python |
from django import forms
from django.forms import ModelForm, FileInput
from django.contrib.auth.models import User
from profile.models import ProfileImage, UserProfile
class UploadProfilePhotoForm(ModelForm):
class Meta:
model = ProfileImage
exclude = ('user', 'isPrimary', 'name')
class ... | Python |
from imagekit.specs import ImageSpec
from imagekit import processors
# first we define our thumbnail resize processor
class ResizeThumb(processors.Resize):
width = 100
height = 75
crop = True
# now we define a display size resize processor
class ResizeDisplay(processors.Resize):
width ... | Python |
from common.models import MyImageModel, UserOwnedModel, DateAwareModel
from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
from reviews.models import Dish
from sorting.models import List
class UserProfile(DateAwareModel):
name = models.Cha... | Python |
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
... | Python |
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('profile.views',
# Example:
# (r'^dishpop/', include('dishpop.foo.urls')),
# Uncomment the admin/doc line below to enable admi... | Python |
from django.contrib import admin
from profile.models import UserProfile, ProfileImage, Connection
# class ImageAdmin(admin.ModelAdmin):
# list_display = ('name', 'admin_thumbnail_view',)
# class PlaceAdmin(admin.ModelAdmin):
# exclude = ('modified_date', 'created_date')
# class DishAdmin(admin.Mod... | Python |
from django.http import Http404, HttpResponseRedirect, HttpResponse
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.contrib.auth import logout, login, authenticate
from django.contrib.auth.models import User
from django.contrib.auth.decorato... | Python |
# Django settings for kokoomi project.
import os
SITE_ROOT = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
SERIALIZATION_MODULES = {
'json': 'serializers.json' # the wadofstuff django fu... | Python |
from django.db import models
from common.models import NameSlugModel
class TagManager(models.Manager):
def get_by_natural_key(self, name):
return self.get(name=name)
class Tag(NameSlugModel):
related_tags = models.ManyToManyField('self', blank=True, symmetrical=False, through='Tag_Relation')
... | Python |
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
... | Python |
from django.utils.encoding import force_unicode
def parse_tags(tagstring):
"""
Parses tag input, with multiple word input being activated and
delineated by commas and double quotes. Quotes take precedence, so
they may contain commas.
Returns a sorted list of unique tag names.
Ported from Jona... | Python |
# Create your views here.
| Python |
import settings
def GetGenericAvatarImgURL():
return settings.MEDIA_URL + 'images/generic.jpg'
def GetGenericFoodImgURL():
return settings.MEDIA_URL + 'images/common/missingfoodpicture.jpg' | Python |
from datetime import datetime
from django.db import models, IntegrityError, transaction
from django.contrib.gis.db import models
from django.contrib.auth.models import User
from django.template.defaultfilters import slugify
from imagekit.models import ImageModel
class NameSlugModel(models.Model):
name = mo... | Python |
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
... | Python |
# Create your views here.
| Python |
from django import forms
| Python |
from imagekit.specs import ImageSpec
from imagekit import processors
# first we define our thumbnail resize processor
class ResizeThumb(processors.Resize):
width = 100
height = 75
crop = True
# now we define a display size resize processor
class ResizeDisplay(processors.Resize):
width = 600
# now let... | Python |
from django.db import models
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from imagekit.models import ImageModel
from tagging.models import GenericTag
class Photo(ImageModel):
original_image = models.ImageFiel... | Python |
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 a... | Python |
Subsets and Splits
SQL Console for ajibawa-2023/Python-Code-Large
Provides a useful breakdown of language distribution in the training data, showing which languages have the most samples and helping identify potential imbalances across different language groups.