Changeset 5275
- Timestamp:
- 05/17/07 10:14:09 (1 year ago)
- Files:
-
- django/branches/boulder-oracle-sprint/django/newforms/extras/widgets.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/newforms/fields.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/newforms/forms.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/newforms/models.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/newforms/util.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/newforms/widgets.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/docs/contributing.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/boulder-oracle-sprint/django/newforms/extras/widgets.py
r4279 r5275 3 3 """ 4 4 5 import datetime 6 5 7 from django.newforms.widgets import Widget, Select 6 8 from django.utils.dates import MONTHS 7 import datetime8 9 9 10 __all__ = ('SelectDateWidget',) django/branches/boulder-oracle-sprint/django/newforms/fields.py
r5100 r5275 3 3 """ 4 4 5 from django.utils.translation import gettext6 from django.utils.encoding import smart_unicode7 from util import ErrorList, ValidationError8 from widgets import TextInput, PasswordInput, HiddenInput, MultipleHiddenInput, CheckboxInput, Select, NullBooleanSelect, SelectMultiple9 5 import datetime 10 6 import re 11 7 import time 8 9 from django.utils.translation import gettext 10 from django.utils.encoding import smart_unicode 11 12 from util import ErrorList, ValidationError 13 from widgets import TextInput, PasswordInput, HiddenInput, MultipleHiddenInput, CheckboxInput, Select, NullBooleanSelect, SelectMultiple 12 14 13 15 __all__ = ( django/branches/boulder-oracle-sprint/django/newforms/forms.py
r5246 r5275 3 3 """ 4 4 5 from django.utils.datastructures import SortedDict, MultiValueDict 5 import copy 6 7 from django.utils.datastructures import SortedDict 6 8 from django.utils.html import escape 7 9 from django.utils.encoding import StrAndUnicode 10 8 11 from fields import Field 9 from widgets import TextInput, Textarea , HiddenInput, MultipleHiddenInput12 from widgets import TextInput, Textarea 10 13 from util import flatatt, ErrorDict, ErrorList, ValidationError 11 import copy12 14 13 15 __all__ = ('BaseForm', 'Form') django/branches/boulder-oracle-sprint/django/newforms/models.py
r5246 r5275 5 5 6 6 from django.utils.translation import gettext 7 7 8 from util import ValidationError 8 from forms import BaseForm, DeclarativeFieldsMetaclass,SortedDictFromList9 from forms import BaseForm, SortedDictFromList 9 10 from fields import Field, ChoiceField 10 11 from widgets import Select, SelectMultiple, MultipleHiddenInput 11 12 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 ) 14 17 15 18 def 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 settings2 1 from django.utils.html import escape 3 from django.utils.functional import Promise, lazy4 2 from django.utils.encoding import smart_unicode 5 3 django/branches/boulder-oracle-sprint/django/newforms/widgets.py
r5100 r5275 3 3 """ 4 4 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 5 try: 6 set # Only available in Python 2.4+ 7 except NameError: 8 from sets import Set as set # Python 2.3 fallback 9 from itertools import chain 10 13 11 from django.utils.datastructures import MultiValueDict 14 12 from django.utils.html import escape 15 13 from django.utils.translation import gettext 16 14 from 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 16 from 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 ) 23 25 24 26 class Widget(object): django/branches/boulder-oracle-sprint/docs/contributing.txt
r5174 r5275 280 280 for details. 281 281 282 * In Django template code, put one (and only one) space between the curly283 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 called294 ``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 306 282 * Please don't put your name in the code you contribute. Our policy is to 307 283 keep contributors' names in the ``AUTHORS`` file distributed with Django … … 309 285 change to the ``AUTHORS`` file in your patch if you make more than a 310 286 single trivial change. 287 288 Template 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 302 View 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 318 Model 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 ) 311 384 312 385 Committing code
