Merge branch 'k-fet' of git.eleves.ens.fr:cof-geek/gestioCOF into k-fet

This commit is contained in:
Martin Pépin 2016-09-01 01:02:49 +02:00
commit 8c8f57b3e0
14 changed files with 89 additions and 1 deletions

View file

@ -1,3 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from django.shortcuts import render from django.shortcuts import render
from django.http import Http404 from django.http import Http404
from django.db.models import Q from django.db.models import Q

View file

@ -1,3 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
import hashlib import hashlib
from django.contrib.auth.models import User, Permission from django.contrib.auth.models import User, Permission

View file

@ -1,3 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from channels import Group from channels import Group
from channels.generic.websockets import JsonWebsocketConsumer from channels.generic.websockets import JsonWebsocketConsumer

View file

@ -1,3 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from django.contrib.auth.context_processors import PermWrapper from django.contrib.auth.context_processors import PermWrapper
def auth(request): def auth(request):

View file

@ -1,3 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from django_cas_ng.decorators import user_passes_test from django_cas_ng.decorators import user_passes_test
def kfet_is_team(user): def kfet_is_team(user):

View file

@ -1,3 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from decimal import Decimal from decimal import Decimal
from django import forms from django import forms
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError

View file

@ -1,3 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from kfet.backends import KFetBackend from kfet.backends import KFetBackend
class KFetAuthenticationMiddleware(object): class KFetAuthenticationMiddleware(object):

View file

@ -1,3 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from django.db import models from django.db import models
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.core.exceptions import PermissionDenied, ValidationError from django.core.exceptions import PermissionDenied, ValidationError
@ -6,6 +12,7 @@ from django.contrib.auth.models import User
from gestioncof.models import CofProfile from gestioncof.models import CofProfile
from django.utils.six.moves import reduce from django.utils.six.moves import reduce
from django.utils import timezone from django.utils import timezone
from django.utils.encoding import python_2_unicode_compatible
from django.db import transaction from django.db import transaction
from django.db.models import F from django.db.models import F
from django.core.cache import cache from django.core.cache import cache
@ -19,6 +26,7 @@ def default_promo():
now = date.today() now = date.today()
return now.month <= 8 and now.year-1 or now.year return now.month <= 8 and now.year-1 or now.year
@python_2_unicode_compatible
class Account(models.Model): class Account(models.Model):
cofprofile = models.OneToOneField( cofprofile = models.OneToOneField(
CofProfile, on_delete = models.PROTECT, CofProfile, on_delete = models.PROTECT,
@ -217,6 +225,7 @@ class AccountNegative(models.Model):
blank = True, null = True, default = None) blank = True, null = True, default = None)
comment = models.CharField(max_length = 255, blank = True) comment = models.CharField(max_length = 255, blank = True)
@python_2_unicode_compatible
class Checkout(models.Model): class Checkout(models.Model):
created_by = models.ForeignKey( created_by = models.ForeignKey(
Account, on_delete = models.PROTECT, Account, on_delete = models.PROTECT,
@ -248,6 +257,7 @@ class CheckoutTransfer(models.Model):
amount = models.DecimalField( amount = models.DecimalField(
max_digits = 6, decimal_places = 2) max_digits = 6, decimal_places = 2)
@python_2_unicode_compatible
class CheckoutStatement(models.Model): class CheckoutStatement(models.Model):
by = models.ForeignKey( by = models.ForeignKey(
Account, on_delete = models.PROTECT, Account, on_delete = models.PROTECT,
@ -309,12 +319,14 @@ class CheckoutStatement(models.Model):
balance=F('balance') - last_statement.balance_new + self.balance_new) balance=F('balance') - last_statement.balance_new + self.balance_new)
super(CheckoutStatement, self).save(*args, **kwargs) super(CheckoutStatement, self).save(*args, **kwargs)
@python_2_unicode_compatible
class ArticleCategory(models.Model): class ArticleCategory(models.Model):
name = models.CharField(max_length = 45) name = models.CharField(max_length = 45)
def __str__(self): def __str__(self):
return self.name return self.name
@python_2_unicode_compatible
class Article(models.Model): class Article(models.Model):
name = models.CharField(max_length = 45) name = models.CharField(max_length = 45)
is_sold = models.BooleanField(default = True) is_sold = models.BooleanField(default = True)
@ -387,6 +399,7 @@ class InventoryArticle(models.Model):
self.stock_error = self.stock_new - self.stock_old self.stock_error = self.stock_new - self.stock_old
super(InventoryArticle, self).save(*args, **kwargs) super(InventoryArticle, self).save(*args, **kwargs)
@python_2_unicode_compatible
class Supplier(models.Model): class Supplier(models.Model):
articles = models.ManyToManyField( articles = models.ManyToManyField(
Article, Article,

View file

@ -1,3 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from channels.routing import route, route_class from channels.routing import route, route_class
from kfet import consumers from kfet import consumers

View file

@ -1,3 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from django import template from django import template
from django.utils.html import escape from django.utils.html import escape
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
@ -31,4 +37,5 @@ def highlight_clipper(clipper, q):
@register.filter() @register.filter()
def ukf(balance, is_cof): def ukf(balance, is_cof):
grant = is_cof and (1 + Settings.SUBVENTION_COF() / 100) or 1 grant = is_cof and (1 + Settings.SUBVENTION_COF() / 100) or 1
return round(balance * 10 * grant) # float nécessaire car sinon problème avec le round de future.builtins
return round(float(balance * 10 * grant))

View file

@ -1,3 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from django.test import TestCase from django.test import TestCase
# Create your tests here. # Create your tests here.

View file

@ -1,3 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from django.conf.urls import url from django.conf.urls import url
from django.contrib.auth.decorators import permission_required from django.contrib.auth.decorators import permission_required
from kfet import views from kfet import views

View file

@ -1,3 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from django.shortcuts import render, get_object_or_404, redirect from django.shortcuts import render, get_object_or_404, redirect
from django.core.exceptions import PermissionDenied, ValidationError from django.core.exceptions import PermissionDenied, ValidationError
from django.core.cache import cache from django.core.cache import cache

View file

@ -16,3 +16,5 @@ asgiref==0.14.0
daphne==0.14.3 daphne==0.14.3
asgi-redis==0.14.0 asgi-redis==0.14.0
-e git+https://github.com/Aureplop/channels.git#egg=channel -e git+https://github.com/Aureplop/channels.git#egg=channel
statistics==1.0.3.5
future==0.15.2