#8664 closed (fixed)
PhoneNumberField should be moved to django.contrib.localflavor.us
| Reported by: | Owned by: | Jacob | |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | dev | 
| Severity: | Keywords: | us localflavor | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no | 
| Needs tests: | no | Patch needs improvement: | no | 
| Easy pickings: | no | UI/UX: | no | 
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)
Change History (16)
comment:1 by , 17 years ago
| Component: | Uncategorized → Database wrapper | 
|---|---|
| Keywords: | us localflavor added | 
comment:2 by , 17 years ago
comment:4 by , 17 years ago
| Owner: | changed from to | 
|---|---|
| Status: | new → assigned | 
by , 17 years ago
| Attachment: | 8664-1.diff added | 
|---|
Moves to django.contrib.localflavor.us.models. No additional changes.
follow-up: 6 comment:5 by , 17 years ago
| Component: | Database wrapper → django.contrib.localflavor | 
|---|---|
| Has patch: | set | 
| Triage Stage: | Unreviewed → Design decision needed | 
Patch adds a new file django.contrib.localflavor.us.fields, which is also (maybe already) added by #8210.
comment:6 by , 17 years ago
comment:7 by , 17 years ago
| 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 by , 17 years ago
| Component: | django.contrib.localflavor → Database wrapper | 
|---|---|
| Triage Stage: | Design decision needed → Accepted | 
Assuming this is accepted because it's basically the same as #8210
by , 17 years ago
| Attachment: | 8664-2.diff added | 
|---|
Add db_type method, backends.*.creation references, fix test error
comment:9 by , 17 years ago
| Patch needs improvement: | unset | 
|---|
comment:10 by , 17 years ago
| Owner: | changed from to | 
|---|---|
| Status: | assigned → new | 
comment:11 by , 17 years ago
| Status: | new → assigned | 
|---|
It might be appropriate to replace it with a base PhoneNumberField that accepts
r'^[0-9+ #*().-]+$'