I've been trying to add the URLs of the system with the user name as a parameter in them, but it did not work for me, I've seen some reviews here and it did not work for me the way as they have done or solved their problem.
views.py
@login_required
def profile(request, username):
User = get_object_or_404(user, username=username)
return render(request, 'dashboard/Profile.html', {'profile': User})
urls.py
url(r'^profile/(?P<username>\w+)/$', views.profile, name='profile'),
if need, here is my forms.py
class RegistrationForm(forms.Form):
username = forms.RegexField(regex=r'^\w+$', widget=forms.TextInput(attrs= {'class': 'form-control'}),
label=_("Username"), error_messages={'invalid': _("This value must be contain only letters, number and undescores.!")})
email = forms.EmailField(widget=forms.TextInput(attrs={'class': 'form-control'}), label=_("Email Address"))
password1 = forms.CharField(widget=forms.PasswordInput(attrs={'class': 'form-control'}), label=_("Type your password"))
password2 = forms.CharField(widget=forms.PasswordInput(attrs={'class': 'form-control'}), label=_("Retype your password"))