diff options
author | Alwin1847207 | 2019-11-04 17:44:16 +0530 |
---|---|---|
committer | Alwin1847207 | 2019-11-04 17:44:16 +0530 |
commit | 46675275ffd31f22043052cd5c0a50ab0abe2cab (patch) | |
tree | 6f9e7fed9291653c4bfb0643833d45702dfe066c /fossee_manim/models.py | |
parent | 6c741569e8ef73fe1e8773419f241891dd69a1ad (diff) | |
parent | f79913639bc283c945a392d641e84b0a70a97eda (diff) | |
download | FOSSEE_animations-46675275ffd31f22043052cd5c0a50ab0abe2cab.tar.gz FOSSEE_animations-46675275ffd31f22043052cd5c0a50ab0abe2cab.tar.bz2 FOSSEE_animations-46675275ffd31f22043052cd5c0a50ab0abe2cab.zip |
changes in deleting proposal
Diffstat (limited to 'fossee_manim/models.py')
-rw-r--r-- | fossee_manim/models.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/fossee_manim/models.py b/fossee_manim/models.py index 3470115..25a7652 100644 --- a/fossee_manim/models.py +++ b/fossee_manim/models.py @@ -116,6 +116,13 @@ def validate_file_extension(value): if not ext.lower() in valid_extensions: raise ValidationError(u'Unsupported file extension.') +def validate_img_extension(value): + import os + from django.core.exceptions import ValidationError + ext = os.path.splitext(value.name)[1] # [0] returns path+filename + valid_extensions = ['.jpg','.jpeg','.png'] + if not ext.lower() in valid_extensions: + raise ValidationError(u'Unsupported file extension.') class Profile(models.Model): """Profile for users(instructors and coordinators)""" @@ -182,19 +189,27 @@ class Animation(models.Model): on_delete=models.CASCADE, related_name="%(app_label)s_%(class)s_related") outline = models.TextField() - # concepts = models.TextField() - # audience=models.TextField() status = models.CharField(max_length=255, choices=status) category = models.ForeignKey(Category, on_delete=models.CASCADE) subcategory = models.CharField(max_length=255, blank=True) created = models.DateTimeField(default=timezone.now) tags = TaggableManager() history = HistoricalRecords() + # modifications + concepts=models.TextField(null=True,blank=True) + audience=models.TextField(null=True,blank=True) + reference=models.TextField(null=True,blank=True) + tools=models.TextField(null=True,blank=True) + detaled_description=models.TextField(null=True,blank=True) + link=models.CharField(max_length=255, blank=True) + sketch=models.ImageField(null=True, blank=True, upload_to=attachments, validators=[validate_img_extension]) def __str__(self): return u"{0} | {1}".format(self.title, self.status) + + class Comment(models.Model): comment = models.TextField() commentor = models.ForeignKey(User, on_delete=models.CASCADE) |