Skip to content

Commit be88eb0

Browse files
committed
Revert "Merge pull request #28 from devmahmud/dev"
1 parent 5a5062b commit be88eb0

File tree

9 files changed

+10
-65
lines changed

9 files changed

+10
-65
lines changed

accounts/templates/accounts/register.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% block content %}
44
<div class="container">
55
<div class="row center">
6-
<div class="col-md-5 mx-auto p-5 shadow-sm border rounded border-primary">
6+
<div class="col-md-6 offset-md-3">
77
<p>Already have an account? <a href="{% url 'accounts:login' %}">Login Here</a></p>
88
{% if messages %}
99
<div class="messages">

polls/admin.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,23 @@
22
from .models import Poll, Choice, Vote
33

44

5-
class ChoiceInline(admin.TabularInline): # or admin.StackedInline for a different layout
6-
model = Choice
7-
extra = 1
8-
95
@admin.register(Poll)
106
class PollAdmin(admin.ModelAdmin):
11-
list_display = ["text", "owner", "pub_date", "active", "created_at"]
7+
list_display = ["text", "owner", "pub_date", "active"]
128
search_fields = ["text", "owner__username"]
13-
list_filter = ["active", 'created_at', 'pub_date']
9+
list_filter = ["active"]
1410
date_hierarchy = "pub_date"
15-
inlines = [ChoiceInline]
1611

1712

1813
@admin.register(Choice)
1914
class ChoiceAdmin(admin.ModelAdmin):
20-
list_display = ["choice_text", "poll", 'created_at', 'updated_at']
15+
list_display = ["choice_text", "poll"]
2116
search_fields = ["choice_text", "poll__text"]
2217
autocomplete_fields = ["poll"]
2318

2419

2520
@admin.register(Vote)
2621
class VoteAdmin(admin.ModelAdmin):
27-
list_display = ["choice", "poll", "user", 'created_at']
22+
list_display = ["choice", "poll", "user"]
2823
search_fields = ["choice__choice_text", "poll__text", "user__username"]
2924
autocomplete_fields = ["choice", "poll", "user"]

polls/migrations/0002_auto_20231018_1318.py

Lines changed: 0 additions & 42 deletions
This file was deleted.

polls/models.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class Poll(models.Model):
99
text = models.TextField()
1010
pub_date = models.DateTimeField(default=timezone.now)
1111
active = models.BooleanField(default=True)
12-
created_at = models.DateTimeField(auto_now_add=True)
1312

1413
def user_can_vote(self, user):
1514
"""
@@ -51,8 +50,6 @@ def __str__(self):
5150
class Choice(models.Model):
5251
poll = models.ForeignKey(Poll, on_delete=models.CASCADE)
5352
choice_text = models.CharField(max_length=255)
54-
created_at = models.DateTimeField(auto_now_add=True)
55-
updated_at = models.DateTimeField(auto_now=True)
5653

5754
@property
5855
def get_vote_count(self):
@@ -66,8 +63,6 @@ class Vote(models.Model):
6663
user = models.ForeignKey(User, on_delete=models.CASCADE)
6764
poll = models.ForeignKey(Poll, on_delete=models.CASCADE)
6865
choice = models.ForeignKey(Choice, on_delete=models.CASCADE)
69-
created_at = models.DateTimeField(auto_now_add=True)
70-
updated_at = models.DateTimeField(auto_now=True)
7166

7267
def __str__(self):
7368
return f'{self.poll.text[:15]} - {self.choice.choice_text[:15]} - {self.user.username}'

polls/templates/polls/poll_result.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
{% if poll.active %}
1919
<h3 class="mt-3 mb-3 text-center">Result for: {{ poll.text }}</h3>
2020
{% else %}
21-
<h3 class="mt-3 mb-3 text-center">"{{ poll.text }}" Has Ended Polling!</h3>
21+
<h3 class="mt-3 mb-3 text-center">"{{ poll.text }}" Has Ended Polling !</h3>
2222
{% endif %}
2323
<h3 class="mb-2 text-center">Total: {{ poll.get_vote_count }} votes</h3>
2424
<!-- progress bar -->

polls/templates/polls/polls_list.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div class="container">
55
<div class="row">
66
<div class="col-md-8 offset-sm-2">
7-
<h1 class="text-center mb-5">Welcome to polls List!</h1>
7+
<h1 class="text-center mt-3 mb-3">Welcome to polls List!</h1>
88
{% if messages %}
99
<div class="messages">
1010
{% for message in messages %}
@@ -54,7 +54,6 @@ <h1 class="text-center mb-5">Welcome to polls List!</h1>
5454

5555
{% endfor %}
5656
</ul>
57-
{% if polls.paginator.num_pages > 1 %}
5857
<nav class="mt-3">
5958
<ul class="pagination">
6059
{% if polls.has_previous %}
@@ -70,7 +69,6 @@ <h1 class="text-center mb-5">Welcome to polls List!</h1>
7069
{% endif %}
7170
</ul>
7271
</nav>
73-
{% endif %}
7472
</div>
7573
</div>
7674
</div>

polls/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
path('add/', views.polls_add, name='add'),
1010
path('edit/<int:poll_id>/', views.polls_edit, name='edit'),
1111
path('delete/<int:poll_id>/', views.polls_delete, name='delete_poll'),
12-
path('end/<int:poll_id>/', views.end_poll, name='end_poll'),
12+
path('end/<int:poll_id>/', views.endpoll, name='end_poll'),
1313
path('edit/<int:poll_id>/choice/add/', views.add_choice, name='add_choice'),
1414
path('edit/choice/<int:choice_id>/', views.choice_edit, name='choice_edit'),
1515
path('delete/choice/<int:choice_id>/',

polls/views.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ def polls_add(request):
114114
poll.save()
115115
Choice(poll=poll, choice_text=form.cleaned_data["choice1"]).save()
116116
Choice(poll=poll, choice_text=form.cleaned_data["choice2"]).save()
117-
118117
messages.success(
119118
request,
120119
"Poll & Choices added successfully.",
@@ -289,7 +288,7 @@ def poll_vote(request, poll_id):
289288

290289

291290
@login_required
292-
def end_poll(request, poll_id):
291+
def endpoll(request, poll_id):
293292
poll = get_object_or_404(Poll, pk=poll_id)
294293
if request.user != poll.owner:
295294
return redirect("home")

templates/includes/navbar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<nav class="navbar navbar-expand-sm navbar-light bg-light mb-5">
1+
<nav class="navbar navbar-expand-sm navbar-light bg-light">
22
<a class="navbar-brand" href="{% url 'home' %}"><i class="fas fa-person-booth"></i></a>
33
<button class="navbar-toggler d-lg-none" type="button" data-toggle="collapse" data-target="#collapsibleNavId"
44
aria-controls="collapsibleNavId" aria-expanded="false" aria-label="Toggle navigation">

0 commit comments

Comments
 (0)