Answer the question
In order to leave comments, you need to log in
How to use Username as slug?
Good afternoon.
Tell me how to use the username field of the model as a slug when working with CBV (for example, generic.DetailVew)
I suppose that you can override the slig_field attribute in the SingleObjectmixin mixin?
Answer the question
In order to leave comments, you need to log in
zigen : Understood
class MyClassDetailView(DetailView):
model = User
slug_field = 'username'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question