Add tool, category, and user profile models

This commit is contained in:
Tanner Collin 2018-09-12 15:20:47 -06:00
parent 48431a4d84
commit 1bee4085e0

View File

@ -1,3 +1,20 @@
from django.db import models 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)