Did I find the right examples for you? yes no

All Samples(30)  |  Call(21)  |  Derive(0)  |  Import(9)

        def MAX_USERNAME_LENGTH():
    if hasattr(settings,"MAX_USERNAME_LENGTH"):
        return settings.MAX_USERNAME_LENGTH
    else:
        return 255
        


src/l/o/longerusername-0.4/longerusername/models.py   longerusername(Download)
from django.db.models.signals import class_prepared
from django.conf import settings
from longerusername import MAX_USERNAME_LENGTH
 
def longer_username_signal(sender, *args, **kwargs):
def patch_user_model(model):
    field = model._meta.get_field("username")
 
    field.max_length = MAX_USERNAME_LENGTH()
    field.help_text = _("Required, %s characters or fewer. Only letters, "
                        "numbers, and @, ., +, -, or _ "
                        "characters." % MAX_USERNAME_LENGTH())
    for v in field.validators:
        if isinstance(v, MaxLengthValidator):
            v.limit_value = MAX_USERNAME_LENGTH()
 
from django.contrib.auth.models import User
 
# check if User model is patched
if User._meta.get_field("username").max_length != MAX_USERNAME_LENGTH():
    patch_user_model(User)

src/l/o/longerusername-0.4/longerusername/forms.py   longerusername(Download)
from django import forms
 
from longerusername import MAX_USERNAME_LENGTH
 
def update_username_field(field):
    field.widget.attrs['maxlength'] = MAX_USERNAME_LENGTH()
    field.max_length = MAX_USERNAME_LENGTH()
    field.help_text = _("Required, %s characters or fewer. Only letters, "
                        "numbers, and characters such as @.+_- are "
                        "allowed." % MAX_USERNAME_LENGTH())
    for v in field.validators:
        if isinstance(v, MaxLengthValidator):
            v.limit_value = MAX_USERNAME_LENGTH()
 
class UserCreationForm(auth_forms.UserCreationForm):

src/d/j/django-longer-username-HEAD/longerusername/models.py   django-longer-username(Download)
from django.db.models.signals import class_prepared
from django.conf import settings
from longerusername import MAX_USERNAME_LENGTH
 
def longer_username_signal(sender, *args, **kwargs):
def patch_user_model(model):
    field = model._meta.get_field("username")
 
    field.max_length = MAX_USERNAME_LENGTH()
    field.help_text = _("Required, %s characters or fewer. Only letters, "
                        "numbers, and @, ., +, -, or _ "
                        "characters." % MAX_USERNAME_LENGTH())
    for v in field.validators:
        if isinstance(v, MaxLengthValidator):
            v.limit_value = MAX_USERNAME_LENGTH()
 
from django.contrib.auth.models import User
 
# check if User model is patched
if User._meta.get_field("username").max_length != MAX_USERNAME_LENGTH():
    patch_user_model(User)

src/d/j/django-longer-username-HEAD/longerusername/forms.py   django-longer-username(Download)
from django import forms
 
from longerusername import MAX_USERNAME_LENGTH
 
def update_username_field(field):
    field.widget.attrs['maxlength'] = MAX_USERNAME_LENGTH()
    field.max_length = MAX_USERNAME_LENGTH()
    field.help_text = _("Required, %s characters or fewer. Only letters, "
                        "numbers, and characters such as @.+_- are "
                        "allowed." % MAX_USERNAME_LENGTH())
    for v in field.validators:
        if isinstance(v, MaxLengthValidator):
            v.limit_value = MAX_USERNAME_LENGTH()
 
class UserCreationForm(auth_forms.UserCreationForm):

src/l/o/longerusername-0.4/longerusername/migrations/0001_initial.py   longerusername(Download)
# encoding: utf-8
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from longerusername import MAX_USERNAME_LENGTH
    def forwards(self, orm):
        # Changing field 'User.username'
        db.alter_column('auth_user', 'username', models.CharField(max_length=MAX_USERNAME_LENGTH()))
 
 

src/d/j/django-longer-username-HEAD/longerusername/migrations/0001_initial.py   django-longer-username(Download)
# encoding: utf-8
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from longerusername import MAX_USERNAME_LENGTH
    def forwards(self, orm):
        # Changing field 'User.username'
        db.alter_column('auth_user', 'username', models.CharField(max_length=MAX_USERNAME_LENGTH()))
 
 

src/a/s/askbot-tuan-1.5/askbot/utils/forms.py   askbot-tuan(Download)
from askbot.utils.functions import split_list
from askbot import const
from longerusername import MAX_USERNAME_LENGTH
import logging
import urllib
            widget_attrs = login_form_widget_attrs
 
        max_length = MAX_USERNAME_LENGTH()
        super(UserNameField,self).__init__(
                max_length=max_length,

src/a/s/askbot-tuanpa-0.7.48/askbot/utils/forms.py   askbot-tuanpa(Download)
from askbot.utils.functions import split_list
from askbot import const
from longerusername import MAX_USERNAME_LENGTH
import logging
import urllib
            widget_attrs = login_form_widget_attrs
 
        max_length = MAX_USERNAME_LENGTH()
        super(UserNameField,self).__init__(
                max_length=max_length,

src/a/s/askbot-0.7.49/askbot/utils/forms.py   askbot(Download)
from askbot.utils.functions import split_list
from askbot import const
from longerusername import MAX_USERNAME_LENGTH
import logging
import urllib
            widget_attrs = login_form_widget_attrs
 
        max_length = MAX_USERNAME_LENGTH()
        super(UserNameField,self).__init__(
                max_length=max_length,