Added the assignments model and admin

Title says
parent 855f761b
No preview for this file type
from django.contrib import admin from django.contrib import admin
from .models import Assignment
#from .models import WidgetUser, Announcement, Post, Assignment class AssignmentAdmin(admin.ModelAdmin):
\ No newline at end of file model = Assignment
search_fields = ('name', 'description', 'max_points')
list_display = ('name', 'description', 'max_points')
list_filter = ('name', 'description', 'max_points')
fieldsets = [
('Assignment Data', {
'fields': [
'name',
'description',
'max_points'
]
}
)
]
admin.site.register(Assignment, AssignmentAdmin)
\ No newline at end of file
from django.db import models from django.db import models
from django.urls import reverse from django.urls import reverse
class Assignments(models.Model): class Assignment(models.Model):
name = models.CharField(max_length = 25) name = models.CharField(max_length = 100)
description = models.Charfield(max_length = 200) description = models.CharField(max_length = 200)
max_points = models.IntegerField() max_points = models.IntegerField()
\ No newline at end of file
def __str__(self):
return self.name
def get_absolute_url(self):
return reverse('assignment', args[(self.name)])
\ No newline at end of file
...@@ -40,6 +40,7 @@ INSTALLED_APPS = [ ...@@ -40,6 +40,7 @@ INSTALLED_APPS = [
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'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