Commit 6aad1dee authored by Isataev Adlet's avatar Isataev Adlet

Подправил формат отображения времени в шаблонах. Сделал ссылками профилей в списке участников

parent 3d88a1b8
...@@ -108,7 +108,7 @@ AUTH_PASSWORD_VALIDATORS = [ ...@@ -108,7 +108,7 @@ AUTH_PASSWORD_VALIDATORS = [
LANGUAGE_CODE = 'en-us' LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'Asia/Dhaka' TIME_ZONE = 'Asia/Almaty'
USE_I18N = True USE_I18N = True
......
...@@ -3,7 +3,7 @@ from webapp.models import Event ...@@ -3,7 +3,7 @@ from webapp.models import Event
class EventForm(forms.ModelForm): class EventForm(forms.ModelForm):
date = forms.DateTimeField(widget=forms.TextInput(attrs={'placeholder': 'YYYY-MM-DD HH-MM-SS'})) date = forms.DateTimeField(widget=forms.TextInput(attrs={'placeholder': 'YYYY-MM-DD HH-MM-SS','type': 'datetime-local'}))
class Meta: class Meta:
model = Event model = Event
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<h1>Список участников</h1> <h1>Список участников</h1>
<p> <p>
{% for u in event.users.all %} {% for u in event.users.all %}
<a href="{% url "profile" event.pk %}">{{ u }}</a> <a href="{% url "profile" u.pk %}">{{ u }}</a>
<br> <br>
{% endfor %} {% endfor %}
</p> </p>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
{{ event.place.description }} {{ event.place.description }}
</div> </div>
</div> </div>
<p class="mt-5">{{ event.date|date:"M d Y - h:m" }}</p> <p class="mt-5">{{ event.date|date:"M d Y - H:i" }}</p>
{% if perms.webapp.change_event %} {% if perms.webapp.change_event %}
<a href="{% url "update_events" event.pk %}" class="btn btn-info">Редактировать</a> <a href="{% url "update_events" event.pk %}" class="btn btn-info">Редактировать</a>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<div class="mt-5"> <div class="mt-5">
<a href="{% url 'detail_events' event.pk %}">{{ event.place }} - {{ event.place.address }}</a> <a href="{% url 'detail_events' event.pk %}">{{ event.place }} - {{ event.place.address }}</a>
<br> <br>
<p>{{ event.date|date:"M d Y - h:m" }}</p> <p>{{ event.date|date:"M d Y - H:i" }}</p>
<hr> <hr>
</div> </div>
{% endfor %} {% endfor %}
......
...@@ -3,7 +3,6 @@ from django.urls import reverse, reverse_lazy ...@@ -3,7 +3,6 @@ from django.urls import reverse, reverse_lazy
from django.views import View from django.views import View
from django.views.generic import CreateView, DetailView, UpdateView, DeleteView from django.views.generic import CreateView, DetailView, UpdateView, DeleteView
from django.contrib.auth.mixins import PermissionRequiredMixin, UserPassesTestMixin from django.contrib.auth.mixins import PermissionRequiredMixin, UserPassesTestMixin
import datetime
from webapp.forms import EventForm from webapp.forms import EventForm
from webapp.models import Event from webapp.models import Event
...@@ -15,13 +14,7 @@ def index_view(request): ...@@ -15,13 +14,7 @@ def index_view(request):
class EventView(View): class EventView(View):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
events = Event.objects.all() events = Event.objects.all().order_by("-date")
# now = datetime.datetime.now(datetime.timezone.utc)
# for event in events:
# print(event.date)
# print(now)
# if event.date < now:
# event.delete()
context = {"events": events} context = {"events": events}
return render(request, "event_list.html", context) return render(request, "event_list.html", context)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment