Skip to content

Commit

Permalink
Fix édition mini-tuto (+typo)
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-24 committed Aug 10, 2014
1 parent 7fc659b commit 0040d02
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion templates/tutorial/tutorial/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ <h2>
Ajouter une partie
</a>
{% else %}
<a href="{% url "zds.tutorial.views.add_extract" %}?chapitre={{ tutorial.get_chapter.pk }}" class="ico-after more blue new-btn">
<a href="{% url "zds.tutorial.views.add_extract" %}?chapitre={{ chapter.pk }}" class="ico-after more blue new-btn">
Ajouter un extrait
</a>
{% endif %}
Expand Down
20 changes: 12 additions & 8 deletions zds/tutorial/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,19 +183,23 @@ def get_prod_path(self):
str(self.pk) + '_' + slugify(data['title']))

def load_dic(self, mandata, sha=None):
'''fill mandata with informations form database model'''
'''fill mandata with informations from database model'''

fns = [u'is_big', u'is_mini', u'have_markdown',u'have_html',
u'have_pdf', u'have_epub', u'get_path']
attrs = [u'pk',u'authors',u'subcategory',u'image',u'pubdate', u'update',
u'source', u'sha_draft', u'sha_beta', u'sha_validation',
u'sha_public']
fns = [
'is_big', 'is_mini', 'have_markdown','have_html', 'have_pdf',
'have_epub', 'get_path'
]

attrs = [
'pk', 'authors', 'subcategory', 'image', 'pubdate', 'update',
'source', 'sha_draft', 'sha_beta', 'sha_validation', 'sha_public'
]

#load functions and attributs in tree
for fn in fns:
mandata[fn]=getattr(self,fn)
mandata[fn] = getattr(self,fn)
for attr in attrs:
mandata[attr]=getattr(self,attr)
mandata[attr] = getattr(self,attr)

# general information
mandata['slug'] = slugify(mandata['title'])
Expand Down
2 changes: 2 additions & 0 deletions zds/tutorial/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,8 @@ def view_tutorial(request, tutorial_pk, tutorial_slug):
chapter = mandata["chapter"]
chapter["path"] = tutorial.get_path()
chapter["type"] = "MINI"
chapter["pk"] = Chapter.objects.get(tutorial=tutorial).pk
#print('pk:',chapter['pk'])
chapter["intro"] = get_blob(repo.commit(sha).tree,
"introduction.md")
chapter["conclu"] = get_blob(repo.commit(sha).tree, "conclusion.md"
Expand Down

0 comments on commit 0040d02

Please sign in to comment.