Commit 304572fc authored by Vaughn Fajardo's avatar Vaughn Fajardo

fix: resolved foreignkey dependency issue with department and user

parent 6d2b2900
from django.db import models from django.db import models
class Department(models.Model):
dept_name = models.CharField(max_length=50, null=True)
home_unit = models.CharField(max_length=50, null=True)
def __str__(self):
return self.dept_name
class WidgetUser(models.Model): class WidgetUser(models.Model):
first_name = models.CharField(max_length=50) first_name = models.CharField(max_length=50)
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.IntegerField(max_length=7, null=True) id_num = models.IntegerField(max_length=7, null=True)
email = models.EmailField(max_length=50, null=True) email = models.EmailField(max_length=50, null=True)
department = models.ForeignKey(Department, on_delete=models.CASCADE, null=True)
def __str__(self): def __str__(self):
return self.first_name return self.first_name
\ No newline at end of file
# Create your models here.
class Department(models.Model):
dept_name = models.CharField(max_length=50, null=True)
home_unit = models.CharField(max_length=50, null=True)
widgetuser = models.ForeignKey(WidgetUser, on_delete=models.CASCADE, null=True)
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