summaryrefslogtreecommitdiff
path: root/arduino_blog/models.py
diff options
context:
space:
mode:
authorSashi202020-03-06 15:06:15 +0530
committerGitHub2020-03-06 15:06:15 +0530
commit23fb293483c7ca5e4c2e7d83b70e4b638aa5fa90 (patch)
tree94d3cf22c8c872b960f7bd252d9837f97db5fe52 /arduino_blog/models.py
parentf3b005d44de92e6872a0f9824f5d20cc9e636f34 (diff)
parent903b73b033c9b80db36da755e05185d4f266101c (diff)
downloadarduino_projects_website-23fb293483c7ca5e4c2e7d83b70e4b638aa5fa90.tar.gz
arduino_projects_website-23fb293483c7ca5e4c2e7d83b70e4b638aa5fa90.tar.bz2
arduino_projects_website-23fb293483c7ca5e4c2e7d83b70e4b638aa5fa90.zip
Merge pull request #11 from Sashi20/master
Add view abstracts, comment abstract
Diffstat (limited to 'arduino_blog/models.py')
-rw-r--r--arduino_blog/models.py23
1 files changed, 20 insertions, 3 deletions
diff --git a/arduino_blog/models.py b/arduino_blog/models.py
index 84c6bd0..97e60de 100644
--- a/arduino_blog/models.py
+++ b/arduino_blog/models.py
@@ -5,6 +5,9 @@ from django.core.validators import RegexValidator
import os
from datetime import datetime
from arduino_projects_website import settings
+from django.contrib.contenttypes.fields import GenericForeignKey
+from django.contrib.contenttypes.models import ContentType
+from django.contrib.contenttypes.fields import GenericRelation
position_choices = (
("student", "Student"),
@@ -83,9 +86,9 @@ class BaseClass(models.Model):
class Profile(BaseClass):
"""Profile for users"""
user = models.OneToOneField(User, on_delete=models.CASCADE)
- title = models.CharField(max_length=32, blank=True, choices=title)
+ #title = models.CharField(max_length=32, blank=True, choices=title)
institute = models.CharField(max_length=150)
- phone = models.CharField(max_length=10)
+ #phone = models.CharField(max_length=10)
position = models.CharField(max_length=32, choices=position_choices)
how_did_you_hear_about_us = models.CharField(
max_length=255, blank=True, choices=source)
@@ -110,6 +113,15 @@ def get_document_dir(instance, filename):
# print "----------------->",instance.user
return '%s/attachment/%s/%s.%s' % (instance.user, instance.proposal_type, fname+'_'+str(instance.user), fext)
+
+class Comment(BaseClass):
+ user = models.ForeignKey(User, on_delete=models.CASCADE,)
+ body = models.CharField(max_length=500)
+ is_public = models.BooleanField(default = False)
+ content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
+ object_id = models.PositiveIntegerField()
+ content_object = GenericForeignKey()
+
class Proposal(BaseClass):
user = models.ForeignKey(User, on_delete=models.CASCADE,)
name_of_author = models.CharField(max_length=200, default='None')
@@ -117,10 +129,15 @@ class Proposal(BaseClass):
email = models.CharField(max_length=128)
title_of_the_project = models.CharField(max_length=250)
abstract = models.TextField(max_length=700)
+ references = models.CharField(max_length = 200, default = 'None')
#attachment = models.FileField(upload_to=get_document_dir)
status = models.CharField(max_length=100, default='Pending', editable=True)
completion_date = models.DateTimeField(null=True, blank=True)
approval_date = models.DateTimeField(null=True, blank=True)
proposal_status = models.IntegerField(default=0, editable=True)
#tags = models.CharField(max_length=250)
- terms_and_conditions = models.BooleanField(default= 'True')
+ terms_and_conditions = models.BooleanField(default= True)
+ comment = GenericRelation(Comment)
+
+
+