first push

This commit is contained in:
2025-05-23 14:44:12 +08:00
commit abefd1b19b
817 changed files with 580289 additions and 0 deletions
View File
+8
View File
@@ -0,0 +1,8 @@
from django.contrib import admin
from .models import Support
# Register your models here.
@admin.register(Support)
class SupportAdmin(admin.ModelAdmin):
list_display = ['id','question','answer']
+6
View File
@@ -0,0 +1,6 @@
from django.apps import AppConfig
class SupportConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'support'
+25
View File
@@ -0,0 +1,25 @@
# Generated by Django 3.2 on 2022-10-13 07:27
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Support',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('question', models.CharField(max_length=250)),
('answer', models.TextField()),
],
options={
'db_table': 'support',
},
),
]
View File
+11
View File
@@ -0,0 +1,11 @@
from django.db import models
# Create your models here.
class Support(models.Model):
question = models.CharField(max_length = 250, blank = False, null = False)
answer = models.TextField(blank = False, null = False)
class Meta:
db_table = "support"
+3
View File
@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.
+8
View File
@@ -0,0 +1,8 @@
from django.urls import path
from . import views
app_name = 'support'
urlpatterns = [
path('faqs', views.support_faq, name='support_faq'),
]
+23
View File
@@ -0,0 +1,23 @@
from django.shortcuts import render
from .models import *
from django.contrib.auth.decorators import login_required
from django.contrib.auth.decorators import user_passes_test
def check_admin(user):
return user.is_superuser
@login_required
@user_passes_test(check_admin)
def support_faq(request):
all_faq_list = Support.objects.all()
context = {
'sidebar': 'support',
'submenu': 'faq',
'all_faq_list': all_faq_list,
'title': "FAQs"
}
return render(request, 'support/frequently_ask_questions.html', context=context)