Opened 8 years ago

Closed 8 years ago

#5085 closed (fixed)

Make the default value of slug_field be 'slug'

Reported by: trevor@… Owned by: jacob
Component: Generic views Version: master
Severity: Keywords: slug_field
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The default value for the parameter slug_field in the functions create_update.delete_object, create_update.delete_object, date_based.object_detail and list_detail.object_detail should be 'slug'. 'slug' is a common field name for SlugFields, and in case you choose that field name, your url configuration can be substantially simpler (for example, you can share the extra_context dict between an object_list and object_detail for the same table). There is little cost to making this the default, in order to enable slug-based matching, you will still have to pass a slug parameter.

Attachments (2)

set-default-value-of-slug_field-to-slug.diff (4.3 KB) - added by Trevor Caira <trevor@…> 8 years ago.
Add default values to generic view parameters and update documentation
remove-explicit-specification-of-slug_field-from-website.diff (714 bytes) - added by Trevor Caira <trevor@…> 8 years ago.
Removed the explicit specification of slug_field from the urls.py of the weblog of the website

Download all attachments as: .zip

Change History (7)

comment:1 Changed 8 years ago by SmileyChris

  • Triage Stage changed from Unreviewed to Design decision needed

Seems to make common sense. Yes?

comment:2 Changed 8 years ago by adrian

  • Triage Stage changed from Design decision needed to Accepted

Good idea! Could somebody include a patch, including changes to the documentation?

Changed 8 years ago by Trevor Caira <trevor@…>

Add default values to generic view parameters and update documentation

Changed 8 years ago by Trevor Caira <trevor@…>

Removed the explicit specification of slug_field from the urls.py of the weblog of the website

comment:3 Changed 8 years ago by Simon G. <dev@…>

  • Has patch set
  • Needs documentation unset
  • Triage Stage changed from Accepted to Ready for checkin

comment:4 Changed 8 years ago by mtredinnick

The second patch isn't worth applying, since it doesn't hurt to leave things as they are (and updating the website source is more involved than trunk). So this bug will be closed once the first patch goes in.

comment:5 Changed 8 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

(In [5877]) Fixed #5085 -- In generic views, set the default name for the slug field to 'slug'. Thanks, Trevor Caira.

Note: See TracTickets for help on using tickets.
Back to Top