(Warning: still very much a Django newbie)
I'm having a bit of trouble conceptualizing this. Say I have an app
that has two models: A and B. Both need to have CRUD views. What's the
preferred way of doing this?
One way I can think of is in urls.py, separate by URL and method name
like so:
urlpatterns += patterns('project.app.views',
(r'^A/$', 'index_a'),
(r'^A/create/$', 'create_a'),
(r'^A/edit/(?P<bkey>[^\.^/]+)/$', 'edit_a'),
(r'^A/delete/(?P<bkey>[^\.^/]+)/$', 'delete_a'),
(r'^$', 'index'),
)
urlpatterns += patterns('project.app.views',
(r'^B/$', 'index_b'),
(r'^B/create/$', 'create_b'),
(r'^B/edit/(?P<bkey>[^\.^/]+)/$', 'edit_b'),
(r'^B/delete/(?P<bkey>[^\.^/]+)/$', 'delete_b'),
)
This works but looks really ugly...
Any way to improve this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---