-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
kthoden
committed
Aug 19, 2019
0 parents
commit 92d2a23
Showing
14 changed files
with
186 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/eoaforthcoming/migrations/ | ||
/dist/ | ||
/django_eoaforthcoming.egg-info/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Coffeeware |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
include LICENSE | ||
include README.rst | ||
recursive-include eoaforthcoming/static * | ||
recursive-include eoaforthcoming/templates * | ||
recursive-include docs * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
===== | ||
EOA List of Forthcoming books | ||
===== | ||
|
||
EOA Forthcoming is a Django app for displaying forthcoming books of the Edition Open Access. | ||
|
||
Quick start | ||
----------- | ||
|
||
1. Add "eoaforthcoming" to your INSTALLED_APPS setting like this:: | ||
|
||
INSTALLED_APPS = [ | ||
... | ||
'eoaforthcoming', | ||
] | ||
|
||
2. Run `python manage.py migrate` to create the models. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# -*- coding: utf-8; mode: python -*- | ||
|
||
from django.contrib import admin | ||
from .models import Forthcoming | ||
|
||
|
||
# Register your models here: | ||
admin.site.register(Forthcoming) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class EOAForthcomingConfig(AppConfig): | ||
name = 'eoaforthcoming' | ||
verbose_name = 'EOA Forthcoming' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# -*- coding: utf-8; mode: python -*- | ||
from cms.plugin_base import CMSPluginBase | ||
from cms.plugin_pool import plugin_pool | ||
# from django.contrib import admin | ||
from django.conf import settings | ||
|
||
from . import models | ||
|
||
@plugin_pool.register_plugin # register the plugin | ||
class EOAForthcomingList(CMSPluginBase): | ||
model = models.EOAForthcomingListModel | ||
name = "EOA Forthcoming list" | ||
render_template = 'eoaforthcoming/eoa-forthcominglist.html' | ||
allow_children = True | ||
child_classes = ['EOAForthcoming'] | ||
|
||
@plugin_pool.register_plugin # register the plugin | ||
class EOAForthcoming(CMSPluginBase): | ||
model = models.EOAForthcomingModel | ||
name = "EOA Forthcoming" | ||
render_template = 'eoaforthcoming/eoa-forthcoming.html' | ||
require_parent = True | ||
parent_classes = ['EOAForthcomingList'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
from django.db import models | ||
|
||
# Create your models here. | ||
from cms.models import CMSPlugin, Model | ||
|
||
class Forthcoming(Model): | ||
title = models.CharField( | ||
max_length=200, | ||
unique=True | ||
) | ||
series = models.CharField( | ||
max_length=200, | ||
unique=True | ||
) | ||
author = models.CharField( | ||
max_length=200, | ||
unique=True | ||
) | ||
description = models.CharField( | ||
max_length=1000 | ||
) | ||
cover = models.ImageField( | ||
upload_to='eoaforthcoming/images' | ||
) | ||
|
||
# functions: | ||
def __str__(self): | ||
return self.title | ||
|
||
class EOAForthcomingListModel(CMSPlugin): | ||
|
||
# functions: | ||
def __str__(self): | ||
return str(self.id) | ||
|
||
class EOAForthcomingModel(CMSPlugin): | ||
eoaforthcoming = models.ForeignKey( | ||
Forthcoming, on_delete=models.PROTECT | ||
) | ||
|
||
# functions: | ||
def __str__(self): | ||
return self.eoaforthcoming.title | ||
|
||
@property | ||
def layout(self): | ||
instance, plugin_class = self.parent.get_plugin_instance() | ||
return instance.layout | ||
|
||
def copy_relations(self, oldinstance): | ||
# Because we have a ForeignKey, it's required to copy over | ||
# the reference to the referenced instance to the new plugin. | ||
self.eoaforthcoming = oldinstance.eoaforthcoming |
20 changes: 20 additions & 0 deletions
20
eoaforthcoming/templates/eoaforthcoming/eoa-forthcoming.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{% load cms_tags %} | ||
|
||
<div class="project-teaser"> | ||
<div class="project-teaser__image"> | ||
<img src="{{ instance.eoaforthcoming.cover.url }}" data-object-fit="cover"/> | ||
</div> | ||
<div class="project-teaser-info"> | ||
<div class="project-teaser-info__category">{{ instance.eoaforthcoming.series }}</div> | ||
<h2 class="project-teaser-info__title">{{ instance.eoaforthcoming.title }}</h2> | ||
<div class="project-teaser-info__description"> | ||
<div class="expand-block"> | ||
<div class="expand-block__content"> | ||
<p>{{ instance.eoaforthcoming.description }}</p> | ||
</div><a class="expand-block__more link" href="#">More</a> | ||
</div> | ||
</div> | ||
<div class="project-teaser-info-authors"><span class="project-teaser-info__author-link">{{ instance.eoaforthcoming.author}}</span></div> | ||
<div class="project-teaser-info__buttons"> </div> | ||
</div> | ||
</div> |
8 changes: 8 additions & 0 deletions
8
eoaforthcoming/templates/eoaforthcoming/eoa-forthcominglist.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{% load cms_tags %} | ||
|
||
<section class="index__comin-soon"> | ||
<h1>Forthcoming</h1> | ||
{% for plugin in instance.child_plugin_instances %} | ||
{% render_plugin plugin %} | ||
{% endfor %} | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.shortcuts import render | ||
|
||
# Create your views here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# -*- coding: utf-8; mode: python -*- | ||
|
||
import os | ||
from setuptools import find_packages, setup | ||
|
||
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme: | ||
README = readme.read() | ||
|
||
# allow setup.py to be run from any path | ||
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) | ||
|
||
setup( | ||
name='django-eoaforthcoming', | ||
version='1.0', | ||
packages=find_packages(), | ||
include_package_data=True, | ||
license='Coffeeware', # example license | ||
description='A Django app for displaying forthcoming EOA books.', | ||
long_description=README, | ||
url='http://www.edition-open-access.de/', | ||
author='Klaus Thoden', | ||
author_email='kthoden@mpiwg-berlin.mpg.de', | ||
classifiers=[ | ||
'Environment :: Web Environment', | ||
'Framework :: Django', | ||
'Framework :: Django :: 1.8', | ||
'Intended Audience :: Developers', | ||
'License :: OSI Approved :: Coffeeware', | ||
'Operating System :: OS Independent', | ||
'Programming Language :: Python', | ||
'Programming Language :: Python :: 3.5', | ||
'Programming Language :: Python :: 3.6', | ||
'Topic :: Internet :: WWW/HTTP', | ||
'Topic :: Internet :: WWW/HTTP :: Dynamic Content', | ||
], | ||
) |