Skip to content

Commit

Permalink
Added message display
Browse files Browse the repository at this point in the history
  • Loading branch information
Varsha010101 committed Apr 12, 2024
1 parent c383ea4 commit 74fbc48
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 3 deletions.
Binary file modified db.sqlite3
Binary file not shown.
Binary file modified home/__pycache__/models.cpython-312.pyc
Binary file not shown.
Binary file modified home/__pycache__/views.cpython-312.pyc
Binary file not shown.
Binary file modified home/migrations/__pycache__/0001_initial.cpython-312.pyc
Binary file not shown.
Binary file modified home/migrations/__pycache__/__init__.cpython-312.pyc
Binary file not shown.
4 changes: 3 additions & 1 deletion home/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ class Contact(models.Model):
email=models.CharField(max_length=122)
subject=models.CharField(max_length=122)
message=models.TextField()
date=models.DateField()
date=models.DateField()
def __str__(self):
return self.name
4 changes: 3 additions & 1 deletion home/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
from django.utils import timezone
import os
from home.models import Contact
from django.contrib import messages

def index(request):

return render (request,'index.html')
def contact(request):
return render(request,"contact.html")
Expand All @@ -31,4 +32,5 @@ def submit_contact(request):
message=message,
date=date
)
messages.success(request, "Profile details updated.")
return render(request, 'contact.html')
Binary file modified ina/__pycache__/settings.cpython-312.pyc
Binary file not shown.
Binary file modified ina/__pycache__/wsgi.cpython-312.pyc
Binary file not shown.
1 change: 1 addition & 0 deletions ina/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"""

from pathlib import Path
from django.contrib.messages import constants as messages

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Django==5.0.4
nicegui==1.4.20
nicegui==1.4.20
11 changes: 11 additions & 0 deletions templates/contact.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@
<link rel="stylesheet" href="{% static 'css/style.css' %}">
</head>
<body>


{% if messages %}
{% for message in messages %}
<div class="alert alert-{{ message.tags }} alert-dismissible fade show" role="alert" style="color:green">
{{ message }}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
<span aria-hidden="true">&times;</span>
</div>
{% endfor %}
{% endif %}
<div id="container">
<h1>&bull; Keep in Touch &bull;</h1>
<div class="underline"></div>
Expand Down

0 comments on commit 74fbc48

Please sign in to comment.