Commit beb52321 authored by Giancarlo Angelo U. de Torres's avatar Giancarlo Angelo U. de Torres

Merge branch 'main' into detorres/assignments

parents 4fdb2997 d7c88b7b
# Group 3 - Lab 1: Widget # Group 3
### Jonathan Talbot - Homepage ### Jonathan Talbot - Homepage
...@@ -9,5 +9,8 @@ ...@@ -9,5 +9,8 @@
### Giancarlo De Torres - Assignments ### Giancarlo De Torres - Assignments
## Video link: ## Lab 1: Video link:
### https://drive.google.com/file/d/1iEkbHXomN2VUXBepXeVk2zCTFWFxRD0A/view?usp=sharing ### https://drive.google.com/file/d/1iEkbHXomN2VUXBepXeVk2zCTFWFxRD0A/view?usp=sharing
\ No newline at end of file
## Lab 2: Video link:
### https://drive.google.com/file/d/1JqTDjraUkpCbQ_alrvoAGlDRjvGIuyL4/view?usp=sharing
\ No newline at end of file
No preview for this file type
from django.contrib import admin from django.contrib import admin
from .models import Assignment from .models import WidgetUser, Forum, Announcement, Assignment
# Classes
class WidgetUserAdmin(admin.ModelAdmin):
model = WidgetUser
search_fields = ('first_name', 'middle_name', 'last_name')
list_display = ('first_name', 'middle_name', 'last_name')
list_filter = ('first_name', 'middle_name', 'last_name')
fieldsets = [
('Widget User Data', {
'fields': [
'first_name',
'middle_name',
'last_name'
]
}),
]
class AnnouncementAdmin(admin.ModelAdmin):
model = Announcement
search_fields = ('announcement_title', 'announcement_body', 'pub_date')
list_display = ('announcement_title', 'announcement_body', 'pub_date')
list_filter = ('announcement_title', 'announcement_body', 'pub_date')
fieldsets = [
('Announcement Data', {
'fields': [
'announcement_title',
'announcement_body',
]
})
]
class ForumAdmin(admin.ModelAdmin):
model = Forum
search_fields = ('post_title', 'post_body', 'pub_date')
list_display = ('post_title', 'post_body', 'pub_date')
list_filter = ('post_title', 'post_body', 'pub_date')
fieldsets = [
('Forum Data', {
'fields': [
'post_title',
'post_body',
]
}),
]
class AssignmentAdmin(admin.ModelAdmin): class AssignmentAdmin(admin.ModelAdmin):
model = Assignment model = Assignment
...@@ -26,4 +80,13 @@ class AssignmentAdmin(admin.ModelAdmin): ...@@ -26,4 +80,13 @@ class AssignmentAdmin(admin.ModelAdmin):
] ]
admin.site.register(Assignment, AssignmentAdmin)
\ No newline at end of file
# Register models
admin.site.register(WidgetUser, WidgetUserAdmin)
admin.site.register(Forum, ForumAdmin)
admin.site.register(Announcement, AnnouncementAdmin)
admin.site.register(Assignment, AssignmentAdmin)
from django.db import models from django.db import models
from django.urls import reverse from django.urls import reverse
class WidgetUser(models.Model):
first_name = models.CharField(max_length=100)
middle_name = models.CharField(max_length=100)
last_name = models.CharField(max_length=100)
def __str__(self):
return self.full_name
def get_absolute_url(self):
return reverse('widget_user', args=[(self.full_name)])
@property
def full_name(self):
return '{} {} {}'.format(self.first_name, self.middle_name, self.last_name)
class Announcement(models.Model):
announcement_title= models.CharField(max_length=50)
announcement_body = models.CharField(max_length=200)
pub_date = models.DateTimeField(auto_now_add=True, editable=False)
def __str__(self):
return self.full_announcement
def get_absolute_url(self):
return reverse('Announcement', args=[(self.full_announcement)])
@property
def full_announcement(self):
return '{} {} {}'.format(self.announcement_title, self.announcement_body, self.pub_date)
class Forum(models.Model):
post_title = models.CharField(max_length=50)
post_body = models.CharField(max_length=100)
pub_date = models.DateTimeField(auto_now_add=True, editable=False)
def __str__(self):
return self.post_title
def get_absolute_url(self):
return reverse('forum', args=[(self.post_title)])
class Assignment(models.Model): class Assignment(models.Model):
name = models.CharField(max_length = 100) name = models.CharField(max_length = 100)
description = models.CharField(max_length = 200) description = models.CharField(max_length = 200)
...@@ -10,6 +52,4 @@ class Assignment(models.Model): ...@@ -10,6 +52,4 @@ class Assignment(models.Model):
return self.name return self.name
def get_absolute_url(self): def get_absolute_url(self):
return reverse('assignment', args[(self.name)]) return reverse('assignment', args=[(self.name)])
\ 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