Browse Source
Add BookSubjectArea and BookType models, enhance HadisStatus and BookReference with new fields
Add BookSubjectArea and BookType models, enhance HadisStatus and BookReference with new fields
- Introduced BookSubjectArea and BookType models with JSONField for titles. - Added 'description' field to HadisStatus model. - Updated BookReference model to include ManyToMany relationship with BookSubjectArea and a ForeignKey to BookType. - Enhanced admin interfaces for HadisStatus, BookReference, and BookAuthor to accommodate new fields and improve usability.master
5 changed files with 227 additions and 21 deletions
-
7apps/hadis/admin/hadis.py
-
103apps/hadis/admin/reference.py
-
85apps/hadis/migrations/0003_booksubjectarea_booktype_hadisstatus_description_and_more.py
-
1apps/hadis/models/hadis.py
-
52apps/hadis/models/reference.py
@ -0,0 +1,85 @@ |
|||||
|
# Generated by Django 4.2.27 on 2026-01-22 11:07 |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
import django.db.models.deletion |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
dependencies = [ |
||||
|
("hadis", "0002_bookauthor_birth_year_hijri_and_more"), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.CreateModel( |
||||
|
name="BookSubjectArea", |
||||
|
fields=[ |
||||
|
( |
||||
|
"id", |
||||
|
models.BigAutoField( |
||||
|
auto_created=True, |
||||
|
primary_key=True, |
||||
|
serialize=False, |
||||
|
verbose_name="ID", |
||||
|
), |
||||
|
), |
||||
|
("title", models.JSONField(default=list, verbose_name="Title")), |
||||
|
( |
||||
|
"created_at", |
||||
|
models.DateTimeField(auto_now_add=True, verbose_name="created at"), |
||||
|
), |
||||
|
( |
||||
|
"updated_at", |
||||
|
models.DateTimeField(auto_now=True, verbose_name="updated at"), |
||||
|
), |
||||
|
], |
||||
|
), |
||||
|
migrations.CreateModel( |
||||
|
name="BookType", |
||||
|
fields=[ |
||||
|
( |
||||
|
"id", |
||||
|
models.BigAutoField( |
||||
|
auto_created=True, |
||||
|
primary_key=True, |
||||
|
serialize=False, |
||||
|
verbose_name="ID", |
||||
|
), |
||||
|
), |
||||
|
("title", models.JSONField(default=list, verbose_name="Title")), |
||||
|
( |
||||
|
"created_at", |
||||
|
models.DateTimeField(auto_now_add=True, verbose_name="created at"), |
||||
|
), |
||||
|
( |
||||
|
"updated_at", |
||||
|
models.DateTimeField(auto_now=True, verbose_name="updated at"), |
||||
|
), |
||||
|
], |
||||
|
), |
||||
|
migrations.AddField( |
||||
|
model_name="hadisstatus", |
||||
|
name="description", |
||||
|
field=models.JSONField(default=list, verbose_name="Description"), |
||||
|
), |
||||
|
migrations.AddField( |
||||
|
model_name="bookreference", |
||||
|
name="subject_area", |
||||
|
field=models.ManyToManyField( |
||||
|
blank=True, |
||||
|
related_name="book_subjects", |
||||
|
to="hadis.booksubjectarea", |
||||
|
verbose_name="subject area", |
||||
|
), |
||||
|
), |
||||
|
migrations.AddField( |
||||
|
model_name="bookreference", |
||||
|
name="type", |
||||
|
field=models.ForeignKey( |
||||
|
blank=True, |
||||
|
null=True, |
||||
|
on_delete=django.db.models.deletion.SET_NULL, |
||||
|
to="hadis.booktype", |
||||
|
verbose_name="type", |
||||
|
), |
||||
|
), |
||||
|
] |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue