aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--__init__.py2
-rw-r--r--models.py8
2 files changed, 6 insertions, 4 deletions
diff --git a/__init__.py b/__init__.py
index 6a6789b..820bcfa 100644
--- a/__init__.py
+++ b/__init__.py
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with celcatsanitizer. If not, see <http://www.gnu.org/licenses/>.
-VERSION = "0.11.0-pa1ch"
+VERSION = "0.11.1-pa1ch"
__version__ = VERSION
default_app_config = "edt.apps.EdtConfig"
diff --git a/models.py b/models.py
index 3af1c06..0804a38 100644
--- a/models.py
+++ b/models.py
@@ -71,7 +71,7 @@ class Timetable(SlugModel):
class GroupManager(Manager):
def get_parents(self, group):
- groups_criteria = Q(subgroup__isnull=True) | Q(subgroup__startswith=group.subgroup) | \
+ groups_criteria = Q(subgroup="") | Q(subgroup__startswith=group.subgroup) | \
reduce(lambda x, y: x | y,
[Q(subgroup=group.subgroup[:i])
for i in range(1, len(group.subgroup) + 1)])
@@ -99,8 +99,7 @@ class Group(models.Model):
verbose_name="emploi du temps")
mention = models.CharField(max_length=128)
- subgroup = models.CharField(max_length=16, verbose_name="sous-groupe",
- null=True)
+ subgroup = models.CharField(max_length=16, verbose_name="sous-groupe", default="")
slug = models.SlugField(max_length=64, default="")
@@ -129,6 +128,9 @@ class Group(models.Model):
self.slug = slugify(self.name)
self.mention, self.subgroup = parse_group(self.name)
+ if self.subgroup is None:
+ self.subgroup = ""
+
super(Group, self).save()