code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
from tkinter import *
from profile import Profile
class Gui_ChangeProfile:
def __init__(self, gui):
self.root = Tk()
self.gui = gui
self.root.title("Profildaten")
self.root.wm_iconbitmap('@'+"campus.xbm")
self.root.geometry("700x500")
... | Python |
from tkinter import *
from gui_login import Gui_Login
from gui_registration import Gui_Registration
from gui_grouplist import Gui_Grouplist
from groupList import GroupList
from teamList import TeamList
from gui_topframe import Gui_Topframe
from gui_group import Gui_Group
from gui_change_profile import Gui_ChangeProfile... | Python |
import xml.etree.ElementTree as ET
from user import User
from userList import UserList
class MemberList:
userList = []
def __init__(self, typid):
self.typid = typid
def addXMLMembers(self, typid):
self.typid = typid
self.memberList = []
self.userList =... | Python |
from user import User
import xml.etree.ElementTree as ET
class UserList:
def __init__(self):
self.userList = []
self.userId = []
self.file = ET.parse("users.xml")
self.root = self.file.getroot()
self.users = self.root.getchildren()
for user in self.use... | Python |
from wall import Wall
from memberList import MemberList
class Team:
typ = "team"
def __init__(self, teamid, name):
self.teamid = teamid
self.name = name
def addXmlTeam(self):
self.addXmlMemberList()
self.addXmlWall()
def addXmlWall(self):
se... | Python |
from gui import Gui
from messenger import Messenger
from groupList import GroupList
from userList import UserList
from user import User
'''
Mitfahrgelegenheit - ein Python/XML-Projekt an der FH Bielefeld am Campus Minden
Autoren:
- Malte Flender
- Jerome Goncalvez
- Sebastian Hartmann
- Marius Krause
- Rico Schw... | Python |
from tkinter import *
class Gui_Group:
def __init__(self, root, gui, group):
self.gui = gui
self.root = root
self.group = group
self.root.geometry("870x650")
self.main_frame=Frame(self.root, height=600, width=850, bg="#f0f0f0")
self.main_frame.... | Python |
from user import User
class Profile():
userMinLength = 6
passwdMinLength = 6
def __init__(self, root, gui, gui_Profile):
self.root = root
self.gui = gui
self.gui_Profile = gui_Profile
self.user = self.gui.getUser()
self.gui_Profile.e_user... | Python |
from userList import UserList
class Login():
def __init__(self, root, gui):
self.root = root
self.gui = gui
def checkContent(self, gui_login, username, password):
userMinLength = 6
passwdMinLength = 6
if not (len(username) >= userMinLength):
... | Python |
from tkinter import *
from messenger import Messenger
class Gui_Messenger:
def __init__(self, gui):
self.root = Tk()
self.gui = gui
self.messenger = Messenger(self.gui.getUser().getId())
self.root.title("Nachrichten")
self.root.wm_ico... | Python |
class WallMessage:
def createMessage(self, sender, date, content):
self.sender = sender
self.date = date
self.content = content
def getSender(self):
return self.sender
def getDate(self):
return self.date
def getContent(self):
return self... | Python |
class User:
def __init__(self):
self.groupList = []
def createXmlUser(self, userid, name, lastname, username, passwd, phone, email, address, plz, city):
self.userid = userid
self.name = name
self.lastname = lastname
self.username = username
self.p... | Python |
sql_statement = ""
with open('clientes.tsv') as f:
i = 0
for line in f:
client = line.rstrip('\n').split('\t')
barrio = ""
if client[1] == '""':
barrio = 'ZARAGOCILLA'
else:
barrio = client[1]
sql_statement += 'INSERT INTO "MaeCliente" ... | Python |
sql_statement = ""
with open('barrios_cartagena.txt') as f:
for line in f:
line_no_newline = line.rstrip('\n')
sql_statement += 'INSERT INTO "MaeBarrio" ("usuarioGrab", "usuarioUltMod", "activo", "codMaeBarrio", "codMaeCiudad", "nombreMaeBarrio", "localidad")\n'
sql_statement += "VALUES('ADMIN', 'ADM... | Python |
import numpy as np
import time
import scipy
import scipy.sparse as ss
import scipy.sparse.linalg as linalg
def solve_k_coo_sub(model):
full_displ = {}
full_F = {}
for sub in model.subcases.values():
#
F = model.F[sub.id]
#
K = model.k_coo_sub[sub.id]
#
... | Python |
from solver import *
| Python |
from abaqus import *
from abaqusConstants import *
from regionToolset import Region
def model_create( mdb, model ):
mdb.Model( model.name)
class AModel(object):
def __init__( self ):
self.amodel = amodel
print 'CYLINDER MODULE'
backwardCompatibility.setValues(includeDeprecated=True, reportDeprec... | Python |
import abaqus
| Python |
import numpy as np
from alg3dpy.constants import *
from mapy.model.coords import CoordR
vecxz = Vec( np.array((1,0,1), dtype=FLOAT) )
CSYSGLOBAL = CoordR(0, O, None, Z, vecxz )
CSYSGLOBAL.rebuild( rcobj = None, force_new_axis = False )
CSYSGLOBAL.rcobj = CSYSGLOBAL
| Python |
import os
from cardtranslator import *
from input_reader import *
def user_setattr(obj, inputs):
for k,v in inputs.iteritems():
if k.find('blank') > -1:
continue
#FIXME I removed this if below...
#if getattr(obj, k, False) == False:
str_test = str( v )
if str_test... | Python |
import mapy
from mapy.reader import *
from mapy.model import *
def card2dict(inputcard, inputsolvername, outputsolvername = 'generic'):
"""
Returns a tranlated output card, given the solver name and inputcard.
If no output solver name is given the 'generic' one is used as default.
"""
ou... | Python |
import mapy
from mapy.reader import *
global tempcard
def addfield(tempcard, field, value):
found = False
field = float(field)
field += 1
for k in tempcard.keys():
if k.find('___') > -1:
entrynum = float(k.split('___')[2])
step = float(k.split('___')[3])
foun... | Python |
import mapy
from mapy import FEM
from vtk import *
from random import random
def randomrgb():
r = random() * 255
g = random() * 255
b = random() * 255
return [r, g, b]
class FEMView(FEM):
def __init__(self, model):
FEM.__init__(self)
self.points = vtkPoints()
x1min = 1000000.... | Python |
import os
#import solver
class FEM(object):
'''
Finite Element Method class
'''
def __init__(self):
pass
def create_model(self, name='default_name'):
self.model = model.Model( name )
def read_new_file(self, file_path, solvername='nastran'):
solvername = solvername.lower... | Python |
import numpy as np
#FIXME build the K matrix using Gauss-Legendre numerical integration
#
import alg3dpy
from mapy.model.elements.elem2d import Elem2D
from mapy.reader import user_setattr
class ElemTria3(Elem2D):
def __init__(self, inputs):
Elem2D.__init__(self)
self = user_setattr(self, inputs)
... | Python |
from elemtria3 import *
| Python |
import sympy
from sympy.core.power import Pow
import sys
from sympy.matrices import Matrix
sympy.var('x y x1 y1 x2 y2 x3 y3 z z1 z2 z3 area')
def area_tria(x1,x2,x3,y1,y2,y3,z1,z2,z3):
a = sympy.sqrt(Pow(x2-x1,2) + Pow(y2-y1,2) + Pow(z2-z1,2))
b = sympy.sqrt(Pow(x3-x1,2) + Pow(y3-y1,2) + Pow(z3-z1,2))
c = s... | Python |
import alg3dpy
from mapy.model.elements.elem1d import Elem1D
from mapy.reader import user_setattr
#
class ElemBar(Elem1D):
def __init__(self, inputs):
Elem1D.__init__(self)
self = user_setattr(self, inputs)
def rebuild(self):
Elem1D.rebuild(self)
self.calc_ovec()
self.c... | Python |
import sympy
from sympy import Matrix
sympy.var(' cosa cosb cosg sina sinb sing ')
Ra = Matrix([[1 , 0 , 0],
[0 ,cosa,sina],
[0,-sina,cosa]])
Rb = Matrix([[cosb, 0,-sinb],
[0 , 1, 0 ],
[sinb,0,cosb ]])
Rg = Matrix([[cosg, sing, 0],
[-sing,cosg,0],
[0,0,1]])
Rab... | Python |
import alg3dpy
from mapy.reader import user_setattr
from mapy.model.elements import Elements
class Elem2D(Elements):
__slots__ = [ 'plane' ]
def __init__(self):
super( Elem2D, self ).__init__()
self.xvec = None
self.yvec = None
self.zvec = None
def rebuild(self):
... | Python |
from mapy.model.elements import Elements
class Elem3d(Elements):
def __init__(self):
Elements.__init__(self)
pass
| Python |
import numpy as np
from mapy.model.elements.elem2d import Elem2D
from mapy.reader import user_setattr
from mapy.constants import FLOAT
class IsoQuad(Elem2D):
'''
Only membrane components considered up to now
The bending terms have to be added
This formulation allows the use of quad elements
from 4 u... | Python |
from mapy.model.elements import Elements
#
class Elem1D(Elements):
'''Elem1D include methods and attributes for all one dimensional
elements.
'''
def __init__(self):
Elements.__init__(self)
def rebuild(self):
Elements.rebuild(self)
self.grids = []
g1 = self.mode... | Python |
import numpy
from numpy import sqrt
GL = {\
'tria':{\
3:[[[2/3.,1/6.,1/6.],1/3.],
[[1/6.,2/3.,1/6.],1/3.],
[[1/6.,1/6.,2/3.],1/3.]],
4:[[[1/3.,1/3.,1/3.],-0.5625],
[[ 0.6, 0.2, 0.2],25/48.],
[[ 0.2, 0.6, 0.2],25/48.],
[[ 0.2, 0.2, 0.6],25/48.]],
6:[[[0.816847572980459,0.091576213509771,0.091576213509771]... | Python |
from mapy.model.elements.elem1d import Elem1D
from mapy.reader import user_setattr
from mapy.constants import FLOAT, INT
class ElemRod(Elem1D):
'''Defines a rod element, which is a truss including the axial
torsion.
'''
def __init__(self, inputs):
Elem1D.__init__(self)
self = user_setat... | Python |
import alg3dpy
class Elements(object):
__slots__ = [ 'id', 'model', 'xvec', 'yvec', 'zvec', 'mask', 'tmp', \
'grids', 'cg', 'pobj', 'entryclass', 'card', 'panel' ]
def __init__(self):
self.grids = []
self.mask = False
self.panel = None
def rebuild(self):
... | Python |
import sympy
sympy.var('u v csi eta u1 u2 u3 u4 u5 u6 v1 v2 v3 v4 v5 v6')
sympy.var('c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12')
sympy.var('x1 x2 x3 x4 x5 x6 y1 y2 y3 y4 y5 y6')
#finding 'ci's
eq1 = - u1 + c1 + c2* x1 + c3* y1 + c4* x1*y1 + c5* x1*x1 + c6* y1*y1
eq2 = - u2 + c1 + c2* x2 + c3* y2 + c4* x2*y2 + c5* x... | Python |
from mapy.reader import user_setattr
#
class SPC(object):
__slots__ = ['card','entryclass','id','gridid','dof','displ','g2',
'c2','d2','model','conscount']
def __init__(self, inputs):
self.card = None
self.entryclass = None
self.id = None
self.gridid = None... | Python |
import alg3dpy
from mapy.reader import user_setattr
#
class Loads(object):
def __init__(self):
self.subcases = {}
def rebuild(self):
pass
def add2model(self, model):
self.model = model
model.loadcount += 1
self.loadcount = model.loadcount
model.loaddict[mod... | Python |
class Subcase(object):
def __init__(self, subid, loadid, consid):
self.id = subid
self.loadid = loadid
self.consid = consid
def rebuild(self):
for load in self.model.loaddict.values():
if load.id == self.loadid:
load.set_subcase(self)
| Python |
from loads import *
from subcases import *
| Python |
from mapy.reader import user_setattr
from alg3dpy import Point
from coords import Coord, CoordR, CoordC, CoordS
from mapy.constants import *
import numpy as np
import random as rdm
class Grid( Point ):
"""
The inheritance from the alg3dpy.Point class exists.
The array attribute is from Point class.
At... | Python |
from alg3dpy.vector import Vec
from alg3dpy.angles import cosplanevec, sinplanevec, cos2vecs, sin2vecs
from alg3dpy.plane import Plane
from alg3dpy.point import Point
import random as rdm
import numpy as np
import mapy
from mapy.reader import user_setattr
from mapy.constants import *
def common__str__(text, csys):
... | Python |
from mapy.reader import user_setattr
from mapy.model.properties import Properties
class Prop1D(Properties):
def __init__(self):
super( Prop1D, self ).__init__()
class PropRod(Prop1D):
def __init__(self, inputs):
super( PropRod, self ).__init__()
self = user_setattr(self, inputs)
... | Python |
from mapy.model.properties.prop2d import Prop2D
class PropShellComp(Prop2D):
__slots__ = [ 'card', 'entryclass', 'id', 'z0', 'nsm', 'sbmat', 'ft',
'tref', 'dampc', 'lam', 'midlist', 'tlist', 'thetalist',
'laminate' ]
def __init__(self, inputs):
super( PropShellC... | Python |
import numpy as np
from lamina import Lamina
from mapy.model.properties import Properties
from mapy.model.materials.matlamina import read_laminaprop
from mapy.constants import ONE, ZER, FLOAT
class Laminate( Properties ):
#TODO update this __slots__
#__slots__ = []
"""
Attributes:
___________... | Python |
from lamina import *
from laminate import *
from pcomp import *
| Python |
import numpy as np
from mapy.constants import ONE, ZER, FLOAT
#
class Lamina(object):
#TODO
# __slots__ = []
"""
Reference: Reddy, J. N., Mechanics of Laminated Composite Plates and
Shells - Theory and Analysys. Second Edition. CRC PRESS, 2004.
Attributes:
______________________________... | Python |
#
class Properties(object):
def __init__(self):
pass
def rebuild(self):
if getattr(self, 'mid', False) <> False:
self.matobj = self.model.matdict[int(self.mid)]
self.build_C()
def add2model(self, model):
self.model = model
model.propdict... | Python |
from mapy.reader import user_setattr
from mapy.model.properties import Properties
#
class Prop2D(Properties):
def __init__(self):
super( Prop2D, self ).__init__()
class PropShell(Prop2D):
def __init__(self, inputs):
super( PropShell, self).__init__()
self = user_setattr(self, inpu... | Python |
import time
import os
import alg3dpy.scipy_sparse as assparse
import constraints
from mapy.constants import CSYSGLOBAL
def get_cons(grid, sub_id):
if sub_id in grid.cons.keys():
if len(grid.perm_cons) > 0:
cons = list(grid.perm_cons | grid.cons[sub_id])
else:
cons = list(gr... | Python |
import numpy as np
from mapy.model.materials import Materials
from mapy.reader import user_setattr
from mapy.constants import ONE, ZER, FLOAT
class MatLamina(Materials):
"""
Defines a lamina material.
Attributes:
____________________________________________________________________________
... | Python |
from mapy.model.materials import Materials
from mapy.reader import user_setattr
class MatIso(Materials):
"""
Defines an isotropic material.
Attributes:
____________________________________________________________________________
card the card name (NASTRAN etc)
entryclass path to ... | Python |
#
class Materials(object):
def __init__( self ):
pass
def add2model( self, model ):
self.model = model
model.matdict[self.id] = self
| Python |
import time
def rebuild(self):
#########################################################
# Grid <--> CoordSys loops
print time.ctime() + ' started - rebuilding grids and coordsys'
# first processing basic grids and coordsys
for grid in self.griddict.values():
if grid.rcid == 0 or grid.rcid... | Python |
import cylinder
| Python |
import os
os.system('cls')
import mapy
home = os.environ['HOME']
modelpath = \
os.path.join( home, 'programming', 'python', 'modeling-analysis-python',
'tests', 'rods_spiral_many_coords.dat' )
fem1 = mapy.FEM()
fem1.create_model()
fem1.read_new_file( modelpath )
fem1.model.rebuild()
tmp = []
for ... | Python |
from django import forms
from django.utils.translation import ugettext_lazy as _
class ContactForm(forms.Form):
name = forms.CharField()
email = forms.EmailField()
topic = forms.CharField()
message = forms.CharField(widget=forms.Textarea())
| Python |
#!/usr/bin/env python
import sys
import os
try:
import settings
except ImportError:
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__)
sys.exit(... | Python |
from django.db import models
from django.contrib.sites.models import Site
from django.utils.translation import ugettext_lazy as _
from django_model_utils.fields import TemplateString, TemplateStringField
from django_model_utils.models import StatMixin, PageMixin
class Page(StatMixin, PageMixin, models.Model):
tit... | Python |
from django.conf.urls.default import *
urlpatterns = pattern('gironimo.page.views',
url(r'^(?P<url>.*)$', 'view_page', name='page'),
)
| Python |
from django.contrib import admin
from django import forms
from django.utils.translation import ugettext_lazy as _
from gironimo.page.models import Page
class PageAdminForm(forms.ModelForm):
url = forms.RegexField(label=_('URL'), max_length=100, regex=r'^[-\w/_\.]+$',
help_text=_("Beispiel: '/about/contact... | Python |
from django.http import *
from django.shortcuts import *
from django.template import RequestContext
from gironimo.page.models import Page
def view_page(request, url=''):
from django import template
try:
page = Page.objects.get(url=u'/%s' % url)
except Page.DoesNotExist:
raise Http404()
... | Python |
#!/usr/bin/env python
import sys
import os
try:
import settings
except ImportError:
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__)
sys.exit(... | Python |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django_model_utils.models import StatMixin, PageMixin
class Category(StatMixin, PageMixin, models.Model):
'''
This app creates categories to our webproject. They have a name and a slug
and maybe a description, but th... | Python |
from django.conf.urls.defaults import *
urlpatterns = patterns('gironimo.category.views',
url(r'^(?P<slug>[a-z0-9_-]+)/$', 'detail', name='category_detail'),
url(r'^$', 'index', name='category_index'),
)
| Python |
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from gironimo.category.models import Category
class CategoryAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['name', 'slug', 'content',]}),
(_('HTML'), {'fields': ['html_title', 'html_description... | Python |
from django.shortcuts import render_to_response
from django.template import RequestContext
from gironimo.category.models import Category
def detail(request, slug):
pass
def index(request):
categories = Category.objects.all().order_by('name')
return render_to_response('category/index.html', {
'categor... | Python |
from django.conf.urls.defaults import patterns, include, url
from django.conf import settings
urlpatterns = patterns('',
url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
url(r'^admin/', include('gironimo.admin_urls')),
url(r'^account/', include('gironimo.a... | Python |
import os.path
DEBUG = True
TEMPLATE_DEBUG = DEBUG
gettext_noop = lambda s: s
ADMINS = (
# ('Your Name', 'your_email@example.com'),
('Marc Rochow', 'kontakt@gironimo.org'),
('Patrick Menrath', 'patrick.menrath@hs-augsburg.de')
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'djang... | Python |
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'gironimoDB',
'USER': 'root',
'PASSWORD': 'Gironimo7.',
'HOST': '',
'PORT': '',
}
}
| Python |
import os
import weakref
try:
from PIL import Image
from PIL import ImageFile
from PIL import ImageEnhance
from PIL import ImageDraw
except ImportError:
import Image
import ImageFile
import ImageEnhance
import ImageDraw
from django.conf import settings
from django.utils.encoding import s... | Python |
# we need a models.py file to make the django test runner determine the tests
from imagequery.settings import ALLOW_LAZY_FORMAT, LAZY_FORMAT_CLEANUP_TIME
if ALLOW_LAZY_FORMAT:
from django.db import models
from django.utils.functional import LazyObject
from datetime import datetime, timedelta
try:
... | Python |
class FormatDoesNotExist(Exception):
pass
_formats = {}
def register(name, format):
_formats[name] = format
def get(name):
try:
return _formats[name]
except KeyError:
raise FormatDoesNotExist()
class Format(object):
"""
A Format represents a fixed image manipulation
... | Python |
import os
try:
from PIL import Image
from PIL import ImageChops
from PIL import ImageOps
from PIL import ImageFilter
from PIL import ImageDraw
except ImportError:
import Image
import ImageChops
import ImageOps
import ImageFilter
import ImageDraw
from imagequery.utils import get_i... | Python |
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import *
urlpatterns = patterns('imagequery.views',
url(r'^generate/(?P<pk>[0-9]+)?$', 'generate_lazy', name='imagequery_generate_lazy'),
)
| Python |
from django import template
from imagequery import ImageQuery, formats
from imagequery.utils import get_imagequery
from django.db.models.fields.files import ImageFieldFile
from django.utils.encoding import smart_unicode
from imagequery.settings import ALLOW_LAZY_FORMAT, LAZY_FORMAT_DEFAULT
register = template.Library(... | Python |
from django.conf import settings
from django.core.files.storage import default_storage as _default_storage,\
get_storage_class
CACHE_DIR = getattr(settings, 'IMAGEQUERY_CACHE_DIR', 'cache')
# can be used to define quality
# IMAGEQUERY_DEFAULT_OPTIONS = {'quality': 92}
DEFAULT_OPTIONS = getattr(settings, 'IMAGEQUER... | Python |
try:
from PIL import Image
from PIL import ImageFile
from PIL import ImageFont
except ImportError:
import Image
import ImageFile
import ImageFont
from django.core.cache import cache
from django.core.files.base import File
from imagequery.settings import default_storage
def get_imagequery(value)... | Python |
from django.http import HttpResponseRedirect, Http404
from django.core.exceptions import ImproperlyConfigured
def generate_lazy(request, pk):
try:
from imagequery.models import LazyFormat
except ImportError:
raise ImproperlyConfigured('You have to set "IMAGEQUERY_ALLOW_LAZY_FORMAT = True" in or... | Python |
from imagequery.query import RawImageQuery, NewImageQuery, ImageQuery
from imagequery.formats import Format, register as register_format
from imagequery.operations import Operation, CommandOperation
| Python |
# -*- coding: utf-8 -*-
from django.contrib.auth.models import User
from django import forms
from django.utils.translation import ugettext_lazy as _
attrs_dict = {'class': 'required'}
class RegistrationForm(forms.Form):
"""
Form for registering a new user account.
Validates that the requested usern... | Python |
# -*- coding: utf-8 -*-
import datetime
import random
import re
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from django.db import transaction
from django.db.models.signals import post_save
from django.template.loader import render_to_string
from django.uti... | 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 |
from django.dispatch import Signal
# A new user has registered.
user_registered = Signal(providing_args=["user", "request"])
# A user has activated his or her account.
user_activated = Signal(providing_args=["user", "request"])
| Python |
"""
Backwards-compatible URLconf for existing django-registration
installs; this allows the standard ``include('registration.urls')`` to
continue working, but that usage is deprecated and will be removed for
django-registration 1.0. For new installs, use
``include('registration.backends.default.urls')``.
"""
import w... | Python |
from django.contrib import admin
from django.contrib.sites.models import RequestSite
from django.contrib.sites.models import Site
from django.utils.translation import ugettext_lazy as _
from gironimo.account.models import RegistrationProfile, UserProfile
class RegistrationAdmin(admin.ModelAdmin):
actions = ['acti... | Python |
from gironimo.imagequery import Format, register_format
class AccountAvatarFormat(Format):
'''
Crops the user avatar into 50x50 px
'''
def execute(self, query):
return query.fit(50, 50).image_format('JPEG').query_name('account_avatar')
register_format('account_avatar', AccountAvatarForma... | Python |
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
from gironimo.account.views import activate, register
urlpatterns = patterns('',
url(r'^register/$', register, {'backend': 'gironimo.account.backends.simple.SimpleBackend'}, name='registration_register'),
url(r'... | Python |
from django.conf import settings
from django.contrib.auth import authenticate
from django.contrib.auth import login
from django.contrib.auth.models import User
from gironimo.account import signals
from gironimo.account.forms import RegistrationForm
class SimpleBackend(object):
"""
A registration backend whic... | Python |
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
from gironimo.account.views import activate, register
urlpatterns = patterns('',
url(r'^activate/complete/$', direct_to_template, {'template': 'account/activation_complete.html'}, name='account_activation_complete')... | Python |
from django.conf import settings
from django.contrib.sites.models import RequestSite
from django.contrib.sites.models import Site
from gironimo.account import signals
from gironimo.account.forms import RegistrationForm
from gironimo.account.models import RegistrationProfile
class DefaultBackend(object):
"""
... | Python |
from django.core.exceptions import ImproperlyConfigured
# Python 2.7 has an importlib with import_module; for older Pythons,
# Django's bundled copy provides it.
try:
from importlib import import_module
except ImportError:
from django.utils.importlib import import_module
def get_backend(path):
"""
Re... | Python |
"""
Views which allow users to create and activate accounts.
"""
from django.shortcuts import redirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.forms.mod... | Python |
VERSION = (0, 8, 0, 'alpha', 1)
def get_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
version = '%s.%s' % (version, VERSION[2])
if VERSION[3:] == ('alpha', 0):
version = '%s pre-alpha' % version
else:
if VERSION[3] != 'final':
version = "%s %... | Python |
from django.conf.urls.defaults import *
from django.contrib.auth import views as auth_views
urlpatterns = patterns('',
url(r'^login/$', auth_views.login, {'template_name': 'account/login.html'}, name='auth_login'),
url(r'^logout/$', auth_views.logout, {'template_name': 'account/logout.html'}, name='auth_logou... | Python |
#-*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from django_model_utils.models import StatMixin, PageMixin, StatusMixin, ClonableMixin, StatClonableMixin
from tagging.fields import TagField
from tagging.models import... | Python |
#-*- coding: utf-8 -*-
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from gironimo.blog.models import Post, PostRevision
class PostRevisionInline(admin.TabularInline):
model = PostRevision
extra = 1
class PostAdmin(admin.ModelAdmin):
date_hierarchy = 'created'
... | Python |
# Create your views here.
| Python |
from django.forms import ModelForm
from gironimo.gallery.models import Album, Picture
class AlbumForm(ModelForm):
class Meta:
model = Album
fields = ('name', 'content', 'category')
class PictureForm(ModelForm):
class Meta:
model = Picture
| 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.