Commit becf25c5 authored by Anya Habana's avatar Anya Habana

Added WidgetUser association with Department model

parent 48e3ecef
from django.db import models from django.db import models
# Create your models here. # Create your models here.
class Department(models.Model):
dept_name = models.CharField(max_length=100)
home_unit = models.CharField(max_length=100)
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=50) middle_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50)
id_num = models.CharField(max_length=7) id_num = models.CharField(max_length=7)
email = models.EmailField() email = models.EmailField()
department = models.ForeignKey(Department, on_delete=models.CASCADE, related_name="users")
class Department(models.Model):
dept_name = models.CharField(max_length=100)
home_unit = models.CharField(max_length=100)
\ No newline at end of file
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