Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
radiopanik
panikdb
Commits
2c449d15
Commit
2c449d15
authored
Apr 07, 2013
by
fred
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use rich text for text fields (via ckeditor); convert spip to html
parent
226902c3
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
1083 additions
and
19 deletions
+1083
-19
panikdb/emissions/management/commands/_spip2html.py
panikdb/emissions/management/commands/_spip2html.py
+1049
-0
panikdb/emissions/management/commands/load-from-spip.py
panikdb/emissions/management/commands/load-from-spip.py
+6
-8
panikdb/emissions/models.py
panikdb/emissions/models.py
+3
-2
panikdb/emissions/templates/emissions/emission_detail.html
panikdb/emissions/templates/emissions/emission_detail.html
+1
-3
panikdb/emissions/templates/emissions/emission_form.html
panikdb/emissions/templates/emissions/emission_form.html
+5
-0
panikdb/emissions/templates/emissions/episode_detail.html
panikdb/emissions/templates/emissions/episode_detail.html
+1
-3
panikdb/emissions/templates/emissions/episode_form.html
panikdb/emissions/templates/emissions/episode_form.html
+5
-0
panikdb/settings.py
panikdb/settings.py
+10
-0
panikdb/templates/panikdb/base.html
panikdb/templates/panikdb/base.html
+0
-2
panikdb/urls.py
panikdb/urls.py
+1
-1
requirements.txt
requirements.txt
+2
-0
No files found.
panikdb/emissions/management/commands/_spip2html.py
0 → 100644
View file @
2c449d15
This diff is collapsed.
Click to expand it.
panikdb/emissions/management/commands/load-from-spip.py
View file @
2c449d15
...
...
@@ -2,12 +2,14 @@ from datetime import datetime
import
gzip
import
xml.etree.ElementTree
as
ET
from
django.core.management.base
import
BaseCommand
,
CommandError
from
panikdb.emissions.models
import
Emission
,
Episode
,
Diffusion
from
_spip2html
import
makeHtmlFromSpip
class
Rubric
(
object
):
def
__init__
(
self
):
self
.
articles
=
{}
...
...
@@ -87,7 +89,7 @@ class Command(BaseCommand):
emission
=
Emission
()
emission
.
slug
=
slug
emission
.
title
=
rubric
.
titre
emission
.
description
=
rubric
.
texte
emission
.
description
=
makeHtmlFromSpip
(
rubric
.
texte
)
emission
.
save
()
for
article
in
rubric
.
articles
.
values
():
...
...
@@ -95,11 +97,7 @@ class Command(BaseCommand):
# date_redac was used for the diffusion date, if it's
# not set it's probably not really an episode
continue
try
:
slug
=
article
.
url
.
lower
()
except
AttributeError
:
print
'no slug for article'
,
article
.
titre
slug
=
article
.
id_article
slug
=
article
.
url
.
lower
()
try
:
episode
=
Episode
.
objects
.
get
(
slug
=
slug
)
except
Episode
.
DoesNotExist
:
...
...
@@ -107,7 +105,7 @@ class Command(BaseCommand):
episode
.
slug
=
slug
episode
.
emission
=
emission
episode
.
title
=
article
.
titre
episode
.
description
=
article
.
texte
episode
.
description
=
makeHtmlFromSpip
(
article
.
texte
)
episode
.
save
()
if
not
Diffusion
.
objects
.
filter
(
episode
=
episode
).
count
():
...
...
panikdb/emissions/models.py
View file @
2c449d15
...
...
@@ -4,12 +4,13 @@ from django.core.urlresolvers import reverse
from
django.db
import
models
from
ckeditor.fields
import
RichTextField
class
Emission
(
models
.
Model
):
title
=
models
.
CharField
(
max_length
=
50
)
slug
=
models
.
SlugField
()
description
=
models
.
TextField
(
null
=
True
)
description
=
Rich
TextField
(
null
=
True
)
first_diffusion
=
models
.
DateTimeField
(
null
=
True
)
# other_diffusions =
...
...
@@ -22,7 +23,7 @@ class Episode(models.Model):
emission
=
models
.
ForeignKey
(
'Emission'
,
verbose_name
=
u
'Emission'
)
title
=
models
.
CharField
(
max_length
=
50
)
slug
=
models
.
SlugField
()
description
=
models
.
TextField
(
null
=
True
)
description
=
Rich
TextField
(
null
=
True
)
def
__unicode__
(
self
):
return
self
.
title
...
...
panikdb/emissions/templates/emissions/emission_detail.html
View file @
2c449d15
...
...
@@ -5,9 +5,7 @@
<h2>
{{ emission.title }}
</h2>
{% if emission.description %}
<p>
{{ emission.description }}
</p>
{{ emission.description|safe }}
{% endif %}
<h3>
Épisodes
</h3>
...
...
panikdb/emissions/templates/emissions/emission_form.html
View file @
2c449d15
{% extends "panikdb/base.html" %}
{% block extrascripts %}
<script
src=
"{{ STATIC_URL }}ckeditor/ckeditor/ckeditor.js"
>
</script>
{% endblock %}
{% block content %}
<form
method=
"post"
>
<div
id=
"form-content"
>
...
...
panikdb/emissions/templates/emissions/episode_detail.html
View file @
2c449d15
...
...
@@ -5,9 +5,7 @@
<h2>
{{ episode.emission.title }} — {{ episode.title }}
</h2>
{% if episode.description %}
<p>
{{ episode.description }}
</p>
{{ episode.description|safe }}
{% endif %}
<h3>
Diffusions
</h3>
...
...
panikdb/emissions/templates/emissions/episode_form.html
View file @
2c449d15
{% extends "panikdb/base.html" %}
{% block extrascripts %}
<script
src=
"{{ STATIC_URL }}ckeditor/ckeditor/ckeditor.js"
>
</script>
{% endblock %}
{% block content %}
<h2>
Nouvel épisode de « {{ emission.title }} »
</h2>
...
...
panikdb/settings.py
View file @
2c449d15
...
...
@@ -66,6 +66,8 @@ STATIC_ROOT = os.path.join(PROJECT_PATH, 'static')
# Example: "http://example.com/static/", "http://static.example.com/"
STATIC_URL
=
'/static/'
CKEDITOR_UPLOAD_PATH
=
os
.
path
.
join
(
MEDIA_ROOT
,
'uploads'
)
# Additional locations of static files
STATICFILES_DIRS
=
(
# Put strings here, like "/home/html/static" or "C:/www/django/static".
...
...
@@ -119,6 +121,7 @@ INSTALLED_APPS = (
'django.contrib.messages'
,
'django.contrib.staticfiles'
,
'django.contrib.admin'
,
'ckeditor'
,
'panikdb.emissions'
,
)
...
...
@@ -151,6 +154,13 @@ LOGGING = {
}
}
CKEDITOR_CONFIGS
=
{
'default'
:
{
'toolbar'
:
'Basic'
,
},
}
try
:
from
local_settings
import
*
except
ImportError
:
...
...
panikdb/templates/panikdb/base.html
View file @
2c449d15
...
...
@@ -8,8 +8,6 @@
<script
src=
"{{ STATIC_URL }}js/jquery.js"
></script>
{% block extrascripts %}
{% endblock %}
<link
href=
"http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css"
rel=
"stylesheet"
type=
"text/css"
/>
<link
href=
'http://fonts.googleapis.com/css?family=Merriweather+Sans:400,300,700'
rel=
'stylesheet'
type=
'text/css'
/>
<link
rel=
"stylesheet"
type=
"text/css"
media=
"all"
href=
"{{ STATIC_URL }}css/style.css"
/>
</head>
<body>
...
...
panikdb/urls.py
View file @
2c449d15
from
django.conf.urls
import
patterns
,
include
,
url
# Uncomment the next two lines to enable the admin:
from
django.contrib
import
admin
admin
.
autodiscover
()
urlpatterns
=
patterns
(
''
,
# url(r'^$', 'panikdb.views.home', name='home'),
(
r
'^ckeditor/'
,
include
(
'ckeditor.urls'
)),
url
(
r
'^panikdb/'
,
include
(
'panikdb.emissions.urls'
)),
url
(
r
'^admin/'
,
include
(
admin
.
site
.
urls
)),
...
...
requirements.txt
0 → 100644
View file @
2c449d15
Django
<1.6
django-ckeditor
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment