tangentlabs / django-fancypages

A Content Enhancement System for Django
https://django-fancypages.readthedocs.org
BSD 3-Clause "New" or "Revised" License
34 stars 11 forks source link

Inconsistency in context_object_name for dashboard views #16

Closed rosner closed 10 years ago

rosner commented 10 years ago

Hey,

the PageDeleteView does not have set the context_object_name to page but the template page_delete.html uses page as the context variable. This raises an Exception in rendering the breadcrumbs in the delete page because page.pk is referenced but there is no page object in the context. Quick fix would be to set the context_object_name in the PageDeleteView.

Also not all dashboard views do have context_object_name set. Is this on purpose? Would you rather use context_object_name or stay with default django behaviour (object and object_list).

What do you think @elbaschid ?. I can come up with a PR.

Also in the delete template there are properties used that the default FancyPage model doesn't have - like title.

roadsideseb commented 10 years ago

You are absolutely right. I generally prefer having a context_object_name set to make it easier to comprehend the object(s) you are working with in the templates. I've changed the dashboard views and renamed the context_object_name for the views to fancypage or fancypage_list to avoid clashes with pagination objects on list pages (we had that issue before). Does that fix your issue?