Added model field reference in the README.txt file and implemented...

Added model field reference in the README.txt file and implemented widget_calendar models.py and admin.py
parent 982dcf9a
...@@ -22,7 +22,7 @@ The project was truthfully completed by the five of us in the appropriate specif ...@@ -22,7 +22,7 @@ The project was truthfully completed by the five of us in the appropriate specif
References: References:
--------- https://docs.djangoproject.com/en/4.1/ref/models/fields/#choices
(sgd) Matthew Karl David P. Arpas - 3/4/2023 (sgd) Matthew Karl David P. Arpas - 3/4/2023
(sgd) Cruz, Calvin Josh, G. - 3/4/2023 (sgd) Cruz, Calvin Josh, G. - 3/4/2023
......
from django.contrib import admin from django.contrib import admin
from .models import Location, Event
# Register your models here. class EventAdmin(admin.ModelAdmin):
model = Event
class LocationAdmin(admin.ModelAdmin):
model = Location
admin.site.register(Event, EventAdmin)
admin.site.register(Location, LocationAdmin)
\ No newline at end of file
from django.db import models from django.db import models
# Create your models here. class Location(models.Model):
modechoices = [
('onsite', 'onsite'),
('online', 'online'),
('hybrid', 'hybrid')
]
mode = models.CharField(
choices=modechoices,
default='onsite'
)
venue = models.TextField()
def __str__(self):
return '{} \n {}'.format(self.venue, self.mode)
class Event(models.Model):
target_datetime = models.DateTimeField()
activity = models.TextField(max_length=300)
estimated_hours = models.FloatField()
location = models.ForeignKey(Location, on_delete=models.CASCADE)
course = models.CharField(max_length=150)
def __str__(self):
return self.activity
\ 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