mirror of https://gitlab.federez.net/re2o/re2o
19 changed files with 458 additions and 74 deletions
@ -0,0 +1,20 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Generated by Django 1.10.7 on 2017-10-27 03:02 |
||||
|
from __future__ import unicode_literals |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('cotisations', '0024_auto_20171015_2033'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.AddField( |
||||
|
model_name='article', |
||||
|
name='type_user', |
||||
|
field=models.CharField(choices=[('Adherent', 'Adherent'), ('Club', 'Club'), ('All', 'All')], default='All', max_length=255), |
||||
|
), |
||||
|
] |
||||
@ -0,0 +1,78 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Generated by Django 1.10.7 on 2017-10-27 23:26 |
||||
|
from __future__ import unicode_literals |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
|
||||
|
|
||||
|
def create_type(apps, schema_editor): |
||||
|
Cotisation = apps.get_model('cotisations', 'Cotisation') |
||||
|
Vente = apps.get_model('cotisations', 'Vente') |
||||
|
Article = apps.get_model('cotisations', 'Article') |
||||
|
db_alias = schema_editor.connection.alias |
||||
|
articles = Article.objects.using(db_alias).all() |
||||
|
ventes = Vente.objects.using(db_alias).all() |
||||
|
cotisations = Cotisation.objects.using(db_alias).all() |
||||
|
for article in articles: |
||||
|
if article.iscotisation: |
||||
|
article.type_cotisation='All' |
||||
|
article.save(using=db_alias) |
||||
|
for vente in ventes: |
||||
|
if vente.iscotisation: |
||||
|
vente.type_cotisation='All' |
||||
|
vente.save(using=db_alias) |
||||
|
for cotisation in cotisations: |
||||
|
cotisation.type_cotisation='All' |
||||
|
cotisation.save(using=db_alias) |
||||
|
|
||||
|
def delete_type(apps, schema_editor): |
||||
|
Vente = apps.get_model('cotisations', 'Vente') |
||||
|
Article = apps.get_model('cotisations', 'Article') |
||||
|
db_alias = schema_editor.connection.alias |
||||
|
articles = Articles.objects.using(db_alias).all() |
||||
|
ventes = Vente.objects.using(db_alias).all() |
||||
|
for article in articles: |
||||
|
if article.type_cotisation: |
||||
|
article.iscotisation=True |
||||
|
else: |
||||
|
article.iscotisation=False |
||||
|
article.save(using=db_alias) |
||||
|
for vente in ventes: |
||||
|
if vente.iscotisation: |
||||
|
vente.iscotisation=True |
||||
|
else: |
||||
|
vente.iscotisation=False |
||||
|
vente.save(using=db_alias) |
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('cotisations', '0025_article_type_user'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.AddField( |
||||
|
model_name='article', |
||||
|
name='type_cotisation', |
||||
|
field=models.CharField(blank=True, choices=[('Connexion', 'Connexion'), ('Adhesion', 'Adhesion'), ('All', 'All')], default=None, max_length=255, null=True), |
||||
|
), |
||||
|
migrations.AddField( |
||||
|
model_name='cotisation', |
||||
|
name='type_cotisation', |
||||
|
field=models.CharField(choices=[('Connexion', 'Connexion'), ('Adhesion', 'Adhesion'), ('All', 'All')], max_length=255), |
||||
|
), |
||||
|
migrations.AddField( |
||||
|
model_name='vente', |
||||
|
name='type_cotisation', |
||||
|
field=models.CharField(blank=True, choices=[('Connexion', 'Connexion'), ('Adhesion', 'Adhesion'), ('All', 'All')], max_length=255, null=True), |
||||
|
), |
||||
|
migrations.RunPython(create_type, delete_type), |
||||
|
migrations.RemoveField( |
||||
|
model_name='article', |
||||
|
name='iscotisation', |
||||
|
), |
||||
|
migrations.RemoveField( |
||||
|
model_name='vente', |
||||
|
name='iscotisation', |
||||
|
), |
||||
|
] |
||||
@ -0,0 +1,20 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Generated by Django 1.10.7 on 2017-10-29 10:56 |
||||
|
from __future__ import unicode_literals |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('cotisations', '0026_auto_20171028_0126'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.AlterField( |
||||
|
model_name='article', |
||||
|
name='name', |
||||
|
field=models.CharField(max_length=255), |
||||
|
), |
||||
|
] |
||||
@ -0,0 +1,19 @@ |
|||||
|
{% if not 'accept_cookies' in request.COOKIES%} |
||||
|
<script> |
||||
|
function accept_cookie() { |
||||
|
var d = new Date(); |
||||
|
var expiration_time = 7 * 24 * 60 * 60 * 1000; // Accepte les cookies pendant 7 jours. |
||||
|
d.setTime(d.getTime() + expiration_time); |
||||
|
var expires = "expires="+ d.toUTCString(); |
||||
|
document.cookie = "accept_cookies=1;" + expires + ";path=/"; |
||||
|
var banner = document.getElementById("cookie_banner"); |
||||
|
banner.parentNode.removeChild(banner); |
||||
|
} |
||||
|
</script> |
||||
|
<div class="navbar text-center" id="cookie_banner"> |
||||
|
<p>Ce site utilise des cookies. En poursuivant sur ce site j'accepte l'utilisation des cookies sur ce site.</p> |
||||
|
<a class="btn btn-primary btn-sm" role="button" onclick="accept_cookie();" title="Accepter"> |
||||
|
J'ai compris ! |
||||
|
</a> |
||||
|
</div> |
||||
|
{% endif %} |
||||
Loading…
Reference in new issue