Made changes in models

parent 8123999d
from django.contrib import admin
from .models import SalesAgent, Product, Feature, Folder, PenOrganizer, Planner
from .models import SalesAgent, Product, Feature, Folder, PenOrganizer, Planner, Description
# Register your models here.
class SalesAgentAdmin(admin.ModelAdmin):
......@@ -20,6 +20,8 @@ class PenOrganizerAdmin(admin.ModelAdmin):
class PlannerAdmin(admin.ModelAdmin):
model = Planner
class DescriptionAdmin(admin.ModelAdmin):
model = Description
admin.site.register(SalesAgent, SalesAgentAdmin)
......@@ -27,4 +29,5 @@ admin.site.register(SalesAgent, SalesAgentAdmin)
admin.site.register(Feature, FeatureAdmin)
admin.site.register(Folder, FolderAdmin)
admin.site.register(PenOrganizer, PenOrganizerAdmin)
admin.site.register(Planner, PlannerAdmin)
\ No newline at end of file
admin.site.register(Planner, PlannerAdmin)
admin.site.register(Description, DescriptionAdmin)
\ No newline at end of file
# Generated by Django 3.2.12 on 2022-11-18 10:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('adminpage', '0011_feature_folder_penorganizer_planner_salesagent'),
]
operations = [
migrations.DeleteModel(
name='Planner',
),
migrations.AlterField(
model_name='folder',
name='length',
field=models.DecimalField(decimal_places=2, help_text='in inches', max_digits=10),
),
migrations.AlterField(
model_name='folder',
name='thickness',
field=models.DecimalField(decimal_places=2, help_text='in inches', max_digits=10),
),
migrations.AlterField(
model_name='folder',
name='width',
field=models.DecimalField(decimal_places=2, help_text='in inches', max_digits=10),
),
]
# Generated by Django 3.2.12 on 2022-11-18 10:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('adminpage', '0012_auto_20221118_1849'),
]
operations = [
migrations.CreateModel(
name='Planner',
fields=[
('item_id', models.AutoField(primary_key=True, serialize=False)),
('item_name', models.CharField(max_length=50)),
('personalization', models.CharField(max_length=254)),
('color', models.CharField(choices=[('RED', 'Red'), ('ORANGE', 'Orange'), ('YELLOW', 'Yellow'), ('GREEN', 'Green'), ('BLUE', 'Blue'), ('PURPLE', 'Purple'), ('PINK', 'Pink'), ('BLACK', 'Black')], max_length=20)),
('price', models.PositiveIntegerField(help_text='in pesos')),
('collection', models.CharField(default='P', editable=False, max_length=20)),
('length', models.DecimalField(decimal_places=2, help_text='in inches', max_digits=10)),
('width', models.DecimalField(decimal_places=2, help_text='in inches', max_digits=10)),
('thickness', models.DecimalField(decimal_places=2, help_text='in inches', max_digits=10)),
],
options={
'db_table': 'planner',
},
),
]
# Generated by Django 3.2.12 on 2022-11-18 11:01
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('adminpage', '0013_planner'),
]
operations = [
migrations.CreateModel(
name='Description',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('feature_item_id', models.ForeignKey(db_column='feature_id', null=True, on_delete=django.db.models.deletion.CASCADE, to='adminpage.feature')),
('folder_id', models.ForeignKey(db_column='folder_id', null=True, on_delete=django.db.models.deletion.CASCADE, to='adminpage.folder')),
('pen_organizer_id', models.ForeignKey(db_column='pen_organizer_id', null=True, on_delete=django.db.models.deletion.CASCADE, to='adminpage.penorganizer')),
('planner_id', models.ForeignKey(db_column='planner_id', null=True, on_delete=django.db.models.deletion.CASCADE, to='adminpage.planner')),
],
),
]
# Generated by Django 3.2.12 on 2022-11-18 11:04
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('adminpage', '0014_description'),
]
operations = [
migrations.AlterModelTable(
name='description',
table='desciption',
),
]
......@@ -38,9 +38,9 @@ class Feature(models.Model):
class Folder(Product):
# item_id = models.AutoField(primary_key=True) #folder_id instead of f_item_id
collection = models.CharField(max_length=20, default="F", editable=False)
length = models.PositiveIntegerField(help_text='in inches')
width = models.PositiveIntegerField(help_text='in inches')
thickness = models.PositiveIntegerField(help_text='in inches')
length = models.DecimalField(max_digits=10, decimal_places=2, help_text='in inches')
width = models.DecimalField(max_digits=10, decimal_places=2, help_text='in inches')
thickness = models.DecimalField(max_digits=10, decimal_places=2, help_text='in inches')
class Meta:
db_table = "folder"
......@@ -54,15 +54,25 @@ class PenOrganizer(Product):
db_table = "pen_organizer"
class Planner(Product):
item_id = models.AutoField(primary_key=True) #planner_id instead of p_item_id
# item_id = models.AutoField(primary_key=True) #planner_id instead of p_item_id
collection = models.CharField(max_length=20, default="P", editable=False)
length = models.PositiveIntegerField(help_text='in inches')
width = models.PositiveIntegerField(help_text='in inches')
thickness = models.PositiveIntegerField(help_text='in inches')
length = models.DecimalField(max_digits=10, decimal_places=2, help_text='in inches')
width = models.DecimalField(max_digits=10, decimal_places=2, help_text='in inches')
thickness = models.DecimalField(max_digits=10, decimal_places=2, help_text='in inches')
class Meta:
db_table = "planner"
class Description(models.Model):
feature_item_id = models.ForeignKey(Feature, on_delete=models.CASCADE, db_column='feature_id', null=True)
folder_id = models.ForeignKey(Folder, on_delete=models.CASCADE, db_column='folder_id', null=True)
pen_organizer_id = models.ForeignKey(PenOrganizer, on_delete=models.CASCADE, db_column='pen_organizer_id', null=True)
planner_id = models.ForeignKey(Planner, on_delete=models.CASCADE, db_column='planner_id', null=True)
class Meta:
db_table = "desciption"
# Sales_Agent(Agent_ID, First_Name, Last_Name)
# Product(itemID, itemName, personalization, color, price, collection)
......
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