From 1bee4085e0ce21c270a476f878876132e2dc54d0 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Wed, 12 Sep 2018 15:20:47 -0600 Subject: [PATCH] Add tool, category, and user profile models --- authserver/authserver/api/models.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/authserver/authserver/api/models.py b/authserver/authserver/api/models.py index 71a8362..3962a2b 100644 --- a/authserver/authserver/api/models.py +++ b/authserver/authserver/api/models.py @@ -1,3 +1,20 @@ from django.db import models -# Create your models here. +class Category(models.Model): + name = models.CharField(max_length=32) + slug = models.CharField(max_length=32) + info = models.TextField(max_length=1024, blank=True) + photo = models.FileField(upload_to='media/') + +class Tool(models.Model): + uuid = models.UUIDField(default=uuid.uuid4, editable=False) + category = models.ForeignKey(Category, related_name='tools') + name = models.CharField(max_length=32) + info = models.TextField(max_length=1024, blank=True) + wiki_id = models.IntegerField() + photo = models.FileField(upload_to='media/') + +class Profile(models.Model): + user = models.OneToOneField(User) + lockout_admin = models.BooleanField(default=False) + authorized_tools = models.ManyToManyField(Tool)