Opened 17 years ago

Closed 17 years ago

#5085 closed (fixed)

Make the default value of slug_field be 'slug'

Reported by: trevor@… Owned by: Jacob
Component: Generic views Version: dev
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: no UI/UX: no

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@…> 17 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@…> 17 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 by Chris Beaven, 17 years ago

Triage Stage: UnreviewedDesign decision needed

Seems to make common sense. Yes?

comment:2 by Adrian Holovaty, 17 years ago

Triage Stage: Design decision neededAccepted

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

by Trevor Caira <trevor@…>, 17 years ago

Add default values to generic view parameters and update documentation

by Trevor Caira <trevor@…>, 17 years ago

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

comment:3 by Simon G. <dev@…>, 17 years ago

Has patch: set
Needs documentation: unset
Triage Stage: AcceptedReady for checkin

comment:4 by Malcolm Tredinnick, 17 years ago

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 by Malcolm Tredinnick, 17 years ago

Resolution: fixed
Status: newclosed

(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