added venv to .gitignore and initiated the app
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class AddressesConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'addresses'
|
||||
@@ -0,0 +1,38 @@
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Province(models.Model):
|
||||
province_id = models.IntegerField(primary_key=True)
|
||||
province_name = models.CharField(max_length=255)
|
||||
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
def __str__(self) -> str:
|
||||
return f"{self.province_name}"
|
||||
|
||||
class City(models.Model):
|
||||
province = models.ForeignKey("Province", on_delete=models.CASCADE, related_name="city")
|
||||
city_id = models.IntegerField(primary_key=True)
|
||||
city_name = models.CharField(max_length=255)
|
||||
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
def __str__(self) -> str:
|
||||
return f"{self.city_name}"
|
||||
|
||||
|
||||
|
||||
|
||||
class Address(models.Model):
|
||||
province = models.ForeignKey("Province", on_delete=models.CASCADE, related_name="province")
|
||||
city = models.ForeignKey("City", on_delete=models.CASCADE, related_name="city")
|
||||
address_detail = models.TextField()
|
||||
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
def __str__(self) -> str:
|
||||
return f"{self.address_detail[:10]}..."
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
@@ -0,0 +1,3 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
Reference in New Issue
Block a user