added venv to .gitignore and initiated the app

This commit is contained in:
arvinbehbahani562@gmail.com
2026-05-13 00:41:18 +03:30
parent 78d0c52b11
commit cf99039c8d
10 changed files with 57 additions and 3 deletions
View File
+3
View File
@@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.
+6
View File
@@ -0,0 +1,6 @@
from django.apps import AppConfig
class AddressesConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'addresses'
View File
+38
View File
@@ -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]}..."
+3
View File
@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.
+3
View File
@@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.