diff --git a/Readme.md b/Readme.md index 6d1c31a..325c03b 100644 --- a/Readme.md +++ b/Readme.md @@ -1,6 +1,10 @@ # django-timelinejs3 -## currently in alpha state because it was developed on friday midnight... +## a django app for http://timeline3.knightlab.com/ + +### currently in alpha state because it was developed on friday midnight... + + * clone it * set up your localsettings.py, rename .template and fill diff --git a/django-timelinejs3/urls.py b/django-timelinejs3/urls.py index 460bd0e..44202c0 100644 --- a/django-timelinejs3/urls.py +++ b/django-timelinejs3/urls.py @@ -5,7 +5,9 @@ urlpatterns = [ url(r'^admin/', include(admin.site.urls)), # name = app_(model)_action - url(r'^timeline/$', timeline_views.IndexView.as_view(), name='timeline_index'), + url(r'^timeline/latest$', timeline_views.IndexView.as_view(), name='timeline_index_latest'), + url(r'^timeline/(?P[\d]+)/$', timeline_views.IndexView.as_view(), name='timeline_detail'), - url(r'^timeline/data/$', timeline_views.index_data, name='timeline_index_data'), + url(r'^timeline/data/latest$', timeline_views.index_data, {'timeline_id': 'latest'}, name='timeline_index_data_latest'), + url(r'^timeline/data/(?P[\d]+)/$', timeline_views.index_data, name='timeline_index_data'), ] diff --git a/requirements.txt b/requirements.txt index 44dadbc..c8ed946 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,10 @@ Django==1.8 Jinja2==2.7.3 +Markdown==2.5.2 MarkupSafe==0.23 django-debug-toolbar==1.2.2 django-jinja==1.1.1 +django-model-utils==2.3.1 django-pipeline==1.4.6 django-taggit==0.12.2 futures==2.2.0 diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..c75c5b9 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,32 @@ +{% load static %} + + + + + + timelinejs + + + + + + + + + + + +
+
+ {% block content %}{% endblock content %} +
+ +
+ + + + + + + + diff --git a/templates/index.html b/templates/index.html index 46c71fd..6863e8a 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,77 +1,54 @@ +{% extends 'base.html' %} {% load static %} - - - - - - timelinejs - - - - - - - - - - -
+{% block content %}
-
- - - - - - - - + - - + +{% endblock content %} \ No newline at end of file diff --git a/timeline/admin.py b/timeline/admin.py index bb9aec1..046bc1e 100644 --- a/timeline/admin.py +++ b/timeline/admin.py @@ -15,7 +15,7 @@ class MediaAdmin(admin.ModelAdmin): class TimelineAdmin(admin.ModelAdmin): - fieldsets = [(None, {'fields': ['title', 'slug', 'published', 'options']})] + fieldsets = [(None, {'fields': ['title', 'slug', 'text', 'media', 'published', 'options']})] prepopulated_fields = {'slug': ('title',)} diff --git a/timeline/static/css/main.css b/timeline/static/css/main.css index 4b8544a..4cd8141 100644 --- a/timeline/static/css/main.css +++ b/timeline/static/css/main.css @@ -1,3 +1,4 @@ body { min-height: 80vh; + background-image: url('../images/green_background.jpg'); } \ No newline at end of file diff --git a/timeline/views.py b/timeline/views.py index 5e43fb0..41a83ed 100644 --- a/timeline/views.py +++ b/timeline/views.py @@ -9,10 +9,13 @@ from .models import Timeline, Options -def index_data(request): +def index_data(request, timeline_id): """Gets the last create timeline object and renders json for returning to template. timelinejs3 expects a json file, not able to read directly from json string""" - obj = Timeline.objects.latest('id') + if(timeline_id == 'latest'): + obj = Timeline.objects.latest('id') + else: + obj = get_object_or_404(Timeline, pk=timeline_id) data = { "title": { "media": { @@ -22,7 +25,7 @@ def index_data(request): "thumb": "" }, "text": { - "headline": obj.text and obj.text.timeline or "", + "headline": obj.text and obj.text.headline or "", "text": obj.text and obj.text.text or "" } }, diff --git a/version b/version index 0d91a54..1d0ba9e 100644 --- a/version +++ b/version @@ -1 +1 @@ -0.3.0 +0.4.0