Thursday, July 1, 2010

Admin datetime js widget and urls

Hello all,
I am trying to leverage the Admin site by adding some urls in the
admin class.

Eg.
class Orders(admin.ModelAdmin):
def changelist_view(self,request,customer_id=None):
pass
#set up view for order list based on customer_id by adding
filter to queryset

def get_urls(self):
urls = patterns('',
(r'customer/(?P<customer_id>)/',self.changelist_view),
)
return urls + admin.ModelAdmin.get_urls(self)

This allows a url like
/admin/customers/orders/customer/1/ to access the orders for customer
with id of 1.

This works wonderfully as it allows me to be at the Customer "level"
in regards to their orders (for all functions, viewing list, changing
orders or adding. I always know the customer).

The problem is that when I do this I know longer have the Admin
datetime js widgets and can't seem to get them back. If I access the
admin through the normal url (eg. /admin/customers/orders/ ) they
appear.

Any ideas, please?
Much thanks in advance.

Chris

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment