Commit 82fa89e9 authored by Daniel W Bond's avatar Daniel W Bond
Browse files

beginnings of admin, starting to add user stuff

parent a71cf7b7
from django.contrib import admin
from trajectories.models import Course, CourseCollection, Program, Student, Trajectory
from django.contrib.auth.models import User
from django.forms import CheckboxSelectMultiple
# Register your models here.
admin.site.register(Course)
admin.site.register(CourseCollection)
admin.site.register(Program)
admin.site.register(Student)
admin.site.register(Trajectory)
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
class BaseModel(models.Model):
created = models.DateTimeField('Created', auto_now_add=True, editable=False)
last_modified = models.DateTimeField('Last Modified', auto_now=True)
......@@ -75,7 +77,7 @@ class Program(BaseModel):
return self.name
# should inherit from the standard Django User Model
class Student(User):
class Student(models.Model):
user = models.OneToOneField(User)
......@@ -94,6 +96,12 @@ class Student(User):
def get_absolute_url(self):
return self.name
def create_user_profile(sender, instance, created, **kwargs):
if created:
Student.objects.create(user=instance)
post_save.connect(create_user_profile, sender=User)
class Trajectory(BaseModel):
name = models.CharField(max_length = 150)
......
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