mirror of
https://github.com/Rushilwiz/tj2023.git
synced 2025-04-20 12:00:17 -04:00
Merge branch 'master' of github.com:Rushilwiz/tj2023
This commit is contained in:
commit
45cd7dcafa
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -7,7 +7,6 @@ static_files
|
||||||
.idea/
|
.idea/
|
||||||
.vscode/
|
.vscode/
|
||||||
/static
|
/static
|
||||||
migrations/
|
|
||||||
|
|
||||||
# C extensions
|
# C extensions
|
||||||
*.so
|
*.so
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from .models import NotionPage
|
|
||||||
|
|
||||||
# Register your models here.
|
# Register your models here.
|
||||||
admin.site.register(NotionPage)
|
|
|
@ -1,21 +0,0 @@
|
||||||
# Generated by Django 3.1.2 on 2020-10-20 13:48
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
initial = True
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='NotionPage',
|
|
||||||
fields=[
|
|
||||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
||||||
('url', models.URLField(max_length=300)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,19 +1,3 @@
|
||||||
from django.db import models
|
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.
|
# 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,6 @@
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from .models import NotionPage
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from notion.client import NotionClient
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
@ -9,7 +9,8 @@ import time
|
||||||
def meeting_overview(request):
|
def meeting_overview(request):
|
||||||
html = ''
|
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
|
meeting_block = None
|
||||||
for block in page.children:
|
for block in page.children:
|
||||||
|
@ -65,7 +66,8 @@ def show_meeting(request, meeting_id):
|
||||||
|
|
||||||
now = time.time()
|
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
|
meeting = None
|
||||||
for block in page.children:
|
for block in page.children:
|
||||||
|
|
32
pages/migrations/0001_initial.py
Normal file
32
pages/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
# Generated by Django 3.1.2 on 2020-10-22 23:42
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Bar',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('name', models.CharField(max_length=70)),
|
||||||
|
('money_raised', models.FloatField()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Story',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('header', models.CharField(max_length=50)),
|
||||||
|
('img_name', models.CharField(default=None, max_length=50, null=True)),
|
||||||
|
('body', models.TextField(max_length=200)),
|
||||||
|
('created', models.DateTimeField(auto_now=True)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
|
@ -11,7 +11,7 @@
|
||||||
<p class="lead">We are the class to beat!</p>
|
<p class="lead">We are the class to beat!</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="container news mb-5">
|
<div class="container news mb-2">
|
||||||
<h1 class="text-center font-weight-bold">2023 News</h1>
|
<h1 class="text-center font-weight-bold">2023 News</h1>
|
||||||
<br><br>
|
<br><br>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if bar %}
|
{% for bar in bars %}
|
||||||
<div class="container news">
|
<div class="container news">
|
||||||
<h1 class="text-center font-weight-bold">{{ bar.name }}!</h1>
|
<h1 class="text-center font-weight-bold">{{ bar.name }}!</h1>
|
||||||
<br><br>
|
<br><br>
|
||||||
|
@ -55,5 +55,5 @@
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endfor %}
|
||||||
{% endblock content %}
|
{% endblock content %}
|
|
@ -4,21 +4,17 @@ from .models import Story, Bar
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
def index(request):
|
def index(request):
|
||||||
try:
|
stories = Story.objects.all().order_by('-created')[:3]
|
||||||
stories = Story.objects.all().order_by('-created')
|
bar = Bar.objects.all()[:1]
|
||||||
bar = Bar.objects.all()[0]
|
|
||||||
stories = stories[:3]
|
|
||||||
except Exception:
|
|
||||||
stories = []
|
|
||||||
bar = None
|
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
'stories': stories,
|
'stories': stories,
|
||||||
'animate': True,
|
'animate': True,
|
||||||
'bar': bar
|
'bars': bar
|
||||||
}
|
}
|
||||||
|
print(stories)
|
||||||
|
|
||||||
return render(request, 'pages/index.html', context)
|
return render(request, 'pages/index.html', context=context)
|
||||||
|
|
||||||
|
|
||||||
def council(request):
|
def council(request):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user