Commit 0584e2cb authored by Jan Ericsson Ong Ang's avatar Jan Ericsson Ong Ang

added models for event and location

parent 0885639b
from django.db import models
# Create your models here.
location_choices = (
('onsite', 'ONSITE')
('online', 'ONLINE')
('hybrid', 'HYBRID')
)
class Location(models.Model):
mode = models.CharField(max_length=50, choices = location_choices, default = 'onsite')
venue = models.CharField(max_length=50)
def __str__(self):
mode_venue=(
'Mode: '+self.mode<br>'Venue: '+self.venue
)
return mode_venue
class Event(models.Model):
target_datetime = models.DateTimeField(max_length=50)
activity = models.CharField(max_length=50)
estimated_hours = models.FloatField(max_length=50)
location = models.ForeignKey(Location, on_delete=models.CASCADE())
course = models.CharField(max_length=69, default="")
def __str__(self):
event_details=(
'Date and Time: '+self.target_datetime<br>
'Activity: '+self.activity<br>
'Estimated Hours: '+self.estimated_hours<br>
'Course: '+self.course<br>
self.location
)
return event_details
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment