#15294: Use named urls instead of hard coded ones in admin views -------------------------------------+------------------------------------- Reporter: julien | Owner: ramiro Type: New feature | Status: closed Component: contrib.admin | Version: SVN Severity: Normal | Resolution: fixed Keywords: | Triage Stage: Ready for Has patch: 1 | checkin Needs tests: 0 | Needs documentation: 0 Easy pickings: 0 | Patch needs improvement: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by ramiro): Replying to [comment:41 kingtut]: > This is breaking apps that do not have add permissions (NoReverseMatch), e.g. django-mailchimp campaigns are always added remotely. > > {{{ > if True in perms.values(): > info = (app_label, model._meta.module_name) > model_dict = { > 'name': capfirst(model._meta.verbose_name_plural), > - 'admin_url': mark_safe('%s/%s/' % (app_label, model.__name__.lower())), > + 'admin_url': reverse('admin:%s_%s_changelist' % info, current_app=self.name), > + 'add_url': reverse('admin:%s_%s_add' % info, current_app=self.name), > }}} > If the add or change permission is false, why bother resolving the url. Perhaps only include the 'add_url' when the 'add' permission exists? > > Or is is mandatory now that apps implement add, change and delete urls? I've opened #17333 for this. -- Ticket URL: <https://code.djangoproject.com/ticket/15294#comment:43> Django <https://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 django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.