Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
first view
  • Loading branch information
mvogl committed Jul 26, 2017
1 parent 6ec68ca commit 1223c39
Show file tree
Hide file tree
Showing 12 changed files with 108 additions and 121 deletions.
2 changes: 1 addition & 1 deletion eoa/models.py
Expand Up @@ -76,7 +76,7 @@ class Publication(models.Model):
publisher = models.CharField(**default_char)
title = models.CharField(**default_char)
subtitle = models.CharField(**default_char)
description = models.TextField(blank=True,null=True,default=None)
description = models.TextField(blank=True)
pages = models.PositiveIntegerField()
price = models.FloatField()
created_date = models.DateField(
Expand Down
5 changes: 0 additions & 5 deletions eoa/tests.py
Expand Up @@ -78,15 +78,10 @@ def test_string_output(self):

def test_add_publications(self):
pub1 = Publication.objects.get(publication_id=4)
pub1.save()
aut1 = Author.objects.get(email='test@test.ert')
aut1.save()
aut2 = Author.objects.get(email='more@test.ert')
aut2.save()
aut1.publications.add(pub1)
aut1.save()
aut2.publications.add(pub1)
aut2.save()
self.assertEqual(aut1.publications.get(pk=pub1.pk),pub1)
autList = [a.__str__() for a in pub1.authors.all()]
self.assertEqual(sorted(autList),[a.__str__() for a in [aut2,aut1]])
Expand Down
4 changes: 2 additions & 2 deletions eoasite/settings.py
Expand Up @@ -72,12 +72,12 @@
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'sekizai.context_processors.sekizai',
'cms.context_processors.cms_settings',
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'sekizai.context_processors.sekizai',
'cms.context_processors.cms_settings',
],
},
},
Expand Down
7 changes: 5 additions & 2 deletions eoasite/settings_local.py
Expand Up @@ -72,12 +72,12 @@
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'sekizai.context_processors.sekizai',
'cms.context_processors.cms_settings',
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'sekizai.context_processors.sekizai',
'cms.context_processors.cms_settings',
],
},
},
Expand All @@ -97,6 +97,9 @@
'PASSWORD': 'dev',
'HOST': 'localhost',
'PORT': '5432',
'TEST': {
'NAME': 'db_test',
},
},
}

Expand Down
6 changes: 5 additions & 1 deletion eoasite/urls.py
Expand Up @@ -22,4 +22,8 @@
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^publications/', include('publications.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
]

if settings.DEBUG:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Empty file added media/__init__.py
Empty file.
2 changes: 0 additions & 2 deletions publications/templates/publications/base.html
Expand Up @@ -14,7 +14,6 @@
<meta http-equiv="pragma" content="no-cache">
<meta name="GOOGLEBOT" content="NOARCHIVE">
<meta name="robots" content="index,follow,noodp">
{% render_block "css" %}
{% block metatags %}
{% endblock %}
<!-- Bootstrap general configuration -->
Expand Down Expand Up @@ -237,7 +236,6 @@
<div class="row">
{% placeholder base_content %}
{% block base_content %}{% endblock %}
{% render_block "js" %}

</div>

Expand Down
74 changes: 32 additions & 42 deletions publications/templates/publications/index.html
@@ -1,42 +1,32 @@
{% extends "publications/publication_base.html" %}
{% block below %}

<div class="navbar">
<div class="navbar-inner">
<ul class="nav nav-tabs">
<li class="active"><a href="index.html">Description</a></li>
<li role="presentation" role="presentation"><a href="toc.html">Table of Contents</a></li>
{% if Keywordindex == "Yes" %}
<li role="presentation"><a href="listindex.html">Index</a></li>
{% endif %}
{% if Personindex == "Yes" %}
<li role="presentation"><a href="listpersonindex.html">Index of Names</a></li>
{% endif %}
{% if Locationindex == "Yes" %}
<li role="presentation"><a href="listlocationindex.html">Index of Locations</a></li>
{% endif %}
{% if Reviews == "Yes" %}
<li role="presentation"><a href="reviews.html">Reviews</a></li>
{% endif %}
{% if Reports == "Yes" %}
<li role="presentation"><a href="reports.html">Reports</a></li>
{% endif %}


</ul>
</div>
</div>

<p style="text-align: justify">{{ Publication }}</p>



{% if Publication.Additionalinfo %}

<div class="col-md-10 offset1">
{{ Publication.Additionalinfo|safe }}
</div>

{% endif %}

{% endblock %}
{% load staticfiles %}

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">
<head>
<title>Publication test</title>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
<link href='//fonts.googleapis.com/css?family=Lobster&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="{% static 'css/eoa.css' %}">
</head>
<body>
<div class="page-header">
<h1><a href="/">Publication</a></h1>
</div>

<div class="content container">
<div class="row">
<div class="col-md-8">
<div class="post">
<h1>{{ publication }}</h1>
<p>
{% for author in publication.authors.all %}
{{ author }}
{% endfor %}
</p>
</div>
</div>
</div>
</div>
</body>
</html>
42 changes: 42 additions & 0 deletions publications/templates/publications/index_old.html
@@ -0,0 +1,42 @@
{% extends "publications/publication_base.html" %}
{% block below %}

<div class="navbar">
<div class="navbar-inner">
<ul class="nav nav-tabs">
<li class="active"><a href="index.html">Description</a></li>
<li role="presentation" role="presentation"><a href="toc.html">Table of Contents</a></li>
{% if Keywordindex == "Yes" %}
<li role="presentation"><a href="listindex.html">Index</a></li>
{% endif %}
{% if Personindex == "Yes" %}
<li role="presentation"><a href="listpersonindex.html">Index of Names</a></li>
{% endif %}
{% if Locationindex == "Yes" %}
<li role="presentation"><a href="listlocationindex.html">Index of Locations</a></li>
{% endif %}
{% if Reviews == "Yes" %}
<li role="presentation"><a href="reviews.html">Reviews</a></li>
{% endif %}
{% if Reports == "Yes" %}
<li role="presentation"><a href="reports.html">Reports</a></li>
{% endif %}


</ul>
</div>
</div>

<p style="text-align: justify">{{ Publication }}</p>



{% if Publication.Additionalinfo %}

<div class="col-md-10 offset1">
{{ Publication.Additionalinfo|safe }}
</div>

{% endif %}

{% endblock %}
32 changes: 0 additions & 32 deletions publications/templates/publications/index_simple.html

This file was deleted.

43 changes: 9 additions & 34 deletions publications/views.py
@@ -1,7 +1,8 @@
from django.shortcuts import render
from django.template import loader
from django.shortcuts import render_to_response
from django.template import loader, RequestContext
from django.http import HttpResponse, Http404
from sekizai.context import SekizaiContext as Context
#from sekizai.context import SekizaiContext as Context

from eoa.models import *

Expand All @@ -16,36 +17,10 @@ def allpublications(request):
return render(request, 'publications/index.html',{'publications': currentpublications})

def publication(request,serie,number):
template = loader.get_template('publications/index.html')
currentpublication = Publication.objects.get(series=serie,publication_id=number)
#return render(request,'publications/index.html',{'publications': currentpublications})
#listofchapters = currentpublication.chapter.all().order_by('Order')
#Indexsection.objects.filter(Publication=Currentpublication.pk)
# Check if there are Indexsection-Objects for this Publication
#Keywordindex = "No"
#if len(Indexsection.objects.filter(Publication=Currentpublication.pk,Kind="keyword")) > 0:
# Keywordindex = "Yes"
# Personindex = "No"
# if len(Indexsection.objects.filter(Publication=Currentpublication.pk,Kind="person")) > 0:
# Personindex = "Yes"
# Locationindex = "No"
# if len(Indexsection.objects.filter(Publication=Currentpublication.pk,Kind="location")) > 0:
# Locationindex = "Yes"
# Reviews = "No"
# if len(Review.objects.filter(Publication=Currentpublication.pk)) > 0:
# Reviews = "Yes"
# Reports = "No"
# if len(Report.objects.filter(Publication=Currentpublication.pk)) > 0:
# Reports = "Yes"
Content = Context ({
'Style' : templateStyle(serie),
#'Listofchapters' : listofchapters,
'Publication' : currentpublication,
'Highlight' : serie,
'Keywordindex' : "No",
'Personindex' : "No",
'Locationindex' : "No",
'Reviews' : "No",
'Reports' : "No",
})
return HttpResponse(template.render(Content))
listofchapters = Chapter.objects.get(publication=currentpublication)
Content = {
'listofchapters' : listofchapters,
'publication' : currentpublication,
}
return render(request,'publications/index.html',Content)
12 changes: 12 additions & 0 deletions scripts/run_local.sh
@@ -0,0 +1,12 @@
#!/bin/bash
# Migrate database
python manage.py makemigrations eoa --settings=eoasite.settings_local
python manage.py migrate eoa --settings=eoasite.settings_local
python manage.py makemigrations --settings=eoasite.settings_local
python manage.py migrate --settings=eoasite.settings_local

# Import Bärnighausen file
python manage.py tei_import -f baernighausen.xml --settings=eoasite.settings_local

# Start server
python manage.py runserver 0.0.0.0:8000 --settings=eoasite.settings_local

0 comments on commit 1223c39

Please sign in to comment.