diff --git a/users/templates/users/new_user.html b/users/templates/users/user.html
similarity index 77%
rename from users/templates/users/new_user.html
rename to users/templates/users/user.html
index e6047fab..19be1d1a 100644
--- a/users/templates/users/new_user.html
+++ b/users/templates/users/user.html
@@ -9,6 +9,6 @@
{% endblock %}
diff --git a/users/urls.py b/users/urls.py
index 616af19b..82396778 100644
--- a/users/urls.py
+++ b/users/urls.py
@@ -4,5 +4,6 @@ from . import views
urlpatterns = [
url(r'^new_user/$', views.new_user, name='new_user'),
+ url(r'^edit_info/(?P[0-9]+)$', views.edit_info, name='edit_info'),
]
diff --git a/users/views.py b/users/views.py
index 4f9b738f..87242c40 100644
--- a/users/views.py
+++ b/users/views.py
@@ -6,7 +6,7 @@ from django.shortcuts import render_to_response, get_object_or_404
from django.core.context_processors import csrf
from django.template import Context, RequestContext, loader
-from users.models import UserForm, InfoForm
+from users.models import User, UserForm, InfoForm, PasswordForm, StateForm
def form(ctx, template, request):
@@ -19,7 +19,17 @@ def new_user(request):
user = InfoForm(request.POST)
if user.is_valid():
user.save()
- return form({'userform': user}, 'users/new_user.html', request)
+ return form({'userform': user}, 'users/user.html', request)
else:
user = InfoForm()
- return form({'userform': user}, 'users/new_user.html', request)
+ return form({'userform': user}, 'users/user.html', request)
+
+def edit_info(request, userid):
+ try:
+ user = User.objects.get(pk=userid)
+ except User.DoesNotExist:
+ user = None
+ user = InfoForm(request.POST or None, instance=user)
+ if user.is_valid():
+ user.save()
+ return form({'userform': user}, 'users/user.html', request)