Commits

aminiy  committed 27cc4cc

востановление пароля

  • Participants
  • Parent commits 2ef605f

Comments (0)

Files changed (2)

File catalog/urls.py

 from django.conf.urls.defaults import patterns, include, url
-from django.contrib.auth.views import login, logout
+from django.contrib.auth.views import login, logout, password_reset
 from django.contrib.staticfiles.urls import staticfiles_urlpatterns
 
 # Uncomment the next two lines to enable the admin:
 urlpatterns = staticfiles_urlpatterns() + patterns('',
     url(r'^accounts/confirm/', 'catalog.userprofs.views.confirm'),
     url(r'^accounts/register/', 'catalog.userprofs.views.register'),
+    url(r'^accounts/password_reset/$', 'django.contrib.auth.views.password_reset', name='admin_password_reset'),
+       (r'^accounts/password_reset/done/$', 'django.contrib.auth.views.password_reset_done'),
+       (r'^reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$', 'django.contrib.auth.views.password_reset_confirm'),
+       (r'^reset/done/$', 'django.contrib.auth.views.password_reset_complete'),
     url(r'^accounts/login/', login, {'template_name': 'form.html'}),
     url(r'^accounts/logout/', logout, {'next_page': '/'}),
     url(r'^accounts/profile/edit/', 'catalog.userprofs.views.my_profile'),
     url(r'^accounts/profile/', 'catalog.userprofs.views.my_profile'),
+
     url(r'^admin/', include(admin.site.urls)),
     url('', 'catalog.userprofs.views.my_profile'),
 

File catalog/userprofs/views.py

     if request.user.is_staff:
         raise Http404
     profile = Profile.objects.filter(user=request.user)
-    ProfConFormSet = inlineformset_factory(Profile, Contact)
+    ProfConFormSet = inlineformset_factory(Profile, Contact, max_num=1)
     if profile:
         profile = Profile.objects.get(user=request.user)
         if request.method == 'POST':