20 changed files with 1482 additions and 12 deletions
-
528apps/hadis/docs.py
-
17apps/hadis/migrations/0006_hadiscategory_slug.py
-
29apps/hadis/migrations/0007_auto_20251211_1313.py
-
29apps/hadis/migrations/0007_auto_20251211_1324.py
-
17apps/hadis/migrations/0008_alter_hadiscategory_slug.py
-
17apps/hadis/migrations/0009_alter_hadiscategory_slug.py
-
12apps/hadis/migrations/0010_merge_20251211_1555.py
-
17apps/hadis/migrations/0011_hadis_a.py
-
16apps/hadis/migrations/0012_remove_hadis_title_narrator.py
-
19apps/hadis/migrations/0013_hadis_title_narrator.py
-
13apps/hadis/models/category.py
-
1apps/hadis/models/hadis.py
-
2apps/hadis/models/reference.py
-
61apps/hadis/serializers/category.py
-
2apps/hadis/serializers/hadis.py
-
6apps/hadis/urls.py
-
117apps/hadis/views/category.py
-
17apps/hadis/views/reference.py
-
39apps/hadis/views/transmitter.py
-
535docs/categories_api_check.MD
@ -0,0 +1,17 @@ |
|||||
|
# Generated by Django 5.2.9 on 2025-12-11 13:21 |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
dependencies = [ |
||||
|
("hadis", "0005_auto_20251209_1620"), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.AddField( |
||||
|
model_name="hadiscategory", |
||||
|
name="slug", |
||||
|
field=models.SlugField(blank=True, max_length=255, null=True), |
||||
|
), |
||||
|
] |
||||
@ -0,0 +1,29 @@ |
|||||
|
# Generated by Django 5.2.9 on 2025-12-11 13:13 |
||||
|
|
||||
|
from django.db import migrations |
||||
|
from django.utils.text import slugify |
||||
|
|
||||
|
def gen_slugs(apps, schema_editor): |
||||
|
MyModel = apps.get_model('hadis', 'HadisCategory') # Replace with your app/model name |
||||
|
for row in MyModel.objects.all(): |
||||
|
# 1. Basic slugify |
||||
|
base_slug = slugify(row.title) # Assuming you slugify the 'name' field |
||||
|
slug = base_slug |
||||
|
n = 1 |
||||
|
|
||||
|
# 2. Ensure uniqueness (if two rows have the same name) |
||||
|
while MyModel.objects.filter(slug=slug).exists(): |
||||
|
slug = f"{base_slug}-{n}" |
||||
|
n += 1 |
||||
|
|
||||
|
row.slug = slug |
||||
|
row.save() |
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
dependencies = [ |
||||
|
("hadis", "0005_auto_20251209_1620"), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.RunPython(gen_slugs, reverse_code=migrations.RunPython.noop), |
||||
|
] |
||||
@ -0,0 +1,29 @@ |
|||||
|
from django.db import migrations |
||||
|
from django.utils.text import slugify |
||||
|
|
||||
|
def gen_slugs(apps, schema_editor): |
||||
|
MyModel = apps.get_model('hadis', 'HadisCategory') # Replace with your app/model name |
||||
|
for row in MyModel.objects.all(): |
||||
|
# 1. Basic slugify |
||||
|
base_slug = slugify(row.title) # Assuming you slugify the 'name' field |
||||
|
slug = base_slug |
||||
|
n = 1 |
||||
|
|
||||
|
# 2. Ensure uniqueness (if two rows have the same name) |
||||
|
while MyModel.objects.filter(slug=slug).exists(): |
||||
|
slug = f"{base_slug}-{n}" |
||||
|
n += 1 |
||||
|
|
||||
|
row.slug = slug |
||||
|
row.save() |
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('hadis', '0006_hadiscategory_slug'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
# Call the function |
||||
|
migrations.RunPython(gen_slugs, reverse_code=migrations.RunPython.noop), |
||||
|
] |
||||
@ -0,0 +1,17 @@ |
|||||
|
# Generated by Django 5.2.9 on 2025-12-11 13:32 |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
dependencies = [ |
||||
|
("hadis", "0007_auto_20251211_1324"), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.AlterField( |
||||
|
model_name="hadiscategory", |
||||
|
name="slug", |
||||
|
field=models.SlugField(blank=True, max_length=255, null=True, unique=True), |
||||
|
), |
||||
|
] |
||||
@ -0,0 +1,17 @@ |
|||||
|
# Generated by Django 5.2.9 on 2025-12-11 13:40 |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
dependencies = [ |
||||
|
("hadis", "0008_alter_hadiscategory_slug"), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.AlterField( |
||||
|
model_name="hadiscategory", |
||||
|
name="slug", |
||||
|
field=models.SlugField(blank=True, max_length=255, null=True), |
||||
|
), |
||||
|
] |
||||
@ -0,0 +1,12 @@ |
|||||
|
# Generated by Django 5.2.9 on 2025-12-11 15:55 |
||||
|
|
||||
|
from django.db import migrations |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
dependencies = [ |
||||
|
("hadis", "0007_auto_20251211_1313"), |
||||
|
("hadis", "0009_alter_hadiscategory_slug"), |
||||
|
] |
||||
|
|
||||
|
operations = [] |
||||
@ -0,0 +1,17 @@ |
|||||
|
# Generated by Django 5.2.9 on 2025-12-11 16:06 |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
dependencies = [ |
||||
|
("hadis", "0010_merge_20251211_1555"), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.AddField( |
||||
|
model_name="hadis", |
||||
|
name="a", |
||||
|
field=models.IntegerField(blank=True, null=True), |
||||
|
), |
||||
|
] |
||||
@ -0,0 +1,16 @@ |
|||||
|
# Generated by Django 5.2.9 on 2025-12-11 16:13 |
||||
|
|
||||
|
from django.db import migrations |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
dependencies = [ |
||||
|
("hadis", "0011_hadis_a"), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.RemoveField( |
||||
|
model_name="hadis", |
||||
|
name="title_narrator", |
||||
|
), |
||||
|
] |
||||
@ -0,0 +1,19 @@ |
|||||
|
# Generated by Django 5.2.9 on 2025-12-11 16:14 |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
dependencies = [ |
||||
|
("hadis", "0012_remove_hadis_title_narrator"), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.AddField( |
||||
|
model_name="hadis", |
||||
|
name="title_narrator", |
||||
|
field=models.CharField( |
||||
|
blank=True, max_length=255, null=True, verbose_name="title narrator" |
||||
|
), |
||||
|
), |
||||
|
] |
||||
@ -0,0 +1,535 @@ |
|||||
|
# 📋 Categories API Response Examples |
||||
|
|
||||
|
## 1. GET `/api/hadis/categories/` |
||||
|
**Description**: Returns all categories with pagination (limited to 16 items per page). |
||||
|
|
||||
|
**Response Structure:** |
||||
|
```json |
||||
|
{ |
||||
|
"count": 56, |
||||
|
"next": "http://127.0.0.1:8000/api/hadis/categories/?limit=16&offset=16", |
||||
|
"previous": null, |
||||
|
"results": [ |
||||
|
{ |
||||
|
"id": 324, |
||||
|
"title": "Толкование Корана", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 1, |
||||
|
"slug": null, |
||||
|
"xmind_file": null, |
||||
|
"children_count": 3 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 330, |
||||
|
"title": "Толкование суры Аль-Фатиха", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 1, |
||||
|
"slug": null, |
||||
|
"xmind_file": null, |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 331, |
||||
|
"title": "Толкование суры Аль-Бакара", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 2, |
||||
|
"slug": null, |
||||
|
"xmind_file": null, |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 332, |
||||
|
"title": "Толкование суры Аль Имран", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 3, |
||||
|
"slug": null, |
||||
|
"xmind_file": null, |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 325, |
||||
|
"title": "Аяты постановлений", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 2, |
||||
|
"slug": null, |
||||
|
"xmind_file": "http://127.0.0.1:8000/media/hadis/xmind_files/category_325_%D0%90%D1%8F%D1%82%D1%8B_%D0%BF%D0%BE%D1%81%D1%82%D0%B0%D0%BD%D0%BE%D0%B2%D0%BB%D0%B5%D0%BD%D0%B8%D0%B9.xmind", |
||||
|
"children_count": 3 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 333, |
||||
|
"title": "Аяты о молитве", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 1, |
||||
|
"slug": null, |
||||
|
"xmind_file": null, |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 334, |
||||
|
"title": "Аяты о посте", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 2, |
||||
|
"slug": null, |
||||
|
"xmind_file": null, |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 335, |
||||
|
"title": "Аяты о закяте", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 3, |
||||
|
"slug": null, |
||||
|
"xmind_file": null, |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 326, |
||||
|
"title": "Коранические истории", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 3, |
||||
|
"slug": null, |
||||
|
"xmind_file": "http://127.0.0.1:8000/media/hadis/xmind_files/category_326_%D0%9A%D0%BE%D1%80%D0%B0%D0%BD%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B5_%D0%B8%D1%81%D1%82%D0%BE%D1%80%D0%B8%D0%B8.xmind", |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 336, |
||||
|
"title": "Истории пророков", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 1, |
||||
|
"slug": null, |
||||
|
"xmind_file": null, |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 337, |
||||
|
"title": "Истории праведников", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 2, |
||||
|
"slug": null, |
||||
|
"xmind_file": null, |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 327, |
||||
|
"title": "Достоинства сур", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 4, |
||||
|
"slug": null, |
||||
|
"xmind_file": "http://127.0.0.1:8000/media/hadis/xmind_files/category_327_%D0%94%D0%BE%D1%81%D1%82%D0%BE%D0%B8%D0%BD%D1%81%D1%82%D0%B2%D0%B0_%D1%81%D1%83%D1%80.xmind", |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 328, |
||||
|
"title": "Чудеса Корана", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 5, |
||||
|
"slug": null, |
||||
|
"xmind_file": "http://127.0.0.1:8000/media/hadis/xmind_files/category_328_%D0%A7%D1%83%D0%B4%D0%B5%D1%81%D0%B0_%D0%9A%D0%BE%D1%80%D0%B0%D0%BD%D0%B0.xmind", |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 329, |
||||
|
"title": "Коранические науки", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 6, |
||||
|
"slug": null, |
||||
|
"xmind_file": null, |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 338, |
||||
|
"title": "Книга очищения", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "hadith", |
||||
|
"description": null, |
||||
|
"order": 1, |
||||
|
"slug": null, |
||||
|
"xmind_file": "http://127.0.0.1:8000/media/hadis/xmind_files/category_338_%D0%9A%D0%BD%D0%B8%D0%B3%D0%B0_%D0%BE%D1%87%D0%B8%D1%89%D0%B5%D0%BD%D0%B8%D1%8F.xmind", |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 344, |
||||
|
"title": "Омовение", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "hadith", |
||||
|
"description": null, |
||||
|
"order": 1, |
||||
|
"slug": null, |
||||
|
"xmind_file": null, |
||||
|
"children_count": 0 |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
|
||||
|
## 2. GET `/api/hadis/categories/{sect_type}/` |
||||
|
**Description**: Returns categories filtered by sect type (shia or sunni). |
||||
|
|
||||
|
**Parameters:** |
||||
|
- `sect_type`: Islamic sect type (`shia` or `sunni`) |
||||
|
|
||||
|
**Example URL:** `GET /api/hadis/categories/shia/` |
||||
|
|
||||
|
**Response Structure:** |
||||
|
```json |
||||
|
{ |
||||
|
"count": 28, |
||||
|
"next": "http://127.0.0.1:8000/api/hadis/categories/shia/?limit=16&offset=16", |
||||
|
"previous": null, |
||||
|
"results": [ |
||||
|
{ |
||||
|
"id": 324, |
||||
|
"title": "Толкование Корана", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 1, |
||||
|
"slug": null, |
||||
|
"xmind_file": null, |
||||
|
"children_count": 3 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 330, |
||||
|
"title": "Толкование суры Аль-Фатиха", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 1, |
||||
|
"slug": null, |
||||
|
"xmind_file": null, |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 331, |
||||
|
"title": "Толкование суры Аль-Бакара", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 2, |
||||
|
"slug": null, |
||||
|
"xmind_file": null, |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 332, |
||||
|
"title": "Толкование суры Аль Имран", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 3, |
||||
|
"slug": null, |
||||
|
"xmind_file": null, |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 325, |
||||
|
"title": "Аяты постановлений", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 2, |
||||
|
"slug": null, |
||||
|
"xmind_file": "http://127.0.0.1:8000/media/hadis/xmind_files/category_325_%D0%90%D1%8F%D1%82%D1%8B_%D0%BF%D0%BE%D1%81%D1%82%D0%B0%D0%BD%D0%BE%D0%B2%D0%BB%D0%B5%D0%BD%D0%B8%D0%B9.xmind", |
||||
|
"children_count": 3 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 333, |
||||
|
"title": "Аяты о молитве", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 1, |
||||
|
"slug": null, |
||||
|
"xmind_file": null, |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 334, |
||||
|
"title": "Аяты о посте", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 2, |
||||
|
"slug": null, |
||||
|
"xmind_file": null, |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 335, |
||||
|
"title": "Аяты о закяте", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 3, |
||||
|
"slug": null, |
||||
|
"xmind_file": null, |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 326, |
||||
|
"title": "Коранические истории", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 3, |
||||
|
"slug": null, |
||||
|
"xmind_file": "http://127.0.0.1:8000/media/hadis/xmind_files/category_326_%D0%9A%D0%BE%D1%80%D0%B0%D0%BD%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B5_%D0%B8%D1%81%D1%82%D0%BE%D1%80%D0%B8%D0%B8.xmind", |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 336, |
||||
|
"title": "Истории пророков", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 1, |
||||
|
"slug": null, |
||||
|
"xmind_file": null, |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 337, |
||||
|
"title": "Истории праведников", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 2, |
||||
|
"slug": null, |
||||
|
"xmind_file": null, |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 327, |
||||
|
"title": "Достоинства сур", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 4, |
||||
|
"slug": null, |
||||
|
"xmind_file": "http://127.0.0.1:8000/media/hadis/xmind_files/category_327_%D0%94%D0%BE%D1%81%D1%82%D0%BE%D0%B8%D0%BD%D1%81%D1%82%D0%B2%D0%B0_%D1%81%D1%83%D1%80.xmind", |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 328, |
||||
|
"title": "Чудеса Корана", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 5, |
||||
|
"slug": null, |
||||
|
"xmind_file": "http://127.0.0.1:8000/media/hadis/xmind_files/category_328_%D0%A7%D1%83%D0%B4%D0%B5%D1%81%D0%B0_%D0%9A%D0%BE%D1%80%D0%B0%D0%BD%D0%B0.xmind", |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 329, |
||||
|
"title": "Коранические науки", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "quran", |
||||
|
"description": null, |
||||
|
"order": 6, |
||||
|
"slug": null, |
||||
|
"xmind_file": null, |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 338, |
||||
|
"title": "Книга очищения", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "hadith", |
||||
|
"description": null, |
||||
|
"order": 1, |
||||
|
"slug": null, |
||||
|
"xmind_file": "http://127.0.0.1:8000/media/hadis/xmind_files/category_338_%D0%9A%D0%BD%D0%B8%D0%B3%D0%B0_%D0%BE%D1%87%D0%B8%D1%89%D0%B5%D0%BD%D0%B8%D1%8F.xmind", |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 344, |
||||
|
"title": "Омовение", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"source_type": "hadith", |
||||
|
"description": null, |
||||
|
"order": 1, |
||||
|
"slug": null, |
||||
|
"xmind_file": null, |
||||
|
"children_count": 0 |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
|
||||
|
## 3. GET `/api/hadis/categories/{sect_type}/{slug}/` |
||||
|
**Description**: Returns child categories of a specific category (by slug) within the sect type. |
||||
|
|
||||
|
**Parameters:** |
||||
|
- `sect_type`: Islamic sect type (`shia` or `sunni`) |
||||
|
- `slug`: URL slug of the parent category |
||||
|
|
||||
|
**Example URL:** `GET /api/hadis/categories/shia/some-category-slug/` |
||||
|
|
||||
|
**Response Structure:** |
||||
|
```json |
||||
|
{ |
||||
|
"count": 3, |
||||
|
"next": null, |
||||
|
"previous": null, |
||||
|
"results": [ |
||||
|
{ |
||||
|
"id": 330, |
||||
|
"title": "Толкование суры Аль-Фатиха", |
||||
|
"source_type": "quran", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 331, |
||||
|
"title": "Толкование суры Аль-Бакара", |
||||
|
"source_type": "quran", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"children_count": 0 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 332, |
||||
|
"title": "Толкование суры Аль Имран", |
||||
|
"source_type": "quran", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"children_count": 0 |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 4. GET `/api/hadis/categories/{sect_type}/{slug}/{source_type}/` |
||||
|
**Description**: Returns child categories of a specific category (by slug) within the sect type, filtered by source type. |
||||
|
|
||||
|
**Parameters:** |
||||
|
- `sect_type`: Islamic sect type (`shia` or `sunni`) |
||||
|
- `slug`: URL slug of the parent category |
||||
|
- `source_type`: Source material type (`quran`, `hadith`, `history`, `fatwa`, `quote`) |
||||
|
|
||||
|
**Example URL:** `GET /api/hadis/categories/shia/some-category-slug/quran/` |
||||
|
|
||||
|
**Response Structure:** |
||||
|
```json |
||||
|
{ |
||||
|
"count": 3, |
||||
|
"next": null, |
||||
|
"previous": null, |
||||
|
"results": [ |
||||
|
{ |
||||
|
"id": 330, |
||||
|
"title": "Толкование суры Аль-Фатиха", |
||||
|
"source_type": "quran", |
||||
|
"slug": "-1", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"children_count": 0, |
||||
|
"has_hadis": false |
||||
|
}, |
||||
|
{ |
||||
|
"id": 331, |
||||
|
"title": "Толкование суры Аль-Бакара", |
||||
|
"source_type": "quran", |
||||
|
"slug": "-19", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"children_count": 0, |
||||
|
"has_hadis": false |
||||
|
}, |
||||
|
{ |
||||
|
"id": 332, |
||||
|
"title": "Толкование суры Аль Имран", |
||||
|
"source_type": "quran", |
||||
|
"slug": "-33", |
||||
|
"sect_id": 20, |
||||
|
"sect_type": "shia", |
||||
|
"children_count": 0, |
||||
|
"has_hadis": false |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
|
||||
|
|
||||
|
``` |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
|
||||
|
|
||||
|
## 🔍 Field Descriptions |
||||
|
|
||||
|
- **`id`**: Unique identifier for the category |
||||
|
- **`title`**: Category name in Russian |
||||
|
- **`sect_id`**: ID of the Islamic sect |
||||
|
- **`sect_type`**: Type of Islamic sect (`shia` or `sunni`) |
||||
|
- **`source_type`**: Type of source material (`quran`, `hadith`, `history`, `fatwa`, `quote`) |
||||
|
- **`description`**: Optional description of the category |
||||
|
- **`order`**: Display order within the hierarchy |
||||
|
- **`slug`**: URL-friendly identifier (auto-generated from title, unique) |
||||
|
- **`xmind_file`**: URL to associated XMind mind map file (optional) |
||||
|
- **`children_count`**: Number of active child categories |
||||
|
- **`has_hadis`**: Boolean indicating if category contains hadith content (tree endpoints only) |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue