From 7dc44ec77c6adcf7515f382d439d9a1820085d73 Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Sat, 11 Feb 2017 12:34:20 +0100 Subject: Déplacement de ExtractWeek dans db.py --- db.py | 4 ++++ models.py | 6 +----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/db.py b/db.py index 678225e..80a8c95 100644 --- a/db.py +++ b/db.py @@ -22,6 +22,10 @@ from django.db.models.sql.query import Query from django.db.models.sql.where import WhereNode +class ExtractWeek(Extract): + lookup_name = "week" + + class GroupedCompiler(SQLCompiler): def get_group_by(self, select, order_by): result = super(GroupedCompiler, self).get_group_by(select, order_by) diff --git a/models.py b/models.py index 0d3f2c0..6d395e0 100644 --- a/models.py +++ b/models.py @@ -20,16 +20,12 @@ from django.db.models.expressions import RawSQL from django.db.models.functions import Extract, ExtractYear from django.utils.text import slugify -from .db import GroupedManager +from .db import ExtractWeek, GroupedManager import hashlib import os -class ExtractWeek(Extract): - lookup_name = "week" - - class Timetable(models.Model): name = models.CharField(max_length=64, unique=True, verbose_name="nom") url = models.URLField(max_length=255, unique=True, verbose_name="URL") -- cgit v1.2.1