mirror of
https://github.com/Alexander-D-Karpov/akarpov
synced 2024-11-22 13:16:33 +03:00
added faq
This commit is contained in:
parent
ffb327a8d9
commit
2361b628bb
|
@ -1,6 +1,7 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from akarpov.about.models import Project, ProjectChange
|
from akarpov.about.models import FAQ, Project, ProjectChange
|
||||||
|
|
||||||
|
admin.site.register(FAQ)
|
||||||
admin.site.register(Project)
|
admin.site.register(Project)
|
||||||
admin.site.register(ProjectChange)
|
admin.site.register(ProjectChange)
|
||||||
|
|
34
akarpov/about/migrations/0003_faq.py
Normal file
34
akarpov/about/migrations/0003_faq.py
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
# Generated by Django 4.2.3 on 2023-08-01 00:36
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("about", "0002_projectchange"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="FAQ",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"id",
|
||||||
|
models.BigAutoField(
|
||||||
|
auto_created=True,
|
||||||
|
primary_key=True,
|
||||||
|
serialize=False,
|
||||||
|
verbose_name="ID",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("ordering", models.IntegerField(default=0)),
|
||||||
|
("question", models.CharField(max_length=250)),
|
||||||
|
("link", models.URLField(blank=True, null=True)),
|
||||||
|
("answer", models.TextField()),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"ordering": ["-ordering"],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
|
@ -33,3 +33,16 @@ def __str__(self):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ("-created",)
|
ordering = ("-created",)
|
||||||
|
|
||||||
|
|
||||||
|
class FAQ(models.Model):
|
||||||
|
ordering = models.IntegerField(default=0)
|
||||||
|
question = models.CharField(max_length=250)
|
||||||
|
link = models.URLField(null=True, blank=True)
|
||||||
|
answer = models.TextField()
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.question
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ["-ordering"]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from django.views.generic import DetailView, TemplateView
|
from django.views.generic import DetailView, ListView, TemplateView
|
||||||
|
|
||||||
from akarpov.about.models import Project
|
from akarpov.about.models import FAQ, Project
|
||||||
|
|
||||||
|
|
||||||
class AboutView(TemplateView):
|
class AboutView(TemplateView):
|
||||||
|
@ -24,3 +24,11 @@ class ProjectView(DetailView):
|
||||||
|
|
||||||
|
|
||||||
project_view = ProjectView.as_view()
|
project_view = ProjectView.as_view()
|
||||||
|
|
||||||
|
|
||||||
|
class ListFAQView(ListView):
|
||||||
|
model = FAQ
|
||||||
|
template_name = "about/faq.html"
|
||||||
|
|
||||||
|
|
||||||
|
list_faq = ListFAQView.as_view()
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
SpectacularSwaggerView,
|
SpectacularSwaggerView,
|
||||||
)
|
)
|
||||||
|
|
||||||
from akarpov.about.views import about_view
|
from akarpov.about.views import about_view, list_faq
|
||||||
from akarpov.tools.shortener.views import redirect_view
|
from akarpov.tools.shortener.views import redirect_view
|
||||||
from config.sitemaps import sitemaps
|
from config.sitemaps import sitemaps
|
||||||
|
|
||||||
|
@ -34,7 +34,8 @@
|
||||||
path(settings.ADMIN_URL, admin.site.urls),
|
path(settings.ADMIN_URL, admin.site.urls),
|
||||||
# User management
|
# User management
|
||||||
path("users/", include("akarpov.users.urls", namespace="users")),
|
path("users/", include("akarpov.users.urls", namespace="users")),
|
||||||
path("about", cache_page(600)(about_view)),
|
path("about", cache_page(600)(about_view), name="about"),
|
||||||
|
path("faq/", list_faq, name="faq"),
|
||||||
path("about/", include("akarpov.about.urls", namespace="about")),
|
path("about/", include("akarpov.about.urls", namespace="about")),
|
||||||
path("files/", include("akarpov.files.urls", namespace="files")),
|
path("files/", include("akarpov.files.urls", namespace="files")),
|
||||||
path("music/", include("akarpov.music.urls", namespace="music")),
|
path("music/", include("akarpov.music.urls", namespace="music")),
|
||||||
|
@ -51,7 +52,7 @@
|
||||||
# API URLS
|
# API URLS
|
||||||
urlpatterns += [
|
urlpatterns += [
|
||||||
# API base url
|
# API base url
|
||||||
path("api/", include("config.api_router")),
|
path("api/", include("config.api_router", namespace="api")),
|
||||||
# DRF auth token
|
# DRF auth token
|
||||||
path("api/schema/", SpectacularAPIView.as_view(), name="api-schema"),
|
path("api/schema/", SpectacularAPIView.as_view(), name="api-schema"),
|
||||||
path("api/schema/", SpectacularAPIView.as_view(), name="api-redoc-schema"),
|
path("api/schema/", SpectacularAPIView.as_view(), name="api-redoc-schema"),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user