Clean up team pages, fix missing created_time stamp on new teams
This commit is contained in:
parent
4ba3376d19
commit
5bef56366a
4 changed files with 29 additions and 12 deletions
|
@ -2,6 +2,7 @@ from django.db import models
|
||||||
from django.contrib.sites.models import Site
|
from django.contrib.sites.models import Site
|
||||||
from django.contrib.auth.models import User, Group, AnonymousUser
|
from django.contrib.auth.models import User, Group, AnonymousUser
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
from django.utils import timezone
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from imagekit.models import ProcessedImageField
|
from imagekit.models import ProcessedImageField
|
||||||
|
@ -191,7 +192,7 @@ class Team(models.Model):
|
||||||
web_url = models.URLField(_("Website"), null=True, blank=True)
|
web_url = models.URLField(_("Website"), null=True, blank=True)
|
||||||
email = models.EmailField(_("Email Address"), null=True, blank=True)
|
email = models.EmailField(_("Email Address"), null=True, blank=True)
|
||||||
|
|
||||||
created_date = models.DateField(_("Date Created"), null=True, blank=True)
|
created_date = models.DateField(_("Date Created"), default=timezone.now, null=True, blank=True)
|
||||||
|
|
||||||
owner_profile = models.ForeignKey(UserProfile, related_name='owned_teams', null=True, on_delete=models.CASCADE)
|
owner_profile = models.ForeignKey(UserProfile, related_name='owned_teams', null=True, on_delete=models.CASCADE)
|
||||||
admin_profiles = models.ManyToManyField(UserProfile, related_name='admins', blank=True)
|
admin_profiles = models.ManyToManyField(UserProfile, related_name='admins', blank=True)
|
||||||
|
|
|
@ -26,9 +26,7 @@
|
||||||
top: 16px;
|
top: 16px;
|
||||||
left: -42px;
|
left: -42px;
|
||||||
}
|
}
|
||||||
.table td, .table th {
|
|
||||||
border-top: none;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
@ -51,13 +49,13 @@
|
||||||
<table class="table">
|
<table class="table">
|
||||||
{% if event.parent %}
|
{% if event.parent %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><b>Part of:</b></td><td><a href="{{ event.parent.get_absolute_url }}" target="_blank">{{ event.parent.name }}</a></td>
|
<td width="120px"><b>Part of:</b></td><td><a href="{{ event.parent.get_absolute_url }}" target="_blank">{{ event.parent.name }}</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><b>Time:</b></td><td>{{ event.local_start_time }} - {{ event.local_end_time }}</td>
|
<td width="120px"><b>Time:</b></td><td>{{ event.local_start_time }} - {{ event.local_end_time }}</td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<td><b>Place:</b></td><td>
|
<td width="120px"><b>Place:</b></td><td>
|
||||||
{% if event.place %}
|
{% if event.place %}
|
||||||
<a class="" href="{% url 'show-place' event.place.id %}">{{ event.place.name }}</a>
|
<a class="" href="{% url 'show-place' event.place.id %}">{{ event.place.name }}</a>
|
||||||
{% elif can_edit_event %}
|
{% elif can_edit_event %}
|
||||||
|
@ -69,7 +67,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
{% if event.web_url %}
|
{% if event.web_url %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><b>Website:</b></td><td><a href="{{ event.web_url }}" target="_blank">{{ event.web_url }}</a></td>
|
<td width="120px"><b>Website:</b></td><td><a href="{{ event.web_url }}" target="_blank">{{ event.web_url }}</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -29,9 +29,27 @@
|
||||||
<a href="{% url 'join-team' team.id %}" class="btn btn-success btn-sm">Join Team</a>
|
<a href="{% url 'join-team' team.id %}" class="btn btn-success btn-sm">Join Team</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a href="{% url 'team-event-ical' team.id %}" class="btn btn-success btn-sm">iCal</a>
|
<a href="{% url 'team-event-ical' team.id %}" class="btn btn-success btn-sm">iCal</a>
|
||||||
</h2><hr/>
|
</h2>
|
||||||
|
|
||||||
{% if team.description %}<p>{{ team.description|markdown }}</p><hr/>{% endif %}
|
|
||||||
|
<table class="table">
|
||||||
|
{% if team.description %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="2"><p>{{ team.description|markdown }}</p></td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
{% if team.organization %}
|
||||||
|
<tr>
|
||||||
|
<td width="120px"><b>Organization:</b></td><td><a href="{% url 'show-org' team.organization.slug %}">{{ team.organization.name }}</a></td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
{% if team.web_url %}
|
||||||
|
<tr>
|
||||||
|
<td width="120px"><b>Website:</b></td><td><a href="{{ team.web_url }}" target="_blank">{{ team.web_url }}</a></td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
</table>
|
||||||
|
<hr/>
|
||||||
|
|
||||||
<h4>Upcoming Events</h4>
|
<h4>Upcoming Events</h4>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
|
@ -3,7 +3,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.auth import logout as logout_user
|
from django.contrib.auth import logout as logout_user
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.shortcuts import render, redirect
|
from django.shortcuts import render, redirect, get_object_or_404
|
||||||
from django.http import HttpResponse, JsonResponse
|
from django.http import HttpResponse, JsonResponse
|
||||||
|
|
||||||
from events.models.profiles import Organization, Team, UserProfile, Member
|
from events.models.profiles import Organization, Team, UserProfile, Member
|
||||||
|
@ -134,7 +134,7 @@ def delete_team(request, team_id):
|
||||||
return redirect('home')
|
return redirect('home')
|
||||||
|
|
||||||
def show_org(request, org_slug):
|
def show_org(request, org_slug):
|
||||||
org = Organization.objects.get(slug=org_slug)
|
org = get_object_or_404(Organization, slug=org_slug)
|
||||||
upcoming_events = CommonEvent.objects.filter(organization=org, end_time__gt=datetime.datetime.now()).order_by('start_time')
|
upcoming_events = CommonEvent.objects.filter(organization=org, end_time__gt=datetime.datetime.now()).order_by('start_time')
|
||||||
recent_events = CommonEvent.objects.filter(organization=org, end_time__lte=datetime.datetime.now()).order_by('-start_time')[:5]
|
recent_events = CommonEvent.objects.filter(organization=org, end_time__lte=datetime.datetime.now()).order_by('-start_time')[:5]
|
||||||
context = {
|
context = {
|
||||||
|
|
Loading…
Reference in a new issue