#5968: Registering/Unregistering multiple models fails
-----------------------+----------------------------------------------------
Reporter: anderso | Owner: nobody
Status: new | Component: django.contrib.databrowse
Version: SVN | Resolution:
Keywords: | Stage: Accepted
Has_patch: 1 | Needs_docs: 1
Needs_tests: 0 | Needs_better_patch: 1
-----------------------+----------------------------------------------------
Comment (by anderso):
Yes I believe it's just a convenience for adding several models at once.
The use case where you already have a list of Models is probably rare (and
if you did you could just use the * syntax in the call). Verifying that
the arguments really are Models might be nice since this is the main
public api of databrowse.
If we were to rethink the api, maybe it would make sense to provide
registering at the application level in addition to individual models. I
imagine this is how it looks for many users:
{{{
from myapp.models import ModelA, ModelB, ModelC, ModelD, ModelE
databrowse.site.register(ModelA)
databrowse.site.register(ModelB)
databrowse.site.register(ModelC)
databrowse.site.register(ModelD)
databrowse.site.register(ModelE)
}}}
or with the undocumented iterable approach:
{{{
from myapp.models import ModelA, ModelB, ModelC, ModelD, ModelE
databrowse.site.register([ModelA, ModelB, ModelC, ModelD, ModelE])
}}}
maybe something like this would be a nice alternative:
{{{
import myapp
databrowse.site.register_application(myapp)
}}}
Makes sense considering a main use case of databrowse is to provide a
quick overview of the data for developers.
--
Ticket URL: <http://code.djangoproject.com/ticket/5968#comment:4>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---