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 moving to the new database
(ex: you can not use direct link to the product in your webshop).

Many thanks,

Serge


+380 636150445
skype: skhohlov


On Wed, Jun 4, 2014 at 4:49 PM, monoBOT <monobot.s...@gmail.com> wrote:

> Thats a matter of taste ... i use model_id
>
>
> 2014-06-04 14:07 GMT+01:00 Thomas Güttler <h...@tbz-pariv.de>:
>
> 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
>>  - .....
>>
>> example:
>>
>> urlpatterns = [
>>     url(r'^article/(?P<WHAT_NAME_HERE>\d+)/$', 'article.view'),
>>     ...
>>     ]
>>
>> Up to now we used "mymodel_id" but it gets boring to type in "mymodel".
>>
>> This is a question about best practice:
>>
>> Which do you use (and why)?
>>
>>
>> Related: https://docs.djangoproject.com/en/dev/topics/http/urls/#
>> named-groups
>>
>>   Thomas
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/django-users/538F19FF.1090209%40tbz-pariv.de.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> *monoBOT*
> Visite mi sitio(Visit my site): monobotblog.alvarezalonso.es
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2BxOsGD3ePtXWNd-D9AmZ_4mr_%3D3cS_uTi61i5Aou6n7SmZ9QA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CA%2BxOsGD3ePtXWNd-D9AmZ_4mr_%3D3cS_uTi61i5Aou6n7SmZ9QA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADTRxJM00kN%3D9sDez34shxpBbweC8CSofbryy%2Bc_cCtQAS8KLg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to