Archived
1
0
This commit is contained in:
Jeff Becker 2016-11-04 08:45:06 -04:00
parent a7e33a9f10
commit 7f25dcf95c
No known key found for this signature in database
GPG Key ID: AB950234D6EA286B
14 changed files with 86 additions and 4 deletions

View File

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

View File

@ -0,0 +1,5 @@
from django.apps import AppConfig
class FrontendConfig(AppConfig):
name = 'frontend'

View File

@ -0,0 +1,10 @@
from django.db import models
class Attachment(models.Model):
pass
class Post(models.Model):
pass
class Board(models.Model):
pass

View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

View File

@ -0,0 +1,14 @@
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^ctl-(?P<page>[0-9])\.html$', views.modlog, name='old-modlog'),
url(r'^ctl/((?P<page>[0-9])/)?$', views.modlog, name='modlog'),
url(r'^overchan\.(?P<name>[a-zA-z0-9\.]+)-(?P<page>[0-9])\.html$', views.boardpage, name='old-board'),
url(r'^(?P<name>[a-zA-z0-9\.]+)/((?P<page>[0-9])/)?$', views.boardpage, name='board'),
url(r'^thread-(?P<op>[a-fA-F0-9\.]{40})\.html$', views.threadpage, name='old-thread'),
url(r'^t/(?P<op>[a-fA-F0-9\.]{40})\.html$', views.redirect_thread, name='redirect-thread'),
url(r'^t/(?P<op>[a-fA-F0-9\.]{40})/$', views.threadpage, name='thread'),
url(r'^$', views.frontpage, name='index'),
]

View File

@ -0,0 +1,34 @@
from django.http import HttpResponse
from django.shortcuts import render
from django.views import generic
from .models import Post, Board
class IndexView(generic.DetailView):
template_name = 'frontend/index.html'
class BoardView(generic.ListView):
template_name = 'frontend/board.html'
class ThreadView(generic.ListView):
template_name = 'frontend/thread.html'
def frontpage(request):
return HttpResponse('ayyyy')
def boardpage(request, name, page):
if page is None:
page = 0
name = 'overchan.{}'.format(name)
return HttpResponse('{} page {}'.format(name, page))
def threadpage(request, op):
return HttpResponse('thread {}'.format(op))
def redirect_thread(request, op):
pass
def modlog(request, page):
if page is None:
page = 0
return HttpResponse('mod log page {}'.format(page))

View File

@ -31,6 +31,7 @@ ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'nntpchan.frontend.apps.FrontendConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',

View File

@ -13,9 +13,8 @@ Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url
from django.contrib import admin
from django.conf.urls import url, include
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^nntpchan/', include('nntpchan.frontend.urls'))
]

View File

@ -0,0 +1,4 @@
from django.http import HttpResponse
def index(request):
return HttpResponse('ayyyyy')

View File

@ -1,4 +1,8 @@
#!/usr/bin/env python3
#
# entry point for c++ frontend
#
from nntpchan import message
from nntpchan import db
import logging

View File

@ -1 +1,6 @@
#
# entry for gunicorn
#
from nntpchan.app import app
from nntpchan import viewsp

View File

@ -17,7 +17,7 @@ onready(function(){
var e = document.getElementById("captcha_img");
if (e) {
e.onclick = function() {
reload(document.getElementById("captcha_img"));
reload(e);
};
}
});