Django

Code

Changeset 5275

Show
Ignore:
Timestamp:
05/17/07 10:14:09 (1 year ago)
Author:
bouldersprinters
Message:

boulder-oracle-sprint: Merged to [5274]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/boulder-oracle-sprint/django/newforms/extras/widgets.py

    r4279 r5275  
    33""" 
    44 
     5import datetime 
     6 
    57from django.newforms.widgets import Widget, Select 
    68from django.utils.dates import MONTHS 
    7 import datetime 
    89 
    910__all__ = ('SelectDateWidget',) 
  • django/branches/boulder-oracle-sprint/django/newforms/fields.py

    r5100 r5275  
    33""" 
    44 
    5 from django.utils.translation import gettext 
    6 from django.utils.encoding import smart_unicode 
    7 from util import ErrorList, ValidationError 
    8 from widgets import TextInput, PasswordInput, HiddenInput, MultipleHiddenInput, CheckboxInput, Select, NullBooleanSelect, SelectMultiple 
    95import datetime 
    106import re 
    117import time 
     8 
     9from django.utils.translation import gettext 
     10from django.utils.encoding import smart_unicode 
     11 
     12from util import ErrorList, ValidationError 
     13from widgets import TextInput, PasswordInput, HiddenInput, MultipleHiddenInput, CheckboxInput, Select, NullBooleanSelect, SelectMultiple 
    1214 
    1315__all__ = ( 
  • django/branches/boulder-oracle-sprint/django/newforms/forms.py

    r5246 r5275  
    33""" 
    44 
    5 from django.utils.datastructures import SortedDict, MultiValueDict 
     5import copy 
     6 
     7from django.utils.datastructures import SortedDict 
    68from django.utils.html import escape 
    79from django.utils.encoding import StrAndUnicode 
     10 
    811from fields import Field 
    9 from widgets import TextInput, Textarea, HiddenInput, MultipleHiddenInput 
     12from widgets import TextInput, Textarea 
    1013from util import flatatt, ErrorDict, ErrorList, ValidationError 
    11 import copy 
    1214 
    1315__all__ = ('BaseForm', 'Form') 
  • django/branches/boulder-oracle-sprint/django/newforms/models.py

    r5246 r5275  
    55 
    66from django.utils.translation import gettext 
     7 
    78from util import ValidationError 
    8 from forms import BaseForm, DeclarativeFieldsMetaclass, SortedDictFromList 
     9from forms import BaseForm, SortedDictFromList 
    910from fields import Field, ChoiceField 
    1011from widgets import Select, SelectMultiple, MultipleHiddenInput 
    1112 
    12 __all__ = ('save_instance', 'form_for_model', 'form_for_instance', 'form_for_fields', 
    13            'ModelChoiceField', 'ModelMultipleChoiceField') 
     13__all__ = ( 
     14    'save_instance', 'form_for_model', 'form_for_instance', 'form_for_fields', 
     15    'ModelChoiceField', 'ModelMultipleChoiceField' 
     16
    1417 
    1518def save_instance(form, instance, fields=None, fail_message='saved', commit=True): 
  • django/branches/boulder-oracle-sprint/django/newforms/util.py

    r4935 r5275  
    1 from django.conf import settings 
    21from django.utils.html import escape 
    3 from django.utils.functional import Promise, lazy 
    42from django.utils.encoding import smart_unicode 
    53 
  • django/branches/boulder-oracle-sprint/django/newforms/widgets.py

    r5100 r5275  
    33""" 
    44 
    5 __all__ = ( 
    6     'Widget', 'TextInput', 'PasswordInput', 'HiddenInput', 'MultipleHiddenInput', 
    7     'FileInput', 'Textarea', 'CheckboxInput', 
    8     'Select', 'NullBooleanSelect', 'SelectMultiple', 'RadioSelect', 'CheckboxSelectMultiple', 
    9     'MultiWidget', 'SplitDateTimeWidget', 
    10 
    11  
    12 from util import flatatt 
     5try: 
     6    set # Only available in Python 2.4+ 
     7except NameError: 
     8    from sets import Set as set # Python 2.3 fallback 
     9from itertools import chain 
     10 
    1311from django.utils.datastructures import MultiValueDict 
    1412from django.utils.html import escape 
    1513from django.utils.translation import gettext 
    1614from django.utils.encoding import StrAndUnicode, smart_unicode 
    17 from itertools import chain 
    18  
    19 try: 
    20     set # Only available in Python 2.4+ 
    21 except NameError: 
    22     from sets import Set as set # Python 2.3 fallback 
     15 
     16from util import flatatt 
     17 
     18__all__ = ( 
     19    'Widget', 'TextInput', 'PasswordInput', 
     20    'HiddenInput', 'MultipleHiddenInput', 
     21    'FileInput', 'Textarea', 'CheckboxInput', 
     22    'Select', 'NullBooleanSelect', 'SelectMultiple', 'RadioSelect', 
     23    'CheckboxSelectMultiple', 'MultiWidget', 'SplitDateTimeWidget', 
     24
    2325 
    2426class Widget(object): 
  • django/branches/boulder-oracle-sprint/docs/contributing.txt

    r5174 r5275  
    280280      for details. 
    281281 
    282     * In Django template code, put one (and only one) space between the curly 
    283       brackets and the tag contents. 
    284  
    285       Do this:: 
    286  
    287           {{ foo }} 
    288  
    289       Don't do this:: 
    290  
    291           {{foo}} 
    292  
    293     * In Django views, the first parameter in a view function should be called 
    294       ``request``. 
    295  
    296       Do this:: 
    297  
    298           def my_view(request, foo): 
    299               # ... 
    300  
    301       Don't do this:: 
    302  
    303           def my_view(req, foo): 
    304               # ... 
    305  
    306282    * Please don't put your name in the code you contribute. Our policy is to 
    307283      keep contributors' names in the ``AUTHORS`` file distributed with Django 
     
    309285      change to the ``AUTHORS`` file in your patch if you make more than a 
    310286      single trivial change. 
     287 
     288Template style 
     289-------------- 
     290 
     291    * In Django template code, put one (and only one) space between the curly 
     292      brackets and the tag contents. 
     293 
     294      Do this:: 
     295 
     296          {{ foo }} 
     297 
     298      Don't do this:: 
     299 
     300          {{foo}} 
     301 
     302View style 
     303---------- 
     304 
     305    * In Django views, the first parameter in a view function should be called 
     306      ``request``. 
     307 
     308      Do this:: 
     309 
     310          def my_view(request, foo): 
     311              # ... 
     312 
     313      Don't do this:: 
     314 
     315          def my_view(req, foo): 
     316              # ... 
     317 
     318Model style 
     319----------- 
     320 
     321    * Field names should be all lowercase, using underscores instead of 
     322      camelCase. 
     323 
     324      Do this:: 
     325 
     326          class Person(models.Model): 
     327              first_name = models.CharField(maxlength=20) 
     328              last_name = models.CharField(maxlength=40) 
     329 
     330      Don't do this:: 
     331 
     332          class Person(models.Model): 
     333              FirstName = models.CharField(maxlength=20) 
     334              Last_Name = models.CharField(maxlength=40) 
     335 
     336    * The ``class Meta`` should appear *after* the fields are defined, with 
     337      a single blank line separating the fields and the class definition. 
     338 
     339      Do this:: 
     340 
     341          class Person(models.Model): 
     342              first_name = models.CharField(maxlength=20) 
     343              last_name = models.CharField(maxlength=40) 
     344 
     345              class Meta: 
     346                  verbose_name_plural = 'people' 
     347 
     348      Don't do this:: 
     349 
     350          class Person(models.Model): 
     351              first_name = models.CharField(maxlength=20) 
     352              last_name = models.CharField(maxlength=40) 
     353              class Meta: 
     354                  verbose_name_plural = 'people' 
     355 
     356      Don't do this, either:: 
     357 
     358          class Person(models.Model): 
     359              class Meta: 
     360                  verbose_name_plural = 'people' 
     361 
     362              first_name = models.CharField(maxlength=20) 
     363              last_name = models.CharField(maxlength=40) 
     364 
     365    * The order of model inner classes and standard methods should be as 
     366      follows (noting that these are not all required): 
     367 
     368        * All database fields 
     369        * ``class Meta`` 
     370        * ``class Admin`` 
     371        * ``def __str__()`` 
     372        * ``def save()`` 
     373        * ``def get_absolute_url()`` 
     374        * Any custom methods 
     375 
     376    * If ``choices`` is defined for a given model field, define the choices as 
     377      a tuple of tuples, with an all-uppercase name, either near the top of the 
     378      model module or just above the model class. Example:: 
     379 
     380          GENDER_CHOICES = ( 
     381              ('M', 'Male'), 
     382              ('F', 'Female'), 
     383          ) 
    311384 
    312385Committing code