Commit b1fd71ae authored by Jonathan Talbot's avatar Jonathan Talbot

Merge branch 'flores/forum' into 'main'

Added Forum to models.py

See merge request !4
parents ab46f8c2 7d1800ca
from django.contrib import admin from django.contrib import admin
from .models import WidgetUser from .models import WidgetUser, Forum
# Classes # Classes
...@@ -21,9 +20,21 @@ class WidgetUserAdmin(admin.ModelAdmin): ...@@ -21,9 +20,21 @@ class WidgetUserAdmin(admin.ModelAdmin):
}), }),
] ]
class Assignment(models.Model):
name = models.CharField(max_length = 100)
description = models.CharField(max_length = 200)
max_points = models.IntegerField()
def __str__(self):
return self.name
def get_absolute_url(self):
return reverse('assignment', args[(self.name)])
# Register models # Register models
admin.site.register(WidgetUser, WidgetUserAdmin) admin.site.register(WidgetUser, WidgetUserAdmin)
admin.site.register(Forum, ForumAdmin)
from django.db import models from django.db import models
from django.urls import reverse from django.urls import reverse
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 WidgetUser(models.Model): class WidgetUser(models.Model):
first_name = models.CharField(max_length=100) first_name = models.CharField(max_length=100)
middle_name = models.CharField(max_length=100) middle_name = models.CharField(max_length=100)
......
...@@ -40,7 +40,7 @@ INSTALLED_APPS = [ ...@@ -40,7 +40,7 @@ INSTALLED_APPS = [
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'widget_group3' 'widget_group3',
] ]
MIDDLEWARE = [ MIDDLEWARE = [
......
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