Thank you for answering my question.
Unfortunately "slug" does not work in my context.
My model does not have a "slug". It is like a ticket/issue system. There
are several hundred of tickets each day.
Thomas Güttler
Am 04.06.2014 15:07, schrieb Thomas Güttler:
What is the best practice for
Jnt of the best way is a slug.
I nether do use id or object_id by security reason (hacker can try to
access another object or count on objects in your application, such as
administrator usually has id as 0 or small number. It is good target for
attack). Keep in mind that id is mutable after
Thats a matter of taste ... i use model_id
2014-06-04 14:07 GMT+01:00 Thomas Güttler :
> What is the best practice for named URL parameter which refer to a primary
> key of a model?
>
> I have seen many ways:
>
> - object_id
> - mymodel_id
> - pk
> - id
> - .
>
>
If you use "DetailView"
(https://docs.djangoproject.com/en/dev/ref/class-based-views/generic-display
/#django.views.generic.detail.DetailView) you may call this field "slug" (it
is default). But you can overwrite it.
But in your case custom function is used, so you may call this field
whatever
I am not aware of any best practices for wording here, though my general
recommendaton would the wording should be identical to the attribute name
of the model, e.d. 'id', 'slug' or whatever. I would not add the "mymodel"
prefix as long as it becomes clear from the context to which model it
5 matches
Mail list logo