syncdb is required
This commit is contained in:
Oskar Hahn 2012-07-04 11:00:58 +02:00
parent 03fe1f84dd
commit a72832842b
8 changed files with 30 additions and 30 deletions

View File

@ -25,7 +25,7 @@ class ItemForm(ModelForm, CssClassMixin):
parent = TreeNodeChoiceField(queryset=Item.objects.all(), label=_("Parent item"), required=False)
class Meta:
model = Item
exclude = ('closed', 'weight', 'releated_sid')
exclude = ('closed', 'weight', 'related_sid')
def genweightchoices():

View File

@ -42,27 +42,27 @@ class Item(MPTTModel, SlideMixin):
closed = models.BooleanField(default=False, verbose_name=_("Closed"))
weight = models.IntegerField(default=0, verbose_name=_("Weight"))
parent = TreeForeignKey('self', null=True, blank=True, related_name='children')
releated_sid = models.CharField(null=True, blank=True, max_length=64)
related_sid = models.CharField(null=True, blank=True, max_length=64)
def get_releated_slide(self):
return get_slide_from_sid(self.releated_sid, True)
def get_related_slide(self):
return get_slide_from_sid(self.related_sid, True)
def get_releated_type(self):
return self.get_releated_slide().prefix
def get_related_type(self):
return self.get_related_slide().prefix
def print_releated_type(self):
def print_related_type(self):
"""
Print the type of the releated item.
Print the type of the related item.
For use in Template
??Why does {% trans item.print_releated_type|capfirst %} not work??
??Why does {% trans item.print_related_type|capfirst %} not work??
"""
return _(self.get_releated_type().capitalize())
return _(self.get_related_type().capitalize())
def get_title(self):
if self.releated_sid is None:
if self.related_sid is None:
return self.title
return self.get_releated_slide().get_agenda_title()
return self.get_related_slide().get_agenda_title()
def slide(self):
"""
@ -75,8 +75,8 @@ class Item(MPTTModel, SlideMixin):
'items': self.get_children(),
'template': 'projector/AgendaSummary.html',
}
elif self.releated_sid:
data = self.get_releated_slide().slide()
elif self.related_sid:
data = self.get_related_slide().slide()
else:
data = {
'item': self,
@ -142,12 +142,12 @@ class Item(MPTTModel, SlideMixin):
* delete
"""
if link == 'view':
if self.releated_sid:
return self.get_releated_slide().get_absolute_url(link)
if self.related_sid:
return self.get_related_slide().get_absolute_url(link)
return reverse('item_view', args=[str(self.id)])
if link == 'edit':
if self.releated_sid:
return self.get_releated_slide().get_absolute_url(link)
if self.related_sid:
return self.get_related_slide().get_absolute_url(link)
return reverse('item_edit', args=[str(self.id)])
if link == 'delete':
return reverse('item_delete', args=[str(self.id)])

View File

@ -19,8 +19,8 @@
<div class="dragcell"></div>
{% endif %}
<a href="{{ item.get_absolute_url }}">{{ item }}</a>
{% if item.releated_sid %}
({{ item.print_releated_type }})
{% if item.related_sid %}
({{ item.print_related_type }})
{% endif %}
</td>
{% if perms.agenda.can_manage_agenda %}

View File

@ -32,7 +32,7 @@
{% for p in item.get_ancestors %}
<span class="indentation">&nbsp;</span>
{% endfor %}
<a href="{% model_url item 'view' %}">{{ item }}</a>{% if item.releated_sid %} ({{ item.print_releated_type }}){% endif %}
<a href="{% model_url item 'view' %}">{{ item }}</a>{% if item.related_sid %} ({{ item.print_related_type }}){% endif %}
{% if not item.is_leaf_node %}
<a class="activate_link" href="{% url projector_activate_slide item.sid 'summary' %}"><img src="{% static 'images/icons/view-list-tree.png' %}" title="{% trans 'Activate summary for this item' %}"></a>
{% endif %}

View File

@ -415,7 +415,7 @@ class Application(models.Model, SlideMixin):
'You can not delete it.')
for item in Item.objects.filter(releated_sid=self.sid):
for item in Item.objects.filter(related_sid=self.sid):
item.delete()
super(Application, self).delete()

View File

@ -683,7 +683,7 @@ class CreateAgendaItem(RedirectView):
def pre_redirect(self, request, *args, **kwargs):
self.application = Application.objects.get(pk=kwargs['application_id'])
self.item = Item(releated_sid=self.application.sid)
self.item = Item(related_sid=self.application.sid)
self.item.save()
def get_redirect_url(self, **kwargs):

View File

@ -112,12 +112,12 @@ class Assignment(models.Model, SlideMixin):
def vote_results(self):
"""
returns a table represented as a list with all candidates from all
releated polls and their vote results.
related polls and their vote results.
"""
vote_results_dict = {}
# All polls releated to this assigment
# All polls related to this assigment
polls = self.poll_set.all()
# All PollOption-Objects releated to this assignment
# All PollOption-Objects related to this assignment
options = []
for poll in polls:
options += poll.get_options()
@ -130,13 +130,13 @@ class Assignment(models.Model, SlideMixin):
for poll in polls:
try:
polloption = poll.get_options().get(candidate=candidate)
# candidate is releated to this poll
# candidate is related to this poll
votes = {}
for vote in polloption.get_votes():
votes[vote.value] = vote.get_weight()
vote_results_dict[candidate].append(votes)
except AssignmentOption.DoesNotExist:
# candidate not in releated to this poll
# candidate not in related to this poll
vote_results_dict[candidate].append(None)
return vote_results_dict
@ -145,7 +145,7 @@ class Assignment(models.Model, SlideMixin):
return self.name
def delete(self):
for item in Item.objects.filter(releated_sid=self.sid):
for item in Item.objects.filter(related_sid=self.sid):
item.delete()
super(Assignment, self).delete()

View File

@ -463,7 +463,7 @@ class CreateAgendaItem(RedirectView):
def pre_redirect(self, request, *args, **kwargs):
self.assignment = Assignment.objects.get(pk=kwargs['assignment_id'])
self.item = Item(releated_sid=self.assignment.sid)
self.item = Item(related_sid=self.assignment.sid)
self.item.save()
def get_redirect_url(self, **kwargs):