Django

Code

Ticket #5085 (closed: fixed)

Opened 1 year ago

Last modified 1 year ago

Make the default value of slug_field be 'slug'

Reported by: trevor@caira.com Assigned to: jacob
Milestone: Component: Generic views
Version: SVN Keywords: slug_field
Cc: Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

set-default-value-of-slug_field-to-slug.diff (4.3 kB) - added by Trevor Caira <trevor@caira.com> on 08/06/07 06:01:17.
Add default values to generic view parameters and update documentation
remove-explicit-specification-of-slug_field-from-website.diff (0.7 kB) - added by Trevor Caira <trevor@caira.com> on 08/06/07 06:02:50.
Removed the explicit specification of slug_field from the urls.py of the weblog of the website

Change History

08/04/07 17:03:01 changed by SmileyChris

  • stage changed from Unreviewed to Design decision needed.

Seems to make common sense. Yes?

08/05/07 23:54:30 changed by adrian

  • stage changed from Design decision needed to Accepted.

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

08/06/07 06:01:17 changed by Trevor Caira <trevor@caira.com>

  • attachment set-default-value-of-slug_field-to-slug.diff added.

Add default values to generic view parameters and update documentation

08/06/07 06:02:50 changed by Trevor Caira <trevor@caira.com>

  • attachment remove-explicit-specification-of-slug_field-from-website.diff added.

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

08/06/07 06:54:54 changed by Simon G. <dev@simon.net.nz>

  • needs_docs deleted.
  • has_patch set to 1.
  • stage changed from Accepted to Ready for checkin.

08/12/07 07:56:06 changed 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.

08/12/07 07:59:41 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

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


Add/Change #5085 (Make the default value of slug_field be 'slug')




Change Properties
Action