Code

Opened 6 years ago

Closed 6 years ago

Last modified 3 years ago

#8664 closed (fixed)

PhoneNumberField should be moved to django.contrib.localflavor.us

Reported by: Piotr Lewandowski <django@…> Owned by: jacob
Component: Database layer (models, ORM) Version: master
Severity: Keywords: us localflavor
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Like russelm has mentioned in #8210 - PhoneNumberField should be moved to django.contrib.localflavor.us.

After closing this ticket and #8210 there would be no references to django.contrib.localflavor from Django code (excluding django/contrib/localflavor directory itself).

Attachments (3)

8664-1.diff (3.3 KB) - added by gkelly 6 years ago.
Moves to django.contrib.localflavor.us.models. No additional changes.
8664-1.2.diff (3.3 KB) - added by gkelly 6 years ago.
Same as above, but without the newline warning
8664-2.diff (5.9 KB) - added by mattmcc 6 years ago.
Add db_type method, backends.*.creation references, fix test error

Download all attachments as: .zip

Change History (16)

comment:1 Changed 6 years ago by Piotr Lewandowski <django@…>

  • Component changed from Uncategorized to Database wrapper
  • Keywords us localflavor added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 6 years ago by Daniel Pope <dan@…>

It might be appropriate to replace it with a base PhoneNumberField that accepts r'^[0-9+ #*().-]+$'

comment:3 Changed 6 years ago by gkelly

  • milestone set to 1.0

#8210 has a 1.0 milestone, this should too.

comment:4 Changed 6 years ago by gkelly

  • Owner changed from nobody to gkelly
  • Status changed from new to assigned

Changed 6 years ago by gkelly

Moves to django.contrib.localflavor.us.models. No additional changes.

Changed 6 years ago by gkelly

Same as above, but without the newline warning

comment:5 follow-up: Changed 6 years ago by gkelly

  • Component changed from Database wrapper to django.contrib.localflavor
  • Has patch set
  • Triage Stage changed from Unreviewed to Design decision needed

Patch adds a new file django.contrib.localflavor.us.fields, which is also (maybe already) added by #8210.

comment:6 in reply to: ↑ 5 Changed 6 years ago by gkelly

Replying to gkelly:

Patch adds a new file django.contrib.localflavor.us.fields, which is also (maybe already) added by #8210.

Should be django.contrib.localflavor.us.models rather.

comment:7 Changed 6 years ago by gkelly

  • Patch needs improvement set

Something wrong with the patch, no time to debug right now:

./runtests.py --settings=settings model_forms

Error while importing model_forms:  File "./runtests.py", line 130, in django_tests
    mod = load_app(model_label)
  File "/sw/lib/python2.5/site-packages/django/db/models/loading.py", line 72, in load_app
    mod = __import__(app_name, {}, {}, ['models'])
  File "/usr/local/src/django/trunk/tests/modeltests/model_forms/models.py", line 72, in <module>
    class PhoneNumber(models.Model):
  File "/sw/lib/python2.5/site-packages/django/db/models/base.py", line 84, in __new__
    new_class.add_to_class(obj_name, obj)
  File "/sw/lib/python2.5/site-packages/django/db/models/base.py", line 135, in add_to_class
    value.contribute_to_class(cls, name)
TypeError: Error when calling the metaclass bases
    unbound method contribute_to_class() must be called with PhoneNumberField instance as first argument (got ModelBase instance instead)
Traceback (most recent call last):
  File "./runtests.py", line 183, in <module>
    django_tests(int(options.verbosity), options.interactive, args)
  File "./runtests.py", line 153, in django_tests
    failures = run_tests(test_labels, verbosity=verbosity, interactive=interactive, extra_tests=extra_tests)
  File "/sw/lib/python2.5/site-packages/django/test/simple.py", line 131, in run_tests
    app = get_app(label)
  File "/sw/lib/python2.5/site-packages/django/db/models/loading.py", line 122, in get_app
    raise ImproperlyConfigured, "App with label %s could not be found" % app_label
django.core.exceptions.ImproperlyConfigured: App with label model_forms could not be found

comment:8 Changed 6 years ago by ericholscher

  • Component changed from django.contrib.localflavor to Database wrapper
  • Triage Stage changed from Design decision needed to Accepted

Assuming this is accepted because it's basically the same as #8210

Changed 6 years ago by mattmcc

Add db_type method, backends.*.creation references, fix test error

comment:9 Changed 6 years ago by mattmcc

  • Patch needs improvement unset

comment:10 Changed 6 years ago by jacob

  • Owner changed from gkelly to jacob
  • Status changed from assigned to new

comment:11 Changed 6 years ago by jacob

  • Status changed from new to assigned

comment:12 Changed 6 years ago by jacob

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed in [8819].

comment:13 Changed 3 years ago by jacob

  • milestone 1.0 deleted

Milestone 1.0 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.