first push
This commit is contained in:
Executable
Executable
+8
@@ -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']
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class SupportConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'support'
|
||||
@@ -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',
|
||||
},
|
||||
),
|
||||
]
|
||||
Executable
Executable
+11
@@ -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"
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
@@ -0,0 +1,8 @@
|
||||
from django.urls import path
|
||||
from . import views
|
||||
|
||||
app_name = 'support'
|
||||
|
||||
urlpatterns = [
|
||||
path('faqs', views.support_faq, name='support_faq'),
|
||||
]
|
||||
Executable
+23
@@ -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)
|
||||
Reference in New Issue
Block a user