summaryrefslogtreecommitdiff
path: root/workshop_app/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'workshop_app/models.py')
-rw-r--r--workshop_app/models.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/workshop_app/models.py b/workshop_app/models.py
index 9745fd3..35a1f38 100644
--- a/workshop_app/models.py
+++ b/workshop_app/models.py
@@ -3,6 +3,7 @@ from django.db import models
from django.contrib.auth.models import User
from django.core.validators import RegexValidator
from recurrence.fields import RecurrenceField
+import os
position_choices = (
("coordinator", "Coordinator"),
@@ -27,6 +28,9 @@ def has_profile(user):
""" check if user has profile """
return True if hasattr(user, 'profile') else False
+def attachments(instance, filename):
+ return os.sep.join((instance.workshoptype_name.replace(" ", '_'), filename))
+
class Profile(models.Model):
"""Profile for users(instructors and coordinators)"""
@@ -70,6 +74,11 @@ class WorkshopType(models.Model):
workshoptype_duration = models.CharField(max_length=32,
help_text='Please write this in \
following format eg: 3days, 8hours a day')
+ workshoptype_attachments = models.FileField(upload_to=attachments, blank=True,
+ help_text='Please upload workshop documents one by one, \
+ ie.workshop schedule, instructions etc. \
+ Please Note: Name of Schedule file should be similar to \
+ WorkshopType Name')
def __str__(self):
return u"{0} {1}".format(self.workshoptype_name,