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

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

parent 3d88a1b8
......@@ -108,7 +108,7 @@ AUTH_PASSWORD_VALIDATORS = [
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'Asia/Dhaka'
TIME_ZONE = 'Asia/Almaty'
USE_I18N = True
......
......@@ -3,7 +3,7 @@ from webapp.models import Event
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:
model = Event
......
......@@ -6,7 +6,7 @@
<h1>Список участников</h1>
<p>
{% for u in event.users.all %}
<a href="{% url "profile" event.pk %}">{{ u }}</a>
<a href="{% url "profile" u.pk %}">{{ u }}</a>
<br>
{% endfor %}
</p>
......
......@@ -14,7 +14,7 @@
{{ event.place.description }}
</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 %}
<a href="{% url "update_events" event.pk %}" class="btn btn-info">Редактировать</a>
......
......@@ -8,7 +8,7 @@
<div class="mt-5">
<a href="{% url 'detail_events' event.pk %}">{{ event.place }} - {{ event.place.address }}</a>
<br>
<p>{{ event.date|date:"M d Y - h:m" }}</p>
<p>{{ event.date|date:"M d Y - H:i" }}</p>
<hr>
</div>
{% endfor %}
......
......@@ -3,7 +3,6 @@ from django.urls import reverse, reverse_lazy
from django.views import View
from django.views.generic import CreateView, DetailView, UpdateView, DeleteView
from django.contrib.auth.mixins import PermissionRequiredMixin, UserPassesTestMixin
import datetime
from webapp.forms import EventForm
from webapp.models import Event
......@@ -15,13 +14,7 @@ def index_view(request):
class EventView(View):
def get(self, request, *args, **kwargs):
events = Event.objects.all()
# now = datetime.datetime.now(datetime.timezone.utc)
# for event in events:
# print(event.date)
# print(now)
# if event.date < now:
# event.delete()
events = Event.objects.all().order_by("-date")
context = {"events": events}
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