# Path: happenings/models.py
# class Update(models.Model):
#     """
#     Allows updating the event in near real-time, with blog-style content updates.
#     """
#     event = models.ForeignKey(
#         Event,
#         on_delete=models.CASCADE,
#         limit_choices_to={'featured': True},
#         db_index=True
#     )
#     title = models.CharField("Update title", max_length=200)
#     author = models.ForeignKey(
#         UserModel,
#         on_delete=models.CASCADE,
#         limit_choices_to={'is_staff': True})
#     update = models.TextField()
#     update_formatted = models.TextField(blank=True, editable=False)
#     pub_time = models.DateTimeField(auto_now_add=True)
#     last_updated = models.DateTimeField(auto_now=True)
#     audio = models.FileField(
#         upload_to='audio/events/special/',
#         blank=True,
#         null=True,
#         help_text="Should be MP3 format"
#     )
# 
#     def __str__(self):
#         return self.title
# 
#     def get_absolute_url(self):
#         return reverse('event_update_detail', args=[str(self.event.slug), str(self.id)])
# 
#     def save(self, *args, **kwargs):
#         self.update_formatted = sanetize_text(self.update)
#         super(Update, self).save(*args, **kwargs)
# 
#     @cached_property
#     def comments_open(self):
#         """
#         Based on the update's event's comments open status
#         """
#         return self.event.comments_open
# 
#     def has_image(self):
#         if self.updateimage_set.count():
#             return True
# 
#     def get_image(self):
#         return self.updateimage_set.latest('id')
# 
#     def get_gallery_url(self):
#         return reverse('update_slides', args=[self.event.slug, str(self.id)])
# 
#     def get_top_assets(self):
#         return self.updateimage_set.all()
# 
# Path: happenings/views.py
# class EventList(ListView):
# class EventsForPeriod(EventList):
# class EventDetail(DetailView):
# class EventUpdate(DetailView):
# class ExtraInfoDetail(EventUpdate):
# class EditEvent(UpdateView):
# class AddRecap(EditEvent):
# class MemoryDetail(DetailView):
#     def get_queryset(self):
#     def get_context_data(self, **kwargs):
#     def get_queryset(self, *args, **kwargs):
#     def get_context_data(self, **kwargs):
#     def get_context_data(self, **kwargs):
#     def dispatch(self, request, *args, **kwargs):
#     def get_context_data(self, **kwargs):
#     def get_object(self):
#     def get_object(self):
# def create_ical(request, slug):
# def event_all_comments_list(request, slug):
# def event_update_list(request, slug):
# def video_list(request, slug):
# def add_event(request):
#     def dispatch(self, *args, **kwargs):
#     def get_context_data(self, **kwargs):
# def add_attending(request, slug):
# def add_memory(request, slug):
#     def dispatch(self, request, *args, **kwargs):
#     def get_context_data(self, **kwargs):
#     def get_object(self):
# def process_upload(upload_file, instance, form, event, request):


from django.urls import path, re_path
from django.views.generic import DetailView
from .models import Update
from .views import add_event, edit_event, add_recap, create_ical, \
    event_list, event_detail, events_period, \
    event_update, memory_detail, extrainfo_detail, event_update_list, \
    video_list, event_all_comments_list, add_attending, add_memory



# CRUD and admin functions
urlpatterns = [
    # FORMS
    path('add/', add_event, name="add_event"),
    path('<slug:slug>/edit-event/', edit_event, name="edit-event"),
    path('<slug:slug>/add-recap/', add_recap, name="add_recap"),

    # EVENT LISTS
    path('', event_list, name="events_index"),

# Path: happenings/models.py
# class Update(models.Model):
#     """
#     Allows updating the event in near real-time, with blog-style content updates.
#     """
#     event = models.ForeignKey(
#         Event,
#         on_delete=models.CASCADE,
#         limit_choices_to={'featured': True},
#         db_index=True
#     )
#     title = models.CharField("Update title", max_length=200)
#     author = models.ForeignKey(
#         UserModel,
#         on_delete=models.CASCADE,
#         limit_choices_to={'is_staff': True})
#     update = models.TextField()
#     update_formatted = models.TextField(blank=True, editable=False)
#     pub_time = models.DateTimeField(auto_now_add=True)
#     last_updated = models.DateTimeField(auto_now=True)
#     audio = models.FileField(
#         upload_to='audio/events/special/',
#         blank=True,
#         null=True,
#         help_text="Should be MP3 format"
#     )
# 
#     def __str__(self):
#         return self.title
# 
#     def get_absolute_url(self):
#         return reverse('event_update_detail', args=[str(self.event.slug), str(self.id)])
# 
#     def save(self, *args, **kwargs):
#         self.update_formatted = sanetize_text(self.update)
#         super(Update, self).save(*args, **kwargs)
# 
#     @cached_property
#     def comments_open(self):
#         """
#         Based on the update's event's comments open status
#         """
#         return self.event.comments_open
# 
#     def has_image(self):
#         if self.updateimage_set.count():
#             return True
# 
#     def get_image(self):
#         return self.updateimage_set.latest('id')
# 
#     def get_gallery_url(self):
#         return reverse('update_slides', args=[self.event.slug, str(self.id)])
# 
#     def get_top_assets(self):
#         return self.updateimage_set.all()
# 
# Path: happenings/views.py
# class EventList(ListView):
# class EventsForPeriod(EventList):
# class EventDetail(DetailView):
# class EventUpdate(DetailView):
# class ExtraInfoDetail(EventUpdate):
# class EditEvent(UpdateView):
# class AddRecap(EditEvent):
# class MemoryDetail(DetailView):
#     def get_queryset(self):
#     def get_context_data(self, **kwargs):
#     def get_queryset(self, *args, **kwargs):
#     def get_context_data(self, **kwargs):
#     def get_context_data(self, **kwargs):
#     def dispatch(self, request, *args, **kwargs):
#     def get_context_data(self, **kwargs):
#     def get_object(self):
#     def get_object(self):
# def create_ical(request, slug):
# def event_all_comments_list(request, slug):
# def event_update_list(request, slug):
# def video_list(request, slug):
# def add_event(request):
#     def dispatch(self, *args, **kwargs):
#     def get_context_data(self, **kwargs):
# def add_attending(request, slug):
# def add_memory(request, slug):
#     def dispatch(self, request, *args, **kwargs):
#     def get_context_data(self, **kwargs):
#     def get_object(self):
# def process_upload(upload_file, instance, form, event, request):


# Path: happenings/urls.py
from django.urls import path, re_path
from django.views.generic import DetailView
from .models import Update
from .views import add_event, edit_event, add_recap, create_ical, \
    event_list, event_detail, events_period, \
    event_update, memory_detail, extrainfo_detail, event_update_list, \
    video_list, event_all_comments_list, add_attending, add_memory




# CRUD and admin functions
urlpatterns = [
    # FORMS
    path('add/', add_event, name="add_event"),
    path('<slug:slug>/edit-event/', edit_event, name="edit-event"),
    path('<slug:slug>/add-recap/', add_recap, name="add_recap"),

    # EVENT LISTS
    path('', event_list, name="events_index"),

    path('by-region/<slug:region>/', event_list, name="events_by_region"),