added itfprofiles app

This commit is contained in:
Sanj 2012-02-02 16:13:34 +05:30
parent 2db5425fe0
commit ff5ed1fdb1
5 changed files with 43 additions and 0 deletions

View File

13
itf/itfprofiles/forms.py Normal file
View File

@ -0,0 +1,13 @@
from django import forms
from registration.forms import RegistrationForm
from models import ItfProfile
from registration.models import RegistrationProfile
class ItfRegistrationForm(RegistrationForm):
subscribe = forms.BooleanField(help_text='Subscribe to newsletter?')
def save(self, profile_callback=None):
new_user = RegistrationProfile.objects.create_inactive_user(username=self.cleaned_data['username'], password=self.cleaned_data['password1'], email=self.cleaned_data['email'])
new_profile = ItfProfile(user=new_user, subscribed=self.cleaned_data['subscribe'])
new_profile.save()
return new_user

13
itf/itfprofiles/models.py Normal file
View File

@ -0,0 +1,13 @@
from django.db import models
from app.models import ItfModel
from django.contrib.auth.models import User
class ItfProfile(ItfModel):
user = models.ForeignKey(User, null=True)
subscribed = models.BooleanField(default=True)
# Create your models here.

16
itf/itfprofiles/tests.py Normal file
View File

@ -0,0 +1,16 @@
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 always equals 2.
"""
self.assertEqual(1 + 1, 2)

1
itf/itfprofiles/views.py Normal file
View File

@ -0,0 +1 @@
# Create your views here.