Add admin for Speaker, Presenter and Talk
This commit is contained in:
parent
437134991d
commit
e45c0370a1
4 changed files with 47 additions and 22 deletions
|
@ -3,9 +3,27 @@ from django.utils.safestring import mark_safe
|
||||||
|
|
||||||
# Register your models here.
|
# Register your models here.
|
||||||
from .models.locale import Language, Continent, Country, SPR, City
|
from .models.locale import Language, Continent, Country, SPR, City
|
||||||
from .models.profiles import UserProfile, Organization, Team, Member, Category, Topic
|
from .models.profiles import (
|
||||||
|
UserProfile,
|
||||||
|
Organization,
|
||||||
|
Team,
|
||||||
|
Member,
|
||||||
|
Category,
|
||||||
|
Topic,
|
||||||
|
Speaker,
|
||||||
|
Talk,
|
||||||
|
)
|
||||||
from .models.search import Searchable
|
from .models.search import Searchable
|
||||||
from .models.events import Place, Event, EventComment, EventSeries, EventPhoto, CommonEvent, Attendee
|
from .models.events import (
|
||||||
|
Place,
|
||||||
|
Event,
|
||||||
|
EventComment,
|
||||||
|
EventSeries,
|
||||||
|
EventPhoto,
|
||||||
|
CommonEvent,
|
||||||
|
Attendee,
|
||||||
|
Presentation,
|
||||||
|
)
|
||||||
|
|
||||||
admin.site.register(Language)
|
admin.site.register(Language)
|
||||||
admin.site.register(Continent)
|
admin.site.register(Continent)
|
||||||
|
@ -115,3 +133,7 @@ class TopicAdmin(admin.ModelAdmin):
|
||||||
exclude = ('slug', )
|
exclude = ('slug', )
|
||||||
admin.site.register(Topic, TopicAdmin)
|
admin.site.register(Topic, TopicAdmin)
|
||||||
|
|
||||||
|
admin.site.register(Speaker)
|
||||||
|
admin.site.register(Talk)
|
||||||
|
admin.site.register(Presentation)
|
||||||
|
|
||||||
|
|
|
@ -381,7 +381,10 @@ class SpeakerRequest(models.Model):
|
||||||
topics = models.ManyToManyField('Topic', blank=True)
|
topics = models.ManyToManyField('Topic', blank=True)
|
||||||
|
|
||||||
class Presentation(models.Model):
|
class Presentation(models.Model):
|
||||||
event = models.ForeignKey(Event, on_delete=models.CASCADE)
|
event = models.ForeignKey(Event, related_name='presentations', on_delete=models.CASCADE)
|
||||||
talk = models.ForeignKey(Talk, on_delete=models.SET_NULL, blank=False, null=True)
|
talk = models.ForeignKey(Talk, related_name='presentations', on_delete=models.SET_NULL, blank=False, null=True)
|
||||||
start_time = models.DateTimeField(verbose_name=_('Start Time'), db_index=True)
|
start_time = models.DateTimeField(verbose_name=_('Start Time'), db_index=True)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return '%s at %s' % (self.talk.title, self.event.name)
|
||||||
|
|
||||||
|
|
|
@ -309,6 +309,9 @@ class Speaker(models.Model):
|
||||||
categories = models.ManyToManyField('Category', blank=True)
|
categories = models.ManyToManyField('Category', blank=True)
|
||||||
topics = models.ManyToManyField('Topic', blank=True)
|
topics = models.ManyToManyField('Topic', blank=True)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.user.__str__()
|
||||||
|
|
||||||
class Talk(models.Model):
|
class Talk(models.Model):
|
||||||
PRESENTATION=0
|
PRESENTATION=0
|
||||||
WORKSHOP=1
|
WORKSHOP=1
|
||||||
|
@ -333,4 +336,6 @@ class Talk(models.Model):
|
||||||
category = models.ForeignKey('Category', on_delete=models.SET_NULL, blank=False, null=True)
|
category = models.ForeignKey('Category', on_delete=models.SET_NULL, blank=False, null=True)
|
||||||
topics = models.ManyToManyField('Topic', blank=True)
|
topics = models.ManyToManyField('Topic', blank=True)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.title
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,17 @@ from django.shortcuts import render, redirect, reverse, get_object_or_404
|
||||||
from django.http import HttpResponse, JsonResponse
|
from django.http import HttpResponse, JsonResponse
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
from events.models.events import Event, CommonEvent, EventSeries, EventPhoto, Place, Attendee, update_event_searchable, \
|
from events.models.events import (
|
||||||
delete_event_searchable
|
Event,
|
||||||
|
CommonEvent,
|
||||||
|
EventSeries,
|
||||||
|
EventPhoto,
|
||||||
|
Place,
|
||||||
|
Attendee,
|
||||||
|
Presentation,
|
||||||
|
update_event_searchable,
|
||||||
|
delete_event_searchable,
|
||||||
|
)
|
||||||
from events.models.profiles import Team, Organization, UserProfile, Member
|
from events.models.profiles import Team, Organization, UserProfile, Member
|
||||||
from events.forms import (
|
from events.forms import (
|
||||||
TeamEventForm,
|
TeamEventForm,
|
||||||
|
@ -20,7 +29,7 @@ from events.forms import (
|
||||||
NewPlaceForm,
|
NewPlaceForm,
|
||||||
UploadEventPhotoForm,
|
UploadEventPhotoForm,
|
||||||
NewCommonEventForm
|
NewCommonEventForm
|
||||||
)
|
)
|
||||||
from events import location
|
from events import location
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
@ -56,6 +65,7 @@ def show_event(request, event_id, event_slug):
|
||||||
'comment_form': comment_form,
|
'comment_form': comment_form,
|
||||||
'is_attending': request.user.profile in event.attendees.all(),
|
'is_attending': request.user.profile in event.attendees.all(),
|
||||||
'attendee_list': Attendee.objects.filter(event=event),
|
'attendee_list': Attendee.objects.filter(event=event),
|
||||||
|
'presentation_list': event.presentations.all().order_by('start_time'),
|
||||||
'can_edit_event': request.user.profile.can_edit_event(event),
|
'can_edit_event': request.user.profile.can_edit_event(event),
|
||||||
}
|
}
|
||||||
return render(request, 'get_together/events/show_event.html', context)
|
return render(request, 'get_together/events/show_event.html', context)
|
||||||
|
@ -220,13 +230,6 @@ def add_place_to_series(request, series_id):
|
||||||
else:
|
else:
|
||||||
return redirect('home')
|
return redirect('home')
|
||||||
|
|
||||||
def share_event(request, event_id):
|
|
||||||
event = get_object_or_404(Event, id=event_id)
|
|
||||||
context = {
|
|
||||||
'event': event,
|
|
||||||
}
|
|
||||||
return render(request, 'get_together/events/share_event.html', context)
|
|
||||||
|
|
||||||
def edit_event(request, event_id):
|
def edit_event(request, event_id):
|
||||||
event = get_object_or_404(Event, id=event_id)
|
event = get_object_or_404(Event, id=event_id)
|
||||||
|
|
||||||
|
@ -391,14 +394,6 @@ def create_common_event(request, org_slug):
|
||||||
else:
|
else:
|
||||||
return redirect('home')
|
return redirect('home')
|
||||||
|
|
||||||
def share_common_event(request, event_id):
|
|
||||||
event = get_object_or_404(CommonEvent, id=event_id)
|
|
||||||
context = {
|
|
||||||
'event': event,
|
|
||||||
}
|
|
||||||
return render(request, 'get_together/orgs/share_common_event.html', context)
|
|
||||||
|
|
||||||
@login_required
|
|
||||||
def create_common_event_team_select(request, event_id):
|
def create_common_event_team_select(request, event_id):
|
||||||
teams = request.user.profile.moderating
|
teams = request.user.profile.moderating
|
||||||
if len(teams) == 1:
|
if len(teams) == 1:
|
||||||
|
|
Loading…
Reference in a new issue