Skip to content

Commit

Permalink
[Enhance] project_template cleaned
Browse files Browse the repository at this point in the history
  • Loading branch information
attuch committed Dec 14, 2012
1 parent 839a760 commit 50d6bfb
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 16 deletions.
1 change: 1 addition & 0 deletions project_template/account/admin.py
@@ -1,3 +1,4 @@
from django.contrib import admin
from django.contrib.admin import site as admin_site
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
Expand Down
13 changes: 4 additions & 9 deletions project_template/account/models.py
Expand Up @@ -9,21 +9,16 @@

from django.contrib.aderit.access_account.models import AccessAccount
from django.contrib.aderit.generic_utils.models.fields import \
GenericPhoneField as PhoneField
GenericPhoneField as PhoneField

logger = getLogger('account.models')


### User Profile Model
class Account(AccessAccount):
phone = PhoneField(_("Phone"), max_length=125, blank=True) # telefono fisso
mobile_phone = PhoneField(_("Mobile Phone"), max_length=125, blank=True) # telefono mobile
company = models_fields.CharField(_("Company"), max_length=125, blank=True) # ragione sociale
address = models_fields.CharField(_("Address"), max_length=125, blank=True) # indirizzo di fatturazione
zip_code = models_fields.CharField(_("Zip Code"), max_length=125, blank=True) # cap
location = models_fields.CharField(_("Location"), max_length=125, blank=True) # localita'
country = models_fields.CharField(_("Country"), max_length=125, blank=True) # paese
reported_by = models_fields.CharField(_("Reported By"), max_length=250, blank=True) # da chi ne ha sentito parlare
phone = PhoneField(_("Phone"), max_length=125, blank=True) # home phone
mobile_phone = PhoneField(_("Mobile Phone"), max_length=125, blank=True) # mobile phone
reported_by = models_fields.CharField(_("Reported By"), max_length=250, blank=True) # who spoke about

class Meta:
verbose_name = _('Account')
Expand Down
10 changes: 10 additions & 0 deletions project_template/account/templates/account/account_form_as_ul.html
@@ -0,0 +1,10 @@
{% extends "base.html" %}

{% block content %}

<form action="" method="POST">{% csrf_token %}
{{form.as_ul}}
<input class="btn" type="submit" value="submit" />
</form>

{% endblock %}
7 changes: 7 additions & 0 deletions project_template/account/templates/account/pswchanged.html
@@ -0,0 +1,7 @@
{% extends "base.html" %}

{% block content %}

Password Changed

{% endblock %}
7 changes: 4 additions & 3 deletions project_template/account/urls.py
Expand Up @@ -30,7 +30,7 @@

url(r'^signup/$',
SignupView.as_view(model=Account, use_captcha=True,
additional_exclude_formfields=['token', 'cash'],
additional_exclude_formfields=['token'],
require_formfields=['email'],
after_signup_callback=callback_on_signup,
debug_dispatch_method=True, debug_dispatch_method_full=False,
Expand All @@ -46,13 +46,14 @@
name='chpsw'),

url(r'^password/forgot/((?P<token>.+)/)?$',
ForgotPasswordView.as_view(template_name="account/forgot.html",
ForgotPasswordView.as_view(template_name="account/account_form_as_ul.html",
success_template_name="account/forgot_psw_ok.html",
change_password_named_url='chpsw'),
name='forgotpsw'),


url(r'^chprofile/(?P<slug>.*)/$',
UpdateView.as_view(model=Account, slug_field='id', additional_exclude_formfields=['token', 'cash'],
UpdateView.as_view(model=Account, slug_field='id', additional_exclude_formfields=['token'],
use_captcha=False, use_login_required_decorator=True,
template_name="account/account_form_as_ul.html",
success_url="/"),
Expand Down
13 changes: 13 additions & 0 deletions project_template/account/utils.py
@@ -0,0 +1,13 @@
from django.utils.log import getLogger

logger = getLogger('account.utils')


def callback_on_signup(self):
#TODO To implement something if requested
pass


def callback_on_login(self):
#TODO To implement something if requested
pass
3 changes: 0 additions & 3 deletions project_template/account/views.py
Expand Up @@ -19,9 +19,6 @@

logger = getLogger('account.views')

ALERT_ON_CHARGE = getattr(settings, 'SEND_MAIL_ON_CHARGE', False)
ALERT_TYPE_NAME_ON_CHARGE = getattr(settings, 'SEND_MAIL_ON_CHARGE_TYPE_NAME', 'oncharge')


class SignupView(AccessAccountSignupView):

Expand Down
2 changes: 1 addition & 1 deletion project_template/settings.py
Expand Up @@ -173,7 +173,7 @@
#SESSION_COOKIE_AGE = 3600
#SESSION_SAVE_EVERY_REQUEST = True
LOGIN_URL = "/access"
#LOGIN_REDIRECT_URL
LOGIN_REDIRECT_URL = "/"
#ACCESS_ACCOUNT_USE_CAPTCHA = False

AUTH_PROFILE_MODULE = 'account.Account'
Expand Down

0 comments on commit 50d6bfb

Please sign in to comment.