Answer the question
In order to leave comments, you need to log in
How to resolve conflict between user slug and service slug?
Hello!
urlpatterns = [
url(r'^register/$', UserSignup.as_view(), name='signup'),
url(r'^login/$', UserLogin.as_view(), name='login'),
url(r'^logout/$', UserLogout.as_view(), name='logout'),
url(r'^edit/$', UserSettings.as_view(), name='settings'),
url(r'^feedback/$', Feedback.as_view(), name='feedback'),
url(r'^(?P<slug>[-_\w]+)/$', UserDetail.as_view(), name='user_detail'),
]
Answer the question
In order to leave comments, you need to log in
There was a similar situation. We check the user's slug field for matches with prohibited names in the user registration form:
class UserRegForm(AuthentificationForm):
...
def clean_slug(self):
slug = self.cleaned_data.get('slug')
if slug in settings.PROHIBITED_NAMES:
raise forms.ValidationError(u'Данное название уже было зарезервировано')
return slug
PROHIBITED_NAMES = ('article', 'accounts', 'admin', 'ckeditor',....)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question