diff --git a/config/settings.py b/config/settings.py index f38b528..c1634d3 100644 --- a/config/settings.py +++ b/config/settings.py @@ -38,7 +38,6 @@ INSTALLED_APPS = [ 'django.contrib.messages', 'django.contrib.staticfiles', 'imagekit', - 'contact', 'gallery' ] diff --git a/config/urls.py b/config/urls.py index 099caeb..daa6e4d 100644 --- a/config/urls.py +++ b/config/urls.py @@ -5,7 +5,6 @@ from django.urls import include, path urlpatterns = [ path('admin/', admin.site.urls), - path('contact/', include(('contact.urls', 'contact'), namespace='contact')), path('', include(('gallery.urls', 'gallery'), namespace='gallery')), ] diff --git a/contact/__init__.py b/contact/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/contact/admin.py b/contact/admin.py deleted file mode 100644 index 633ae9f..0000000 --- a/contact/admin.py +++ /dev/null @@ -1,11 +0,0 @@ -from django.contrib import admin - -from .models import Feedback - - -@admin.register(Feedback) -class LocationAdmin(admin.ModelAdmin): - list_display = ('subject', 'name', 'date', 'message',) - list_display_links = ('subject',) - search_fields = ('name', 'message', 'subject',) - list_per_page = 30 diff --git a/contact/apps.py b/contact/apps.py deleted file mode 100644 index 002d6c2..0000000 --- a/contact/apps.py +++ /dev/null @@ -1,6 +0,0 @@ -from django.apps import AppConfig - - -class ContactConfig(AppConfig): - default_auto_field = 'django.db.models.BigAutoField' - name = 'contact' diff --git a/contact/forms.py b/contact/forms.py deleted file mode 100644 index 0f16877..0000000 --- a/contact/forms.py +++ /dev/null @@ -1,25 +0,0 @@ -from django import forms -from django.conf import settings -from django.core.mail import send_mail - -from .models import Feedback - - -class FeedbackForm(forms.ModelForm): - - class Meta: - model = Feedback - exclude = ['ip', 'agent'] - - def __init__(self, *args, **kwargs): - super(FeedbackForm, self).__init__(*args, **kwargs) - self.fields['name'].widget.attrs.update({'class': 'uk-input', 'placeholder': 'Name'}) - self.fields['email'].widget.attrs.update({'class': 'uk-input', 'placeholder': 'E-mail'}) - self.fields['subject'].widget.attrs.update({'class': 'uk-input', 'placeholder': 'Subject'}) - self.fields['message'].widget.attrs.update({'class': 'uk-textarea', 'placeholder': 'Message'}) - - def send_email(self): - subject = "Gallery Feedback: " + self.cleaned_data['subject'] - from_email = self.cleaned_data['email'] - message = self.cleaned_data['message'] - send_mail(subject, message, from_email, [settings.EMAIL_TO]) diff --git a/contact/migrations/0001_initial.py b/contact/migrations/0001_initial.py deleted file mode 100644 index fde2d6f..0000000 --- a/contact/migrations/0001_initial.py +++ /dev/null @@ -1,25 +0,0 @@ -# Generated by Django 5.1.4 on 2025-02-02 19:12 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ] - - operations = [ - migrations.CreateModel( - name='Feedback', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=150, verbose_name='Name')), - ('email', models.EmailField(max_length=150, verbose_name='E-mail')), - ('date', models.DateTimeField(auto_now_add=True, verbose_name='Sended')), - ('subject', models.CharField(max_length=150, verbose_name='Subject')), - ('message', models.TextField(verbose_name='Message')), - ], - ), - ] diff --git a/contact/migrations/__init__.py b/contact/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/contact/models.py b/contact/models.py deleted file mode 100644 index 6f97d55..0000000 --- a/contact/models.py +++ /dev/null @@ -1,12 +0,0 @@ -from django.db import models - - -class Feedback(models.Model): - name = models.CharField(max_length=150, verbose_name="Name") - email = models.EmailField(max_length=150, verbose_name="E-mail") - date = models.DateTimeField(auto_now_add=True, auto_now=False, verbose_name="Sended") - subject = models.CharField(max_length=150, verbose_name="Subject") - message = models.TextField(verbose_name="Message") - - def __str__(self): - return '{}'.format(self.name) diff --git a/contact/templates/contact/main.html b/contact/templates/contact/main.html deleted file mode 100644 index 74e7104..0000000 --- a/contact/templates/contact/main.html +++ /dev/null @@ -1,61 +0,0 @@ -{% extends "base_dark.html" %} - - -{% block title %} Gallery : Contact {% endblock %} - - -{% block content %} - -
-{% endblock %} \ No newline at end of file diff --git a/contact/tests.py b/contact/tests.py deleted file mode 100644 index 7ce503c..0000000 --- a/contact/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here. diff --git a/contact/urls.py b/contact/urls.py deleted file mode 100644 index 51d8b14..0000000 --- a/contact/urls.py +++ /dev/null @@ -1,9 +0,0 @@ -from django.urls import path - -from . import views - -app_name = 'contact' - -urlpatterns = [ - path('', views.Contact.as_view(), name="contact_url") -] diff --git a/contact/views.py b/contact/views.py deleted file mode 100644 index 6b9525b..0000000 --- a/contact/views.py +++ /dev/null @@ -1,25 +0,0 @@ -from django.contrib import messages -from django.shortcuts import redirect, render -from django.views.generic.base import View - -from .forms import FeedbackForm -from .models import Feedback - - -class Contact(View): - - def post(self, request): - form = FeedbackForm(request.POST or None) - if form.is_valid(): - profile = form.save(commit=False) - profile.save() - form.send_email() - messages.success(request, 'Your message was sent successfully! Thank you!') - return redirect('gallery:main_url') - else: - messages.warning(request, 'Error occured while sending message.') - return render(request, 'contact/main.html', {'form': form}) - - def get(self, request): - form = FeedbackForm() - return render(request, 'contact/main.html', {'form': form}) diff --git a/gallery/templates/gallery/about.html b/gallery/templates/gallery/about.html new file mode 100644 index 0000000..157d51a --- /dev/null +++ b/gallery/templates/gallery/about.html @@ -0,0 +1,24 @@ +{% extends "base_dark.html" %} +{% load top_tags %} + + +{% block title %} Gallery : About{% endblock %} + + +{% block content %} + + + + {% endblock %} \ No newline at end of file diff --git a/gallery/urls.py b/gallery/urls.py index e4c696b..27c69ff 100644 --- a/gallery/urls.py +++ b/gallery/urls.py @@ -1,3 +1,4 @@ +from django.shortcuts import redirect from django.urls import path from . import views @@ -7,9 +8,15 @@ app_name = 'gallery' urlpatterns = [ path('', views.AlbumsList.as_view(), name='main_url'), + path('about/', views.About.as_view(), name='about_url'), path('photostream/', views.PhotosList.as_view(), name='photos_url'), path('albums/