-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
25aa638
commit 002d501
Showing
8 changed files
with
225 additions
and
7 deletions.
There are no files selected for viewing
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,31 @@ | ||
# Generated by Django 5.0.2 on 2024-03-17 15:02 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('payapp', '0005_rename_transaction_transfer'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Notification', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('notification_type', models.CharField(choices=[(1, 'Payment Sent'), (2, 'Request Sent'), (3, 'Request Declined'), (4, 'Request Accepted')], default='payment_sent', max_length=10)), | ||
('message', models.CharField(max_length=255)), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('read', models.BooleanField(default=False)), | ||
('from_user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='sent_notification', to='payapp.account')), | ||
('to_user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='received_notification', to='payapp.account')), | ||
], | ||
options={ | ||
'verbose_name': 'Notification', | ||
'verbose_name_plural': 'Notifications', | ||
'db_table': 'notification', | ||
}, | ||
), | ||
] |
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
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{% extends 'base.html' %} | ||
{% load crispy_forms_filters %} | ||
{% load crispy_forms_tags %} | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>{% block title %} All Notifications{% endblock title %}</title> | ||
|
||
</head> | ||
<body> | ||
{% block content %} | ||
{% if notifications|length == 0 %} | ||
<p>You have no unread notifications.</p> | ||
{% else %}: | ||
<h1>All Notifications</h1> | ||
<div class="table-responsive"> | ||
<table class="table table-striped table-bordered table-hover table-sm"> | ||
|
||
<thead class="text-center"> | ||
<tr> | ||
<th>Notification</th> | ||
<th>Time</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for notification in notifications %} | ||
<tr class="text-center"> | ||
|
||
<td><a {% if notification.notification_type == 'payment_sent' %} | ||
href="{% url "payapp:transfers" %}" | ||
{% else %} | ||
href="{% url "payapp:requests" %}" | ||
{% endif %}>{{ notification.message }} </a> | ||
</td> | ||
<td>{{ notification.created_at }}</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
</div> | ||
{% endif %} | ||
{% endblock content %} | ||
</body> | ||
</html> |
Binary file not shown.