Commits

vl...@vlad-Vostro-3500  committed 1acb01e Draft

registration app

  • Participants
  • Parent commits 90f5780

Comments (0)

Files changed (8)

File maps/models.py

 class UserProfile(models.Model):
 
     user = models.ForeignKey(User, related_name="profile")
-    group_profile = models.ForeignKey(GroupProfile)
+    group_profile = models.ForeignKey(GroupProfile,null=True,blank=True)
     file = models.ImageField(upload_to='uploads/%Y/%m/%d/%H/%M/%S/', null=True,blank=True)
 
     @property
 def create_user_profile(user, request, **kwargs):
 
     map_id = request.REQUEST.get('map_id', False)
-    map = Map.objects.get(id = map_id)
-    logging.info('ffffffffffffffff %s' % map.group_profile)
-    profile = UserProfile.objects.create(user=user,group_profile = map.group_profile)
+    if map_id:
+        map = Map.objects.get(id = map_id)
+        profile = UserProfile.objects.create(user=user,group_profile = map.group_profile)
+    else:
+        profile = UserProfile.objects.create(user=user)
+
     profile.save()
 
 signals.user_registered.connect(create_user_profile)
     'django.contrib.admin',
     'django.contrib.contenttypes',
     'invitation',
-    'registration',
 #    'googleappsauth',
     'django.contrib.auth',
+    'registration',
     'django.contrib.sessions',
     'djangotoolbox',
     'autoload',

File templates/base.html

-<!DOCTYPE html 
-     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
-    dir="{% if LANGUAGE_BIDI %}rtl{% else %}ltr{% endif %}"
-    xml:lang="{% firstof LANGUAGE_CODE 'en' %}"
-    lang="{% firstof LANGUAGE_CODE 'en' %}">
-  <head>
-    <title>{% block title %}{% endblock %} - Nonrel-testapp</title>
-
-    {% block css %}
-    {% endblock %}
-
-    {% block preload_js %}
-    {% endblock %}
-
-    {% block extra-head %}{% endblock %}
-  </head>
-
-  <body>
-    <div id="header">
-      <a id="logo" href="/">Nonrel-testapp</a>
-    </div>
-
-    <div class="columns">
-      <div id="content" class="column">
-        {% block content-header %}
-          {% if error %}<div class="error">{{ error }}</div>{% endif %}
-          {% if info %}<div class="info">{{ info }}</div>{% endif %}
-          {% if messages %}
-            {% for message in messages %}
-              <div class="info">{{ message }}</div>
-            {% endfor %}
-          {% endif %}
-        {% endblock %}
-
-        {% block content %}{% endblock %}
-      </div>
-
-      <div id="sidebar" class="column">
-        {% block sidebar %}
-        {% endblock %}
-      </div>
-    </div>
-
-    <div id="footer">
-      <p>Powered by <a href="http://www.allbuttonspressed.com/projects/django-nonrel">Django-nonrel</a></p>
-    </div>
-
-    {% block js %}
-    {% endblock %}
-  </body>
-</html>
+<!doctype html>
+<html>
+<head>
+    <title>{% block title %}{% endblock %}</title>
+</head>
+<body>
+{% block content %}{% endblock %}
+</body>
+</html>

File templates/registration/activate.html

+{% extends "registration/registration_base.html" %}
+{% block title %}{% if account %}Activation complete{% else %}Activation problem{% endif %}{% endblock %}
+{% block content %}
+{% if account %}
+Thanks {{ account }}, activation complete!  You may now <a href='{% url auth_login %}'>login</a> using the username and password you set at registration.
+{% else %}
+Oops &ndash; it seems that your activation key is invalid.  Please check the url again.
+{% endif %}
+{% endblock %}
+

File templates/registration/password_change_done.html

-{% extends "admin/base_site.html" %}
-{% load i18n %}
-{% load url from future %}
-{% block userlinks %}{% url 'django-admindocs-docroot' as docsroot %}{% if docsroot %}<a href="{{ docsroot }}">{% trans 'Documentation' %}</a> / {% endif %}{% trans 'Change password' %} / <a href="../../logout/">{% trans 'Log out' %}</a>{% endblock %}
-{% block breadcrumbs %}<div class="breadcrumbs"><a href="/">{% trans 'Home' %}</a> &rsaquo; {% trans 'Password change' %}</div>{% endblock %}
+{% extends "registration/registration_base.html" %}
+{% block title %}Password changed{% endblock %}
+{% block content %}
+Password successfully changed!
+{% endblock %}
 
-{% block title %}{% trans 'Password change successful' %}{% endblock %}
-
-{% block content %}
-
-<h1>{% trans 'Password change successful' %}</h1>
-
-<p>{% trans 'Your password was changed.' %}</p>
-
-{% endblock %}

File templates/registration/password_change_form.html

-{% extends "admin/base_site.html" %}
-{% load i18n adminmedia %}
-{% load url from future %}
-{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/forms.css" />{% endblock %}
-{% block userlinks %}{% url 'django-admindocs-docroot' as docsroot %}{% if docsroot %}<a href="{{ docsroot }}">{% trans 'Documentation' %}</a> / {% endif %} {% trans 'Change password' %} / <a href="../logout/">{% trans 'Log out' %}</a>{% endblock %}
-{% block breadcrumbs %}<div class="breadcrumbs"><a href="/">{% trans 'Home' %}</a> &rsaquo; {% trans 'Password change' %}</div>{% endblock %}
-
-{% block title %}{% trans 'Password change' %}{% endblock %}
-
-{% block content %}<div id="content-main">
-
-<form action="" method="post">{% csrf_token %}
-<div>
-{% if form.errors %}
-    <p class="errornote">
-    {% blocktrans count form.errors.items|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
-    </p>
-{% endif %}
-
-<h1>{% trans 'Password change' %}</h1>
-
-<p>{% trans "Please enter your old password, for security's sake, and then enter your new password twice so we can verify you typed it in correctly." %}</p>
-
-<fieldset class="module aligned wide">
-
-<div class="form-row">
-    {{ form.old_password.errors }}
-    <label for="id_old_password" class="required">{% trans 'Old password' %}:</label>{{ form.old_password }}
-</div>
-
-<div class="form-row">
-    {{ form.new_password1.errors }}
-    <label for="id_new_password1" class="required">{% trans 'New password' %}:</label>{{ form.new_password1 }}
-</div>
-
-<div class="form-row">
-{{ form.new_password2.errors }}
-    <label for="id_new_password2" class="required">{% trans 'Password (again)' %}:</label>{{ form.new_password2 }}
-</div>
-
-</fieldset>
-
-<div class="submit-row">
-    <input type="submit" value="{% trans 'Change my password' %}" class="default" />
-</div>
-
-<script type="text/javascript">document.getElementById("id_old_password").focus();</script>
-</div>
-</form></div>
-
+{% extends "registration/registration_base.html" %}
+{% block title %}Change password{% endblock %}
+{% block content %}
+<form method='post' action=''>{% csrf_token %}
+<table>
+    {{ form }}
+    <tr><td></td><td><input type='submit' value="Change password" /></td></tr>
+</table>
+</form>
 {% endblock %}

File templates/registration/registration_form.html

-{% extends 'admin/base_site.html' %}
-{% load i18n %}
-{% block breadcrumbs %}<div class="breadcrumbs"><a href="/">{% trans 'Home' %}</a></div>{% endblock %}
-{% block coltype %}diagram{% endblock %}
-
-
+{% extends "registration/registration_base.html" %}
+{% block title %}Register for an account{% endblock %}
 {% block content %}
-<form method="post" action=".">
-	{% csrf_token %}
-	<table>
-		{% for field in form %}
-			<tr>
-				<td>{{field.label}}:</td>
-
-					<td>{{field}}</td>
-
-				<td>{{field.errors}}</td>
-			</tr>
-		{% endfor %}
-	</table>
-    <input type="hidden" name="invitation_key" value="{{ invitation_key }}">
-    <input type="hidden" name="map_id" value="{{ map_id }}">
-  <input type="submit" value="{% trans 'Submit' %}" />
-</form>
+<table>
+    <form method='post' action=''>{% csrf_token %}
+        {{ form }}
+        <tr><td></td><td><input type="submit" value="Send activation email" /></td>
+    </form>
+</table>
 {% endblock %}
     (r'test-hangout$', 'django.views.generic.simple.direct_to_template',
      {'template': 'meeting.html'}),
     (r'accounts/login/$', 'django.contrib.auth.views.login'),
+    (r'^accounts/', include('registration.backends.default.urls')),
     (r'^', include('maps.urls')),
     (r'^', include('releases.urls')),
     (r'^', include('invitation.urls')),