로지텍 모델링을 한 것을 바탕으로 만들어진 앱에 models.py를 작성하는 작업을 했습니다.
프로젝트의 앱은 user, product, orderd 세가지 앱으로 구성을 하였으며 각각의 models.py
를 작성했습니다.
user.models.py from django.db import models class Account(models.Model): name = models.CharField(max_length=50) language = models.CharField(max_length=50) country = models.CharField(max_length=50) birthday = models.IntegerField(max_length=20) phone = models.IntegerField(max_length=30) create_at = models.DateTimeField(auto_now_add=True) update_at = models.DateTimeField(auto_now_add=True) my_order_id = models.IntegerField(max_length = 50) privacy_data = models.CharField(max_length=50) class Meta: db_table = 'account' product.models.py ```python from django.db import models class Product(models.Model): name = models.CharField(max_length = 60) description = models.CharField(max_length =200) price = models.IntegerField(max_length =10) shiping_terms =models.CharField(max_length =100) key_features = models.CharField(max_length =300) color_model = models.CharField(max_length =50) recommended_products = models.CharField(max_length =100) support = models.CharField(max_length = 100) img_link = models.CharField(max_length = 100) thumnail = models.CharField(max_length = 100) additonal_feature = models.CharField(max_length =200) class Meta: db_table = 'products' class Shipping(models.Model): shiping_terms = models.ForeignKey(Product, on_delete = models.CASCADE) class Meta: db_table = 'shipping' class Solution(models.Model): solution_id = models.ManyToManyField(Product) product_title = models.ManyToManyField(Product)
order.models.py
from django.db import models class Order(models.Model): product_title = models.IntegerField(max_length = 50) total_price = models.IntegerField(max_length = 20) time = models.DateTimeField(auto_now_add=True) select_count = models.IntegerField(max_length = 100) promotion_code = models.IntegerField(max_length=50) delete = models.CharField(max_length = 100) addressbook = models.CharField(max_length = 100) class Meta: db_table = 'orders'