-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from Varsha010101/main
BUG FIXED IN THE CONTACT ME PAGE
- Loading branch information
Showing
34 changed files
with
95 additions
and
58 deletions.
There are no files selected for viewing
Submodule NEWS-AGGREGATOR-PROJECT
added at
d942ce
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
from django.contrib import admin | ||
from core.models import Headline,Bookmark | ||
|
||
from core.models import Headline,Bookmark,Contact | ||
admin.site.register(Headline) | ||
admin.site.register(Bookmark) | ||
admin.site.register(Bookmark) | ||
admin.site.register(Contact) | ||
# Register your models here. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Generated by Django 5.0.6 on 2024-05-30 09:47 | ||
|
||
import django.core.validators | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('core', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Contact', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(max_length=255)), | ||
('email', models.EmailField(max_length=254, validators=[django.core.validators.EmailValidator()])), | ||
('phone', models.CharField(blank=True, max_length=20)), | ||
('message', models.TextField(blank=True, max_length=20)), | ||
], | ||
), | ||
] |
Binary file modified
BIN
+1 Byte
(100%)
newsaggregator/core/migrations/__pycache__/0001_initial.cpython-312.pyc
Binary file not shown.
Binary file added
BIN
+1.31 KB
newsaggregator/core/migrations/__pycache__/0002_contact.cpython-312.pyc
Binary file not shown.
Binary file modified
BIN
+1 Byte
(100%)
newsaggregator/core/migrations/__pycache__/__init__.cpython-312.pyc
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,8 @@ | |
from core.models import Headline | ||
|
||
from datetime import datetime | ||
from core.forms import ContactForm | ||
|
||
from core.models import Contact | ||
from django.template.loader import render_to_string | ||
from django.core.mail import send_mail | ||
|
||
|
@@ -134,35 +135,22 @@ def about(request): | |
return render(request, "core/about.html", context) | ||
|
||
@login_required(login_url='userauths:sign-in') | ||
def contact(request): | ||
today_date = datetime.now().strftime('%Y-%m-%d') | ||
if request.method == "POST": | ||
form = ContactForm(request.POST) | ||
|
||
if form.is_valid(): | ||
name = form.cleaned_data['name'] | ||
email = form.cleaned_data['email'] | ||
phone = form.cleaned_data['phone'] | ||
content = form.cleaned_data['content'] | ||
|
||
html = render_to_string('components/email.html', { | ||
'name': name, | ||
'email': email, | ||
'phone': phone, | ||
'content': content, | ||
}) | ||
|
||
send_mail("The contact form subject", 'this is the message', email, ['[email protected]'], html_message=html) | ||
messages.success(request, 'Form submitted successfully!') | ||
return redirect("core:index") | ||
else: | ||
form = ContactForm() | ||
def submit_contact(request): | ||
if request.method == 'POST': | ||
name = request.POST.get('name') | ||
email = request.POST.get('email') | ||
phone= request.POST.get('phone') | ||
message = request.POST.get('message') | ||
contact=Contact() | ||
contact.name=name | ||
contact.email=email | ||
contact.phone=phone | ||
contact.message=message | ||
contact.save() | ||
messages.success(request,"Thanks for contacting us") | ||
return redirect("/contact.html") | ||
return render(request, "core/contact.html") | ||
|
||
context={ | ||
'today_date': today_date, | ||
'form': form, | ||
} | ||
return render(request,"core/contact.html",context) | ||
|
||
@login_required(login_url='userauths:sign-in') | ||
def advertise(request): | ||
|
Binary file not shown.
Binary file modified
BIN
+1 Byte
(100%)
newsaggregator/newsaggregator/__pycache__/__init__.cpython-312.pyc
Binary file not shown.
Binary file modified
BIN
+1 Byte
(100%)
newsaggregator/newsaggregator/__pycache__/settings.cpython-312.pyc
Binary file not shown.
Binary file modified
BIN
+1 Byte
(100%)
newsaggregator/newsaggregator/__pycache__/urls.cpython-312.pyc
Binary file not shown.
Binary file modified
BIN
+1 Byte
(100%)
newsaggregator/newsaggregator/__pycache__/wsgi.cpython-312.pyc
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ | |
path('admin/', admin.site.urls), | ||
path('user/',include('userauths.urls')), | ||
path('',include('core.urls')), | ||
|
||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+1 Byte
(100%)
newsaggregator/userauths/__pycache__/__init__.cpython-312.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+1 Byte
(100%)
newsaggregator/userauths/migrations/__pycache__/0001_initial.cpython-312.pyc
Binary file not shown.
Binary file modified
BIN
+1 Byte
(100%)
newsaggregator/userauths/migrations/__pycache__/__init__.cpython-312.pyc
Binary file not shown.