diff --git a/myclub_website/TEMP/template_58888/intense-taxi/forms.html b/myclub_website/TEMP/template_58888/intense-taxi/forms.html index 024dbba..61c6c81 100644 --- a/myclub_website/TEMP/template_58888/intense-taxi/forms.html +++ b/myclub_website/TEMP/template_58888/intense-taxi/forms.html @@ -175,7 +175,7 @@

Forms

With forms you can get almost any kind of information from
your visitors, who will definitely appreciate this attractive element.

- +
Create an account
diff --git a/myclub_website/accounts/__init__.py b/myclub_website/accounts/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/myclub_website/accounts/admin.py b/myclub_website/accounts/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/myclub_website/accounts/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/myclub_website/accounts/apps.py b/myclub_website/accounts/apps.py new file mode 100644 index 0000000..3e3c765 --- /dev/null +++ b/myclub_website/accounts/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class AccountsConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'accounts' diff --git a/myclub_website/accounts/forms.py b/myclub_website/accounts/forms.py new file mode 100644 index 0000000..8b08786 --- /dev/null +++ b/myclub_website/accounts/forms.py @@ -0,0 +1,11 @@ +from django.contrib.auth.forms import UserCreationForm +from django.contrib.auth.models import User +from django import forms + + +class SignUpForm(UserCreationForm): + class Meta: + model = User + fields = ('username', 'first_name', + 'last_name', 'email', + 'password1', 'password2',) diff --git a/myclub_website/accounts/migrations/__init__.py b/myclub_website/accounts/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/myclub_website/accounts/models.py b/myclub_website/accounts/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/myclub_website/accounts/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/myclub_website/accounts/tests.py b/myclub_website/accounts/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/myclub_website/accounts/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/myclub_website/accounts/urls.py b/myclub_website/accounts/urls.py new file mode 100644 index 0000000..830c30d --- /dev/null +++ b/myclub_website/accounts/urls.py @@ -0,0 +1,10 @@ +from django.urls import path +from django.contrib.auth import views + +from accounts.views import SignUpView + +urlpatterns = [ + path('login/', views.LoginView.as_view(), name='login'), + path('logout/', views.LogoutView.as_view(), name='logout'), + path('signup/', SignUpView.as_view(), name='signup') +] \ No newline at end of file diff --git a/myclub_website/accounts/views.py b/myclub_website/accounts/views.py new file mode 100644 index 0000000..32c669f --- /dev/null +++ b/myclub_website/accounts/views.py @@ -0,0 +1,30 @@ +from django.contrib.auth.views import LoginView +from django.http import HttpResponseRedirect +from django.shortcuts import render +from django.urls import reverse +from django import views + +from accounts.forms import SignUpForm + + +class SignUpView(views.View): + + def get(self, request): + form = SignUpForm() + context = { + 'form': form + } + return render(request, 'registration/signup.html', context) + + def post(self, request): + form = SignUpForm(request.POST) + if form.is_valid(): + form.save() + return HttpResponseRedirect(reverse('index')) + context = { + 'form': form + } + return render(request, 'registration/signup.html', context) + +# class CustomLoginView(LoginView): +# pass diff --git a/myclub_website/courses/admin.py b/myclub_website/courses/admin.py index f12f756..36a118c 100644 --- a/myclub_website/courses/admin.py +++ b/myclub_website/courses/admin.py @@ -8,7 +8,9 @@ class CategoryAdmin(admin.ModelAdmin): admin.site.register(Category,CategoryAdmin) class CoursesAdmin(admin.ModelAdmin): - list_display = ['title', 'status', 'category', 'create_at'] + list_display = ['title', 'status', + 'category', + 'create_at'] list_filter = ['status'] ordering = ['category', 'title'] admin.site.register(Courses,CoursesAdmin) diff --git a/myclub_website/courses/migrations/0010_alter_quizquestions_question.py b/myclub_website/courses/migrations/0010_alter_quizquestions_question.py new file mode 100644 index 0000000..6c9c952 --- /dev/null +++ b/myclub_website/courses/migrations/0010_alter_quizquestions_question.py @@ -0,0 +1,18 @@ +# Generated by Django 4.0.3 on 2022-05-29 08:47 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('courses', '0009_quiz_quizquestions'), + ] + + operations = [ + migrations.AlterField( + model_name='quizquestions', + name='question', + field=models.TextField(blank=True), + ), + ] diff --git a/myclub_website/courses/migrations/0011_remove_courses_category_courses_category.py b/myclub_website/courses/migrations/0011_remove_courses_category_courses_category.py new file mode 100644 index 0000000..ee3e3db --- /dev/null +++ b/myclub_website/courses/migrations/0011_remove_courses_category_courses_category.py @@ -0,0 +1,22 @@ +# Generated by Django 4.0.3 on 2022-05-29 11:35 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('courses', '0010_alter_quizquestions_question'), + ] + + operations = [ + migrations.RemoveField( + model_name='courses', + name='category', + ), + migrations.AddField( + model_name='courses', + name='category', + field=models.ManyToManyField(to='courses.category'), + ), + ] diff --git a/myclub_website/courses/migrations/0012_remove_courses_category_courses_category.py b/myclub_website/courses/migrations/0012_remove_courses_category_courses_category.py new file mode 100644 index 0000000..83f0751 --- /dev/null +++ b/myclub_website/courses/migrations/0012_remove_courses_category_courses_category.py @@ -0,0 +1,24 @@ +# Generated by Django 4.0.3 on 2022-05-29 11:36 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('courses', '0011_remove_courses_category_courses_category'), + ] + + operations = [ + migrations.RemoveField( + model_name='courses', + name='category', + ), + migrations.AddField( + model_name='courses', + name='category', + field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='courses.category'), + preserve_default=False, + ), + ] diff --git a/myclub_website/home/templates/content_categories.html b/myclub_website/home/templates/content_categories.html index 8409b22..d4069f0 100644 --- a/myclub_website/home/templates/content_categories.html +++ b/myclub_website/home/templates/content_categories.html @@ -3,27 +3,41 @@
-

Categories

-
-
+

Categories

+
+
-
    - {% for rs in categoriesdata %} +
      + {% for category in categoriesdata %} + {% if not category.parent %} +
    • {{category.title}}
    • +
        + {% for sub_category in categoriesdata %} + {% if sub_category.parent and sub_category.parent.id == category.id %} +
      • {{sub_category.title}}
      • + {% endif %} + {% endfor %} +
      + {% endif %} + {% endfor %} +
    +
+
+
+ + - {% for sub_category in parents %} - {% if sub_category.parent.id == rs.id %} - + + + + + + - {% endif %} - {% endfor %} + + - {% endfor %} - -
-
- + + diff --git a/myclub_website/home/templates/header.html b/myclub_website/home/templates/header.html index ff41786..fa2dd45 100644 --- a/myclub_website/home/templates/header.html +++ b/myclub_website/home/templates/header.html @@ -42,20 +42,14 @@