diff options
author | prashantsinalkar | 2018-08-15 23:36:14 +0530 |
---|---|---|
committer | prashantsinalkar | 2018-08-15 23:36:14 +0530 |
commit | a0d9fca3982a4b62f84cfbe787042518e269c68e (patch) | |
tree | d6efd0aa17d9d60dd36f69fb926642ae3c01dafd | |
parent | 799dc3f03791ed17cf8ce58faa0b98a4beba0697 (diff) | |
download | SciPy2018-a0d9fca3982a4b62f84cfbe787042518e269c68e.tar.gz SciPy2018-a0d9fca3982a4b62f84cfbe787042518e269c68e.tar.bz2 SciPy2018-a0d9fca3982a4b62f84cfbe787042518e269c68e.zip |
added models
-rw-r--r-- | website/models.py | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/website/models.py b/website/models.py index 71a8362..352758c 100644 --- a/website/models.py +++ b/website/models.py @@ -1,3 +1,39 @@ from django.db import models +from django.contrib.auth.models import User -# Create your models here. +from social.apps.django_app.default.models import UserSocialAuth +from Scipy2018 import settings +import os + +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) + +class Proposal(models.Model): + user = models.ForeignKey(User,on_delete=models.CASCADE,) + about_me = 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) + prerequisite = models.CharField(max_length=750) + duration = models.CharField(max_length = 100) + attachment = models.FileField(upload_to=get_document_dir) + date_created = models.DateTimeField(auto_now_add=True) + date_modified = models.DateTimeField(auto_now=True) + status = models.CharField(max_length = 100, default='Pending', editable=True) + proposal_type = models.CharField(max_length = 100) + tags = models.CharField(max_length = 250) + +class Ratings(models.Model): + proposal = models.ForeignKey(Proposal,on_delete=models.CASCADE,) + user = models.ForeignKey(User,on_delete=models.CASCADE,) + rating = models.CharField(max_length=700) + +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) |