diff options
author | Alban Gruin | 2017-11-07 20:36:20 +0100 |
---|---|---|
committer | Alban Gruin | 2017-11-07 20:36:20 +0100 |
commit | 111c0fcba0692d175e42258f9aa814de6a2bb1ff (patch) | |
tree | 2f12fe1325e0dfddb26460349b3e0fcf1e9288e8 | |
parent | ffffd9842dbaba0b0e89ff5f434f45792e2b73b6 (diff) | |
parent | 5c2bc37ed5d8353ea0ee1d9e5f852a1f39ac235f (diff) |
Merge branch 'stable/0.11.z' into prod/pa1ch/0.11.zv0.11.1-pa1ch
-rw-r--r-- | __init__.py | 2 | ||||
-rw-r--r-- | models.py | 8 |
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" @@ -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() |