Changes to models for perosn , occupation and location
This commit is contained in:
parent
4e374c8d39
commit
361153ff39
|
@ -11,6 +11,7 @@ GENDER_CHOICES = (
|
|||
('O', 'Other'),
|
||||
)
|
||||
|
||||
|
||||
class Person(ItfModel):
|
||||
#ItfModel stuff:
|
||||
form_names = ['PersonForm', 'PopupPersonForm']
|
||||
|
@ -20,10 +21,10 @@ class Person(ItfModel):
|
|||
first_name = models.CharField(max_length=255)
|
||||
last_name = models.CharField(max_length=255)
|
||||
email = models.EmailField(blank=True, null=True, unique=True, db_index=True)
|
||||
email_validated = models.BooleanField(default=False, editable=False)
|
||||
# email_validated = models.BooleanField(default=False, editable=False) #s commented this out since its handled by allauth
|
||||
tel_no = models.CharField(max_length=100, blank=True)
|
||||
about = models.TextField(blank=True, null=True)
|
||||
dob = models.DateField(null=True, verbose_name="Date of Birth")
|
||||
dob = models.DateField(null=True, verbose_name="Date of Birth", blank=True)
|
||||
is_practitioner = models.BooleanField(default=False)
|
||||
is_enthusiast = models.BooleanField(default=True)
|
||||
is_freelancer = models.BooleanField(default=False)
|
||||
|
@ -41,15 +42,18 @@ class Person(ItfModel):
|
|||
connections = models.ManyToManyField('Person', blank=True, null=True, through='PersonPerson')
|
||||
productions = models.ManyToManyField("Production", blank=True, null=True, through='PersonProduction')
|
||||
trainings = models.ManyToManyField("Training", blank=True, null=True, related_name="trainee")
|
||||
# photos = models.ManyToManyField("PhotoAlbum", blank=True, null=True)
|
||||
# orphans = models.ManyToManyField("Orphan", blank=True, null=True, through='PersonOrphan')
|
||||
|
||||
languages = models.ManyToManyField("Language", blank=True, null=True) #s added
|
||||
|
||||
# photos = models.ManyToManyField("PhotoAlbum", blank=True, null=True)
|
||||
# orphans = models.ManyToManyField("Orphan", blank=True, null=True, through='PersonOrphan')
|
||||
|
||||
#Meta
|
||||
last_accessed = models.DateTimeField(default=datetime.now)
|
||||
|
||||
#Tokens
|
||||
reset_token = models.CharField(max_length=256, null=True, editable=False)
|
||||
validate_token = models.CharField(max_length=256, null=True, editable=False)
|
||||
# reset_token = models.CharField(max_length=256, null=True, editable=False) #s remove these tokens from here
|
||||
# validate_token = models.CharField(max_length=256, null=True, editable=False)
|
||||
|
||||
|
||||
def __unicode__(self):
|
||||
|
@ -59,9 +63,15 @@ class Person(ItfModel):
|
|||
return self.__unicode__()
|
||||
|
||||
|
||||
OCCUPATION_TYPES = (
|
||||
('practitioner', 'Practitioner'),
|
||||
('associate', 'Associate'),
|
||||
)
|
||||
|
||||
class Occupation(models.Model):
|
||||
name = models.CharField(max_length=255)
|
||||
parent = models.ForeignKey('Occupation', blank=True, null=True)
|
||||
occupation_type = models.CharField(choices=OCCUPATION_TYPES)
|
||||
extra_text = models.BooleanField(default=False)
|
||||
|
||||
def __unicode__(self):
|
||||
return self.name
|
||||
|
@ -77,6 +87,59 @@ class Occupation(models.Model):
|
|||
return True
|
||||
return False
|
||||
|
||||
|
||||
STATE_CHOICES= (
|
||||
('0', 'Andaman and Nicobar'),
|
||||
('1', 'Andhra Pradesh'),
|
||||
('2', 'Arunachal Pradesh'),
|
||||
('3', 'Asom (Assam)'),
|
||||
('4', 'Bihar'),
|
||||
('5', 'Chandigarh'),
|
||||
('6', 'Chhattisgarh'),
|
||||
('7', 'Dadra and Nagar Haveli'),
|
||||
('8', 'Daman and Diu'),
|
||||
('9', 'Delhi'),
|
||||
('10', 'Goa'),
|
||||
('11', 'Gujarat'),
|
||||
('12', 'Haryana'),
|
||||
('13', 'Himachal Pradesh'),
|
||||
('14', 'Jammu And Kashmir'),
|
||||
('15', 'Jharkhand'),
|
||||
('16', 'Karnataka'),
|
||||
('17', 'Kerala'),
|
||||
('18', 'Lakshadweep'),
|
||||
('19', 'Madhya Pradesh'),
|
||||
('20', 'Maharashtra'),
|
||||
('21', 'Manipur'),
|
||||
('22', 'Meghalaya'),
|
||||
('23', 'Mizoram'),
|
||||
('24', 'Nagaland'),
|
||||
('25', 'Odisha(Orrisa)'),
|
||||
('26', 'Pondicherry'),
|
||||
('27', 'Punjab'),
|
||||
('28', 'Rajasthan'),
|
||||
('29', 'Sikkim'),
|
||||
('30', 'Tamilnadu'),
|
||||
('31', 'Tripura'),
|
||||
('32', 'Uttarakhand (Uttaranchal)'),
|
||||
('33', 'Uttar Pradesh'),
|
||||
('34', 'West Bengal')
|
||||
)
|
||||
|
||||
class City(models.Model):
|
||||
name = models.CharField(max_length=255)
|
||||
state = models.CharField(choices = STATE_CHOICES)
|
||||
|
||||
|
||||
from django.contrib.localflavor.in_.forms import INZipCodeField
|
||||
class Location(models.Model):
|
||||
lat= models.FloatField(blank=True, null=True)
|
||||
lon= models.FloatField(blank=True, null=True)
|
||||
city = models.ForeignKey(City)
|
||||
pincode= INZipCodeField()
|
||||
address= models.TextFie
|
||||
|
||||
|
||||
class PersonOccupation(models.Model):
|
||||
person = models.ForeignKey(Person, db_index=True)
|
||||
occupation = models.ForeignKey(Occupation)
|
||||
|
@ -97,13 +160,6 @@ class Relation(models.Model):
|
|||
def __unicode__(self):
|
||||
return self.name
|
||||
|
||||
class Location(models.Model):
|
||||
address = models.TextField(blank=True, null=True)
|
||||
city = models.CharField(blank=True, max_length=255, db_index=True)
|
||||
pin_code = INZipCodeField()
|
||||
lat = models.FloatField(blank=True, null=True)
|
||||
lng = models.FloatField(blank=True, null=True)
|
||||
|
||||
|
||||
class Training(models.Model):
|
||||
person = models.ForeignKey("Person")
|
||||
|
|
|
@ -228,16 +228,18 @@ INSTALLED_APPS = (
|
|||
'emailconfirmation',
|
||||
)
|
||||
|
||||
LOGIN_REDIRECT_URL = '/itf_profile'
|
||||
|
||||
# jj allauthsettingsa
|
||||
LOGIN_REDIRECT_URL = '/edit_profile'
|
||||
#ACCOUNT_AUTHENTICATION_METHOD=''
|
||||
|
||||
#ACCOUNT_AUTHENTICATION_METHOD = 'username_email'
|
||||
#ACCOUNT_AUTHENTICATION_METHOD = 'email'
|
||||
ACCOUNT_EMAIL_REQUIRED=True
|
||||
ACCOUNT_EMAIL_VERIFICATION=False
|
||||
ACCOUNT_EMAIL_SUBJECT_PREFIX="[ITF]"
|
||||
ACCOUNT_SIGNUP_PASSWORD_VERIFICATION=True
|
||||
ACCOUNT_SIGNUP_FORM_CLASS='itfprofiles.forms.ItfAllAuthRegForm'
|
||||
ACCOUNT_UNIQUE_EMAIL=False
|
||||
ACCOUNT_UNIQUE_EMAIL=True
|
||||
# TODO ACCOUNT_USER_DISPLAY (=a callable returning user.username)
|
||||
ACCOUNT_PASSWORD_MIN_LENGTH=4
|
||||
SOCIALACCOUNT_AVATAR_SUPPORT='avatar'
|
||||
|
|
Loading…
Reference in New Issue
Block a user