Compare commits
3 Commits
9534763621
...
409ad95c05
Author | SHA1 | Date | |
---|---|---|---|
409ad95c05 | |||
df9066e066 | |||
17f3c5608e |
@ -5,6 +5,9 @@
|
||||
<title>
|
||||
Tas [] & Van Canto - {{ title }}
|
||||
</title>
|
||||
<!--<script type="text/javascript">
|
||||
document.body.textContent = 'Please disable JavaScript to view this site.'
|
||||
</script>Need to add a timer to remove it first. I'm not *that* mean. Credit: https://soc.punktrash.club/objects/bfe4fc29-96d5-4f90-9f9e-4092e7c273a4-->
|
||||
</head>
|
||||
<body>
|
||||
{{ nav }}
|
||||
|
@ -10,7 +10,6 @@ urlpatterns=[
|
||||
path('comment',views.comment,name='shoutbox'),
|
||||
path('specs',views.specs,name='specs'),
|
||||
path('songs',views.songs,name='songs'),
|
||||
path('nerdshope',views.nerdshope,name='shop'),
|
||||
path('teapot',views.teapot,name='teapot'),
|
||||
path('toask',views.articles,name='articles'),
|
||||
path('r/<redirect:src>',views.redirect,name='redirect'),
|
||||
|
@ -4,7 +4,7 @@ syntax,/syntax,Syntaxer,2
|
||||
todo,/todos,Todos,0
|
||||
pics,/pics,Pics,2
|
||||
wargame,https://gitlab.com/zergling-man/Wargamer,Wargamer,0
|
||||
rinbot,/r/rinbot,Rinbot,0
|
||||
rinbot,/r/rinbot,Rinbot,2
|
||||
survey,/emojisurvey.php,Survey,2
|
||||
myroids,/myroids,Myroids,0
|
||||
bot,/bot,Bot chat,2
|
||||
|
@ -58,10 +58,6 @@ def songs():
|
||||
out='This is the full list of songs that can appear on the home page.<br/>'+'<br/>\n'.join([f'<a href="https://invidious.ethibox.fr/watch?v={idd}">https://invidious.ethibox.fr/watch?v={idd}</a>' for idd in ids])
|
||||
return {'title':'Songs','content':out,'date':'2021/05/06'}
|
||||
|
||||
@rerender
|
||||
def nerdshope():
|
||||
return {'title':"Nerds' Hope",'content':"Store stuff. TODO. Will include inventory and budget. <a href='https://facebook.com/nerdshope'>FB</a><br/>Address is 21 Kensington St, Glenorchy<br/>Off dates 2022: 29th April, 6th May, 27th May, 17th June, 24th June<br/>The store is open today (Apr 15th) but the carpark is closed. Pedestrian access possible.",'date':'2022/04/15'}
|
||||
|
||||
def teapot(req):
|
||||
return HttpResponse("You're probably missing the joke.",status=418)
|
||||
|
||||
@ -77,9 +73,15 @@ def articles():
|
||||
def redirect(req,src):
|
||||
return HttpResponse(status=302,headers={'Location':src.output})
|
||||
|
||||
@rerender
|
||||
def mdhelp():
|
||||
return {'title':'How2MD RSS','date':'2022/05/27','content':"This is an <a href='https://en.wikipedia.org/wiki/RSS'>RSS</a> service for <a href='https://mangadex.org'>Mangadex</a>, since they had one in v3 that I made liberal use of, and I've heard nothing regarding its return in v5.<br/>If you've never used RSS before, I strongly recommend starting, as it's the second-best update notification system in existence (and it could be built on #1, push notifications, but that's an another topic).<br/>You will need an RSS reader program, but your browser probably has one built in, so you can just use that. (I don't recommend it, because you should be closing the browser more, not less.)<br/>The important part of an RSS feed is a source URL. If properly configured, that should provide everything else. In this case, you've already found the source URL... Kinda. You need to pass a manga ID (or several) to make it work. A manga ID looks like this: ed996855-70de-449f-bba2-e8e24224c14d (yes, that's a UUID4). If you go to a manga's page on Mangadex, you should see something like it in the URL bar at the top. I think Tachiyomi has some way to grab it, but I also think Tachi's update notifs are better than mine, so if you have that you don't need this.<br/>Once you have the ID(s), you should palm them into this page like this: <a href='/md.rss?ids=ed996855-70de-449f-bba2-e8e24224c14d'>https://rakka.tk/md.rss?ids=ed996855-70de-449f-bba2-e8e24224c14d</a>. Take that and give it to your RSS reader as a new feed and it should handle the rest (did your browser ask you a new question when you clicked it?). If you want more IDs, put an & and do it again: <a href='/md.rss?ids=ed996855-70de-449f-bba2-e8e24224c14d&ids=/d032cdeb-1ced-4031-8b9e-45e6064c1781'>https://rakka.tk/md.rss?ids=ed996855-70de-449f-bba2-e8e24224c14d&ids=d032cdeb-1ced-4031-8b9e-45e6064c1781</a>.<br/>It behaves a bit differently with 1 ID vs multiple, but it should work alright both ways. Personally I prefer making one feed for each series."}
|
||||
|
||||
def md(req):
|
||||
ids=req.GET.getlist('ids','')
|
||||
if not ids: return mdhelp(req)
|
||||
loop=asyncio.get_event_loop()
|
||||
feed=loop.run_until_complete(mdl.makefeed(req.GET.getlist('ids','')))
|
||||
feed=loop.run_until_complete(mdl.makefeed(ids))
|
||||
return HttpResponse(feed, content_type='application/rss+xml')
|
||||
|
||||
def vcard(req):
|
||||
@ -97,4 +99,4 @@ END:VCARD""")
|
||||
|
||||
@rerender
|
||||
def autopage(page):
|
||||
return {'title':page.title,'content':page.contents,'date':page.last_edited}
|
||||
return {'title':page.title,'content':page.contents,'date':page.last_edited}
|
0
nerdshope/__init__.py
Normal file
0
nerdshope/__init__.py
Normal file
8
nerdshope/admin.py
Normal file
8
nerdshope/admin.py
Normal file
@ -0,0 +1,8 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
|
||||
from .models import BankAccount,Payment,OffDate
|
||||
admin.site.register(BankAccount)
|
||||
admin.site.register(Payment)
|
||||
admin.site.register(OffDate)
|
6
nerdshope/apps.py
Normal file
6
nerdshope/apps.py
Normal file
@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class NerdshopeConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'nerdshope'
|
30
nerdshope/models.py
Normal file
30
nerdshope/models.py
Normal file
@ -0,0 +1,30 @@
|
||||
from django.db import models
|
||||
from django.utils.timezone import now
|
||||
|
||||
# Create your models here.
|
||||
class BankAccount(models.Model):
|
||||
name=models.CharField(max_length=100)
|
||||
physical=models.CharField(max_length=100)
|
||||
currency=models.CharField(max_length=5)
|
||||
@property
|
||||
def balance(self): return sum(map(Payment.objects.filter(account=self)))
|
||||
|
||||
def __str__(self):
|
||||
return str(self.name)+', '+str(self.balance)
|
||||
|
||||
class Payment(models.Model):
|
||||
timestamp=models.DateTimeField(default=now)
|
||||
other_party=models.CharField(max_length=100)
|
||||
account=models.ForeignKey(BankAccount, on_delete=models.CASCADE)
|
||||
amount=models.IntegerField(default=0)
|
||||
reason=models.CharField(max_length=200)
|
||||
|
||||
def __str__(self):
|
||||
return str(self.timestamp)+', '+str(self.amount)+', '+str(self.reason)
|
||||
|
||||
class OffDate(models.Model):
|
||||
when=models.DateField(default=now)
|
||||
reason=models.CharField(max_length=50,default="Hall unavailable")
|
||||
|
||||
def __str__(self):
|
||||
return str(str.when)+': '+str(self.reason)
|
3
nerdshope/tests.py
Normal file
3
nerdshope/tests.py
Normal file
@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
6
nerdshope/urls.py
Normal file
6
nerdshope/urls.py
Normal file
@ -0,0 +1,6 @@
|
||||
from django.urls import include, path
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path('',views.nerdshope,name='shop'),
|
||||
]
|
16
nerdshope/views.py
Normal file
16
nerdshope/views.py
Normal file
@ -0,0 +1,16 @@
|
||||
from django.shortcuts import render
|
||||
from rakka.utils import rerender
|
||||
from . import models
|
||||
from main.models import Update
|
||||
|
||||
@rerender
|
||||
def nerdshope():
|
||||
accounts=models.BankAccount.objects.all()
|
||||
sums={curr:sum([n.balance for n in filter(lambda x:x.currency==curr,accounts)]) for curr in set(map(lambda x:x.currency,accounts))}
|
||||
moneyblob='</li>\n<li>'.join([f'{k}: {v}' for k,v in sums.items()])
|
||||
moneyblob='Current monetary state: <ul>\n<li>'+moneyblob+'</li>\n</ul>'
|
||||
return {'title':"Nerds' Hope",'content':"Store stuff. TODOing. Will include inventory and budget. <a href='https://facebook.com/nerdshope'>FB</a><br/>\nAddress is 21 Kensington St, Glenorchy<br/>\nOff dates 2022: 29th April, 6th May, 27th May, 17th June, 24th June<br/>\n"+moneyblob,'date':Update.objects.get_or_create(page='nh_main')[0].date}
|
||||
|
||||
@rerender
|
||||
def budget():
|
||||
pass
|
@ -35,6 +35,7 @@ ALLOWED_HOSTS = [n.strip() for n in conf['ALLOWED_HOSTS'].split(',')]
|
||||
INSTALLED_APPS = [
|
||||
'main.apps.MainConfig',
|
||||
'books.apps.BooksConfig',
|
||||
'nerdshope.apps.NerdshopeConfig',
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
|
@ -21,5 +21,6 @@ urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('books/',include('books.urls')),
|
||||
path('comment/',include('comment.urls')),
|
||||
path('nerdshope/',include('nerdshope.urls')),
|
||||
path('', include('main.urls')),
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user