From 64ab50bb06eb01b4364bfcdaf45ae926b6670612 Mon Sep 17 00:00:00 2001 From: Sashi20 Date: Fri, 14 Sep 2018 15:17:21 +0530 Subject: Enabled registration and login interface, activation emails, paper submission interface --- website/models.py | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 3 deletions(-) (limited to 'website/models.py') diff --git a/website/models.py b/website/models.py index b73446b..f5b004a 100644 --- a/website/models.py +++ b/website/models.py @@ -3,8 +3,29 @@ from django.contrib.auth.models import User from social.apps.django_app.default.models import UserSocialAuth from nccps2018 import settings +from django.core.validators import RegexValidator import os +position_choices = ( + ("student", "Student"), + ("faculty", "Faculty"), + ("industry_people", "Industry People"), +) + +source = ( + ("FOSSEE website", "FOSSEE website"), + ("Google", "Google"), + ("Social Media", "Social Media"), + ("From other College", "From other College"), +) + +title = ( + ("Mr", "Mr."), + ("Miss", "Ms."), + ("Professor", "Prof."), + ("Doctor", "Dr."), +) + def get_document_dir(instance, filename): # ename, eext = instance.user.email.split("@") @@ -15,11 +36,12 @@ def get_document_dir(instance, filename): class Proposal(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE,) - about_me = models.TextField(max_length=500) + name_of_authors = models.CharField(max_length=200, default='None') + about_the_authors = models.TextField(max_length=500) email = models.CharField(max_length=128) phone = models.CharField(max_length=20) title = models.CharField(max_length=250) - abstract = models.TextField(max_length=700) + abstract = models.TextField(max_length=10, default='abstract') prerequisite = models.CharField(max_length=750) duration = models.CharField(max_length=100) attachment = models.FileField(upload_to=get_document_dir) @@ -41,4 +63,38 @@ class Comments(models.Model): proposal = models.ForeignKey(Proposal, on_delete=models.CASCADE,) user = models.ForeignKey(User, on_delete=models.CASCADE,) comment = models.CharField(max_length=700) - # rate = models.CharField(max_length =100) \ No newline at end of file + # rate = models.CharField(max_length =100) + +# profile module + + +class Profile(models.Model): + """Profile for users""" + + user = models.OneToOneField(User, on_delete=models.CASCADE) + title = models.CharField(max_length=32, blank=True, choices=title) + institute = models.CharField(max_length=150) + phone_number = models.CharField( + max_length=10, + validators=[RegexValidator( + regex=r'^.{10}$', message=( + "Phone number must be entered \ + in the format: '9999999999'.\ + Up to 10 digits allowed.") + )], null=False) + position = models.CharField(max_length=32, choices=position_choices, + default='student', + help_text='Selected catagoery ID shold be required') + how_did_you_hear_about_us = models.CharField( + max_length=255, blank=True, choices=source) + is_email_verified = models.BooleanField(default=False) + activation_key = models.CharField(max_length=255, blank=True, null=True) + key_expiry_time = models.DateTimeField(blank=True, null=True) + + def __str__(self): + return u"id: {0}| {1} {2} | {3} ".format( + self.user.id, + self.user.first_name, + self.user.last_name, + self.user.email + ) \ No newline at end of file -- cgit From cb6b8b3112363c8717575ee09f4447404ab99c59 Mon Sep 17 00:00:00 2001 From: Sashi20 Date: Mon, 17 Sep 2018 16:32:56 +0530 Subject: Added nccps-2018 prefix to the urls --- website/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'website/models.py') diff --git a/website/models.py b/website/models.py index f5b004a..06a84ac 100644 --- a/website/models.py +++ b/website/models.py @@ -31,7 +31,7 @@ def get_document_dir(instance, filename): # ename, eext = instance.user.email.split("@") fname, fext = os.path.splitext(filename) # print "----------------->",instance.user - return '%s/attachment/%s/%s.%s' % (instance.user, instance.proposal_type, fname+'_'+str(instance.user), fext) + return 'paper_uploads/%s/attachment/%s/%s.%s' % (instance.user, instance.proposal_type, fname+'_'+str(instance.user), fext) class Proposal(models.Model): -- cgit