Skip to content

Commit

Permalink
Updated clean in records
Browse files Browse the repository at this point in the history
  • Loading branch information
sebzur committed Jun 24, 2012
1 parent 9d7d5d2 commit 5efdff5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions extra/themes/grains2/templates/grains2/main.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{% extends "grains2/body.html" %}
{% load synergy_region %}
{% load menu_tags %}

{% block main %}
<div id="sidebar">
<div id="sidebar-inner">
{% secondary_menu user %}
{% region sidebar %}{% endregion %}
</div> <!-- end content -->
</div> <!-- end outer3 -->
Expand Down
6 changes: 5 additions & 1 deletion synergy/contrib/records/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,11 @@ def clean(self):
if f.is_valid():
# m2m forms are empty_permitted, thus we can not be sure if the bool will be
# present in the cleaned data
m2m_count += f.cleaned_data.get("%s_%d" % (f.select._meta.object_name.lower(), f.select.id), False)
if f.has_changed():
m2m_count += f.cleaned_data.get("%s_%d" % (f.select._meta.object_name.lower(), f.select.id), False)
else:
m2m_count += bool(f.initial)


if m2m_model_setup.min_count and m2m_count < m2m_model_setup.min_count:
raise forms.ValidationError(u"Wybrano zbyt mało elementów w %s. Minimalna liczba dopuszczalna %d" % (m2m_model_setup.through.model_class()._meta.verbose_name, m2m_model_setup.min_count))
Expand Down

0 comments on commit 5efdff5

Please sign in to comment.