Skip to content

Commit

Permalink
learning django: permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
kherin committed Jan 21, 2024
1 parent f53836e commit 195c1b8
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
3 changes: 2 additions & 1 deletion project1/myapp/admin.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from django.contrib import admin

from myapp.models import Person, Drinks, DrinksCategory, Customer, Vehicle
from myapp.models import Person, Drinks, DrinksCategory, Customer, Vehicle, Employees

# Register your models here.
admin.site.register(Person)
admin.site.register(Drinks)
admin.site.register(DrinksCategory)
admin.site.register(Customer)
admin.site.register(Vehicle)
admin.site.register(Employees)
23 changes: 23 additions & 0 deletions project1/myapp/migrations/0005_employees.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.1.7 on 2024-01-21 14:21

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('myapp', '0004_customer_vehicle'),
]

operations = [
migrations.CreateModel(
name='Employees',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('first_name', models.CharField(max_length=200)),
('last_name', models.CharField(max_length=200)),
('role', models.CharField(max_length=100)),
('shift', models.IntegerField()),
],
),
]
10 changes: 10 additions & 0 deletions project1/myapp/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,13 @@ class Vehicle(models.Model):
name = models.CharField(max_length=255)
customer = models.ForeignKey(
Customer, on_delete=models.CASCADE, related_name='Vehicle')


class Employees(models.Model):
first_name = models.CharField(max_length=200)
last_name = models.CharField(max_length=200)
role = models.CharField(max_length=100)
shift = models.IntegerField()

def __str__(self) -> str:
return self.first_name + " " + self.last_name

0 comments on commit 195c1b8

Please sign in to comment.