rebelstuff

Keep track of your stuff
git clone https://git.ce9e.org/rebelstuff.git

commit
31de15c4d146268cbf7ebedcb4e5e774a50a3aac
parent
a022db2cddd7c80b5173392669692620de558067
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2020-02-28 19:14
Revert "add ical feed"

This reverts commit 91ff5fbc0ba2385b41d188a7acc8f5aa15db0f32.

Diffstat

M Makefile 2 +-
M rebelstuff/admin.py 1 -
D rebelstuff/feeds.py 43 -------------------------------------------
M rebelstuff/urls.py 2 --

4 files changed, 1 insertions, 47 deletions


diff --git a/Makefile b/Makefile

@@ -1,7 +1,7 @@
    1     1 .PHONY: all
    2     2 all:
    3     3 	if [ ! -d .venv ]; then python3 -m venv .venv; fi
    4    -1 	.venv/bin/pip install django django-ical
   -1     4 	.venv/bin/pip install django
    5     5 	.venv/bin/python manage.py migrate
    6     6 	.venv/bin/python manage.py compilemessages -l de
    7     7 	.venv/bin/python manage.py loaddata sample_groups sample_data

diff --git a/rebelstuff/admin.py b/rebelstuff/admin.py

@@ -10,7 +10,6 @@ from . import models
   10    10 class Site(admin.AdminSite):
   11    11     site_header = 'RebelStuff'
   12    12     site_title = 'RebelStuff'
   13    -1     site_url = '/ical/?token=' + settings.FEED_TOKEN
   14    13     index_title = _('Home')
   15    14 
   16    15 

diff --git a/rebelstuff/feeds.py b/rebelstuff/feeds.py

@@ -1,43 +0,0 @@
    1    -1 from django.urls import reverse
    2    -1 
    3    -1 from django_ical.views import ICalFeed
    4    -1 
    5    -1 from .models import Booking
    6    -1 
    7    -1 # not perfect, but still helpful
    8    -1 STATUS_MAP = {
    9    -1     'waiting': 'TENTATIVE',
   10    -1     'delivered': 'CONFIRMED',
   11    -1     'returned': 'CANCELLED',
   12    -1 }
   13    -1 
   14    -1 class BookingFeed(ICalFeed):
   15    -1     def items(self):
   16    -1         return Booking.objects.all()
   17    -1 
   18    -1     def item_title(self, booking):
   19    -1         return booking.name
   20    -1 
   21    -1     def item_link(self, booking):
   22    -1         return reverse('admin:rebelstuff_booking_change', args=[booking.id])
   23    -1 
   24    -1     def item_start_datetime(self, booking):
   25    -1         return booking.start
   26    -1 
   27    -1     def item_end_datetime(self, booking):
   28    -1         return booking.end
   29    -1 
   30    -1     def item_status(self, booking):
   31    -1         return STATUS_MAP[booking.status]
   32    -1 
   33    -1     def item_description(self, booking):
   34    -1         description = booking.get_status_display() + '\n'
   35    -1 
   36    -1         if booking.contact:
   37    -1             description += '\n' + booking.contact + '\n'
   38    -1 
   39    -1         for item in booking.bookingitem_set.all():
   40    -1             item_str = '%s: %i' % (item.stuff.name, item.amount)
   41    -1             description += '\n' + item_str
   42    -1 
   43    -1         return description

diff --git a/rebelstuff/urls.py b/rebelstuff/urls.py

@@ -1,9 +1,7 @@
    1     1 from django.urls import path
    2     2 
    3     3 from .admin import site
    4    -1 from .feeds import BookingFeed
    5     4 
    6     5 urlpatterns = [
    7     6     path('', site.urls),
    8    -1     path('ical/', BookingFeed())
    9     7 ]