if verbose:
print "title: %s // %s -->\n %s // %s\nslug: %s / %s -->\n %s / %s" % (
- book.title, chunk.comment,
+ book.title, chunk.title,
new_title, new_chunk_title,
book.slug, chunk.slug,
new_slug, new_chunk_slug)
book.slug = new_slug
book.save()
for j, chunk in enumerate(book):
- chunk.comment = chunk_titles[j]
+ chunk.title = chunk_titles[j]
chunk.slug = chunk_slugs[j]
chunk.save()
('book', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['catalogue.Book'])),
('number', self.gf('django.db.models.fields.IntegerField')()),
('slug', self.gf('django.db.models.fields.SlugField')(max_length=50, db_index=True)),
- ('comment', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)),
+ ('title', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)),
('stage', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['catalogue.ChunkTag'], null=True, blank=True)),
('head', self.gf('django.db.models.fields.related.ForeignKey')(default=None, to=orm['catalogue.ChunkChange'], null=True, blank=True)),
))
'catalogue.chunk': {
'Meta': {'ordering': "['number']", 'unique_together': "[['book', 'number'], ['book', 'slug']]", 'object_name': 'Chunk'},
'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}),
- 'comment': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'created_documents'", 'null': 'True', 'to': "orm['auth.User']"}),
'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ChunkChange']", 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'catalogue.chunk': {
'Meta': {'ordering': "['number']", 'unique_together': "[['book', 'number'], ['book', 'slug']]", 'object_name': 'Chunk'},
'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}),
- 'comment': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'created_documents'", 'null': 'True', 'to': "orm['auth.User']"}),
'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ChunkChange']", 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
if i < book_len:
chunk = instance[i]
chunk.slug = slug
- chunk.comment = title
+ chunk.title = title
chunk.save()
else:
chunk = instance.add(slug, title, creator, adjust_slug=True)
if single:
# special treatment for appending one-parters:
# just use the guessed title and original book slug
- chunk.comment = other_title_part
+ chunk.title = other_title_part
if other.slug.startswith(self.slug):
chunk_slug = other.slug[len(self.slug):].lstrip('-_')
else:
chunk_slug = other.slug
chunk.slug = self.make_chunk_slug(chunk_slug)
else:
- chunk.comment = "%s, %s" % (other_title_part, chunk.comment)
+ chunk.title = "%s, %s" % (other_title_part, chunk.title)
else:
chunk.slug = slugs[i]
- chunk.comment = titles[i]
+ chunk.title = titles[i]
chunk.slug = self.make_chunk_slug(chunk.slug)
chunk.save()
book = models.ForeignKey(Book, editable=False)
number = models.IntegerField()
slug = models.SlugField()
- comment = models.CharField(max_length=255, blank=True)
+ title = models.CharField(max_length=255, blank=True)
class Meta:
unique_together = [['book', 'number'], ['book', 'slug']]
ordering = ['number']
def __unicode__(self):
- return "%d-%d: %s" % (self.book_id, self.number, self.comment)
+ return "%d:%d: %s" % (self.book_id, self.number, self.title)
def get_absolute_url(self):
return reverse("wiki_editor", args=[self.book.slug, self.slug])
def pretty_name(self, book_length=None):
title = self.book.title
- if self.comment:
- title += ", %s" % self.comment
+ if self.title:
+ title += ", %s" % self.title
if book_length > 1:
title += " (%d/%d)" % (self.number, book_length)
return title
- def split(self, slug, comment='', creator=None, adjust_slug=False):
+ def split(self, slug, title='', creator=None, adjust_slug=False):
""" Create an empty chunk after this one """
self.book.chunk_set.filter(number__gt=self.number).update(
number=models.F('number')+1)
new_slug = self.book.make_chunk_slug(slug)
try:
new_chunk = self.book.chunk_set.create(number=self.number+1,
- creator=creator, slug=new_slug, comment=comment)
+ creator=creator, slug=new_slug, title=title)
except IntegrityError:
pass
return new_chunk
<table>
{% for c in chunks %}
<tr class="chunk-{{ c.grade }}">
- <td><a target="_blank" href="{{ c.chunk.get_absolute_url }}">{{ c.chunk.comment }}</a></td>
+ <td><a target="_blank" href="{{ c.chunk.get_absolute_url }}">{{ c.chunk.title }}</a></td>
<td>{% for fix in c.fix %}
{% ifequal fix "wl" %}<span class="fix"
<td><a href="{% url catalogue_chunk_edit book.slug chunk.slug %}">[c]</a></td>
<td><a target="_blank" href="{{ chunk.get_absolute_url }}">
<span class='chunkno'>{{ chunk.number }}.</span>
- {{ chunk.comment }}</a></td>
+ {{ chunk.title }}</a></td>
<td>{% if chunk.stage %}
{{ chunk.stage }}
{% else %}
creator = None
doc.split(creator=creator,
slug=form.cleaned_data['slug'],
- comment=form.cleaned_data['comment'],
+ title=form.cleaned_data['title'],
)
return http.HttpResponseRedirect(doc.book.get_absolute_url())
else:
form = forms.ChunkAddForm(initial={
"slug": str(doc.number + 1),
- "comment": "cz. %d" % (doc.number + 1, ),
+ "title": "cz. %d" % (doc.number + 1, ),
})
return direct_to_template(request, "catalogue/chunk_add.html", extra_context={