mirror of
https://github.com/Rushilwiz/tj2023.git
synced 2025-04-10 23:30:17 -04:00
removed need for models
This commit is contained in:
parent
680d7786cf
commit
b7e8c66c02
|
@ -1,19 +1,3 @@
|
|||
from django.db import models
|
||||
from django.conf import settings
|
||||
from notion.client import NotionClient
|
||||
|
||||
client = NotionClient(token_v2=settings.NOTION_COOKIE)
|
||||
|
||||
|
||||
# Create your models here.
|
||||
class NotionPage(models.Model):
|
||||
url = models.URLField(max_length=300)
|
||||
page = None
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(NotionPage, self).__init__(*args, **kwargs)
|
||||
if self.url:
|
||||
self.page = client.get_block(self.url)
|
||||
|
||||
def __str__(self):
|
||||
return str(self.page and self.page.title)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from django.shortcuts import render
|
||||
from .models import NotionPage
|
||||
from django.conf import settings
|
||||
from notion.client import NotionClient
|
||||
|
||||
import time
|
||||
|
||||
|
@ -9,7 +10,8 @@ import time
|
|||
def meeting_overview(request):
|
||||
html = ''
|
||||
|
||||
page = NotionPage.objects.get(url=settings.NOTION_URL).page
|
||||
client = NotionClient(token_v2=settings.NOTION_COOKIE)
|
||||
page = client.get_block(settings.NOTION_URL)
|
||||
|
||||
meeting_block = None
|
||||
for block in page.children:
|
||||
|
@ -65,7 +67,8 @@ def show_meeting(request, meeting_id):
|
|||
|
||||
now = time.time()
|
||||
|
||||
page = NotionPage.objects.get(url=settings.NOTION_URL).page
|
||||
client = NotionClient(token_v2=settings.NOTION_COOKIE)
|
||||
page = client.get_block(settings.NOTION_URL)
|
||||
|
||||
meeting = None
|
||||
for block in page.children:
|
||||
|
|
Loading…
Reference in New Issue
Block a user