From f1105d704e68958cce076caecbb3b04156e9eb75 Mon Sep 17 00:00:00 2001 From: Skia Date: Fri, 19 Aug 2016 02:53:44 +0200 Subject: [PATCH] Add basic search bar --- core/static/core/img/na.gif | Bin 0 -> 1067 bytes core/static/core/style.css | 24 +++++- core/templates/core/base.jinja | 4 + core/templates/core/index.jinja | 5 +- core/templates/core/macros.jinja | 13 +++ core/templates/core/search.jinja | 26 ++++++ core/templates/core/user_stats.jinja | 7 +- core/urls.py | 3 +- core/views/site.py | 43 +++++++++- core/views/user.py | 9 +- locale/fr/LC_MESSAGES/django.mo | Bin 28020 -> 28173 bytes locale/fr/LC_MESSAGES/django.po | 122 +++++++++++++++------------ migrate.py | 16 ++-- 13 files changed, 199 insertions(+), 73 deletions(-) create mode 100644 core/static/core/img/na.gif create mode 100644 core/templates/core/search.jinja diff --git a/core/static/core/img/na.gif b/core/static/core/img/na.gif new file mode 100644 index 0000000000000000000000000000000000000000..332b62df2d9b059e6e3e330116a23c9ab0a30584 GIT binary patch literal 1067 zcmV+`1l0RSNk%w1VSNC70J8u9cXxM0L`1v0yCNbYW@cvY?(S7pRhgNYs;a8p-Q5up z5zNfYGcz-Yh=~9H{{R30A^8LV00000EC2ui0DS;`06+x)@X1N5y*TU5yZ>M)j$~<` zXsWJk>%MTj0g7zjTjT6JfWro!a7Z+$3c~>?NNhR?0%1TF75XrMA&Eh}ZWKdA2SJ>= z7y`02GdK`K38GRHsA@Ze0&*x2Gyroeb`EA4Lq;80LJNf;Izj?97z0jTFbY`&9y($( zO$RCpeQ`tr1q-4>mOm^CQv(690fDTwwzs&sy1Tr+zQ4f1!o$SH#>dFXI0Jh-oyxnC z5&=yMw9pg;000L9+uz{e0S4D0l!qRJkO1RuPCJb*?(iA}L!cpwLiii!Jeui-#ACsP z$G{2#KNvuO2*834sTMSQN0G>a9Re7%(B}Y=At8AGnlvymuj0E^(9}8LhpnZ{moQ_> zoJq5$&6_xL>fFh*r_Y~2g9;VKamUaXq=aZZy29R&1Tz&B=yQ<(rld++sPmXez(pqu z01i61qM*rtC?0|QQ1Wa-7;1$SD5r+UND_51dMH`|-~|8^4a(qnH$z^s8@^`cFs}e& z3r+>cc#FZTgTfxT3@P9tFXj%EUnq8fk^(g$&pNc7`{DEs&L1N0D7}K?;|HoTHwaL7 zK?4G}Ddcq^fB>y+25K+>OvLXC+Z#e>kj;auqb3Oe!6Gm`Hw=F}SYCj{0lbtG1G>8< z9n&=r@n@{xWTr*iQl|Lx>)+46zyJRL1}NbFfCLt3;DHDxsNjMOHt67k5Jo8BgcMeo z%xMTjky?aBK{X*7-bJXH5FSbxm;>b;2nzrRj22=}184)BG%R4{Kmjy<;7S1B7>5fO zn^EN42>@WVAqQ?fG*%1@xM)&|Cb(x52u{9}z(m2BK;2nKir}IE9t@z;di2CFfJ3hx zkfH$q2oML3B~S<7Buxl#jhOFbSppFS+(&^_iRurv`EDKY5=4*#m1(JEZ~MKOIymK zz?@_s@gPEs0p!TWH*JLnfB`%L&_EyfdR0m++H7jVVbQJ8fs{KWZ~$-|2&-NKh%nGi zzD^_{z`-vpsX?h2*vQ%l8ejXs098(U$$1yA#X+JEWlClxW@d{J52|i3CaoMWa3YyB zpHNp{8zhzUmOHpRf&n)V5thqmARu%F2I$Lyq$svvfISQ$p$P*uh`Tg00i2j3gSje7 lAtp$0(+s2*rmgncY`5+9+i=G%_uO>XZTH=H=gmO`06WKRy7&M9 literal 0 HcmV?d00001 diff --git a/core/static/core/style.css b/core/static/core/style.css index f9d9c3ce..a66db1b4 100644 --- a/core/static/core/style.css +++ b/core/static/core/style.css @@ -26,7 +26,11 @@ header a { header a:hover { color: #2D3; } - +header form { + display: inline-block; + padding: 1em; + width: 150px; +} #popupheader { width: 88%; margin: 0px auto; @@ -185,6 +189,24 @@ tbody>tr:hover { #user_profile .promo_pict { height: 45px; } +.mini_profile_link { + display: block; + text-decoration: none; +} +.mini_profile_link span { + display: inline-block; + width: 50px; + vertical-align: middle; +} +.mini_profile_link em { + vertical-align: middle; +} +.mini_profile_link img { + max-width: 40px; + max-height: 60px; + margin: 2px auto; + display: block; +} /*---------------------------------PAGE--------------------------------*/ .page_content { display: block; diff --git a/core/templates/core/base.jinja b/core/templates/core/base.jinja index da79c86d..f639ab56 100644 --- a/core/templates/core/base.jinja +++ b/core/templates/core/base.jinja @@ -24,6 +24,10 @@ {{ user.get_display_name() }} | {% trans %}Tools{% endtrans %} | {% trans %}Logout{% endtrans %} +
+ + +
{% endif %} {% else %} diff --git a/core/templates/core/index.jinja b/core/templates/core/index.jinja index 880bdc44..6724ae6b 100644 --- a/core/templates/core/index.jinja +++ b/core/templates/core/index.jinja @@ -1,7 +1,8 @@ {% extends "core/base.jinja" %} -{% block title %}{{ title }}{% endblock %} - +{% block title %} +{% trans %}Welcome!{% endtrans %} +{% endblock %} {% block content %} {% trans %}Hello, world. You're at the core index using Jinja2.{% endtrans %} {% endblock %} diff --git a/core/templates/core/macros.jinja b/core/templates/core/macros.jinja index 84fa1d6c..4c25be71 100644 --- a/core/templates/core/macros.jinja +++ b/core/templates/core/macros.jinja @@ -1,3 +1,16 @@ {% macro user_profile_link(user) -%} {{ user.get_display_name() }} {%- endmacro %} + +{% macro user_link_with_pict(user) -%} + + + {% if user.profile_pict %} + {% trans %}Profile{% endtrans %} + {% else %} + {% trans %}Profile{% endtrans %} + {% endif %} + + {{ user.get_display_name() }} + +{%- endmacro %} diff --git a/core/templates/core/search.jinja b/core/templates/core/search.jinja new file mode 100644 index 00000000..bd38874e --- /dev/null +++ b/core/templates/core/search.jinja @@ -0,0 +1,26 @@ +{% extends "core/base.jinja" %} + +{% from "core/macros.jinja" import user_link_with_pict %} + +{% block title %} + {% trans %}Search result{% endtrans %} +{% endblock %} + +{% block content %} +

{% trans %}Users{% endtrans %}

+
    + {% for i in result.users %} +
  • + {{ user_link_with_pict(i) }} +
  • + {% endfor %} +
+

{% trans %}Clubs{% endtrans %}

+
    + {% for i in result.clubs %} +
  • + {{ i }} +
  • + {% endfor %} +
+{% endblock %} diff --git a/core/templates/core/user_stats.jinja b/core/templates/core/user_stats.jinja index ba25aac7..b6bf8021 100644 --- a/core/templates/core/user_stats.jinja +++ b/core/templates/core/user_stats.jinja @@ -8,9 +8,10 @@ {% if profile.permanencies %}

Permanencies

-

- {{ total_time }} -

+

Total: {{ total_perm_time }}

+

Foyer: {{ total_foyer_time }}

+

MDE: {{ total_mde_time }}

+

La Gommette: {{ total_gommette_time }}

{% endif %} {% endblock %} diff --git a/core/urls.py b/core/urls.py index 45f43691..7f3f4046 100644 --- a/core/urls.py +++ b/core/urls.py @@ -4,6 +4,8 @@ from core.views import * urlpatterns = [ url(r'^$', index, name='index'), + url(r'^search/$', search_view, name='search'), + url(r'^search_json/$', search_json, name='search_json'), # Login and co url(r'^login/$', login, name='login'), @@ -50,5 +52,4 @@ urlpatterns = [ url(r'^page/(?P[a-z0-9/-_]*)/hist$', PageHistView.as_view(), name='page_hist'), url(r'^page/(?P[a-z0-9/-_]*)/rev/(?P[0-9]+)/', PageRevView.as_view(), name='page_rev'), url(r'^page/(?P[a-z0-9/-_]*)/$', PageView.as_view(), name='page'), - ] diff --git a/core/views/site.py b/core/views/site.py index e6ecb376..cd350563 100644 --- a/core/views/site.py +++ b/core/views/site.py @@ -1,11 +1,46 @@ from django.shortcuts import render, redirect, get_object_or_404 from django.db import models +from django.http import JsonResponse +from django.core import serializers +from django.db.models import Q +from django.contrib.auth.decorators import login_required import os +import json +from itertools import chain + +from core.models import User +from club.models import Club def index(request, context=None): - if context == None: - return render(request, "core/index.jinja", {'title': 'Bienvenue!'}) - else: - return render(request, "core/index.jinja", context) + return render(request, "core/index.jinja") + +def search(query, as_json=False): + result = {'users': None, 'clubs': None} + if query: + nicks = User.objects.filter(nick_name__icontains=query).all() + users = User.objects.filter(Q(first_name__icontains=query) | Q(last_name__icontains=query)).all() + clubs = Club.objects.filter(name__icontains=query).all() + nicks = nicks[:5] + users = users[:5] + clubs = clubs[:5] + if as_json: # Re-loads json to avoid double encoding by JsonResponse, but still benefit from serializers + nicks = json.loads(serializers.serialize('json', nicks, fields=('nick_name', 'last_name', 'first_name', 'profile_pict'))) + users = json.loads(serializers.serialize('json', users, fields=('nick_name', 'last_name', 'first_name', 'profile_pict'))) + clubs = json.loads(serializers.serialize('json', clubs, fields=('name'))) + else: + nicks = list(nicks.all()) + users = list(users.all()) + clubs = list(clubs.all()) + result['users'] = nicks + users + result['clubs'] = clubs + return result + +@login_required +def search_view(request): + return render(request, "core/search.jinja", context={'result': search(request.GET.get('query', ''))}) + +@login_required +def search_json(request): + return JsonResponse(search(request.GET.get('query', ''), True)) diff --git a/core/views/user.py b/core/views/user.py index 3a26423b..6cdf6812 100644 --- a/core/views/user.py +++ b/core/views/user.py @@ -134,7 +134,14 @@ class UserStatsView(CanViewMixin, DetailView): def get_context_data(self, **kwargs): kwargs = super(UserStatsView, self).get_context_data(**kwargs) - kwargs['total_time'] = sum([p.end-p.start for p in self.object.permanencies.all()], timedelta()) + from counter.models import Counter + foyer = Counter.objects.filter(name="Foyer").first() + mde = Counter.objects.filter(name="MDE").first() + gommette = Counter.objects.filter(name="La Gommette").first() + kwargs['total_perm_time'] = sum([p.end-p.start for p in self.object.permanencies.all()], timedelta()) + kwargs['total_foyer_time'] = sum([p.end-p.start for p in self.object.permanencies.filter(counter=foyer)], timedelta()) + kwargs['total_mde_time'] = sum([p.end-p.start for p in self.object.permanencies.filter(counter=mde)], timedelta()) + kwargs['total_gommette_time'] = sum([p.end-p.start for p in self.object.permanencies.filter(counter=gommette)], timedelta()) return kwargs class UserMiniView(CanViewMixin, DetailView): diff --git a/locale/fr/LC_MESSAGES/django.mo b/locale/fr/LC_MESSAGES/django.mo index 4600b1d2966b4651654d8e77daab58244cec9dd4..8df42a48c736b5acd6277d98be067699b905f10f 100644 GIT binary patch delta 10086 zcmYk?2Y8O>9>?(~Btj&F#EKOwiD(Exk`k0yMG>16LF|~}P;Fn;8ns7J)mlB@-~0SsSD)+reeVDL+|Rw9@zU!&IPWv* zijL!PZcvD!B7co+(l`|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KK}hU!33*+ zle~h}_oc3c<)v{KvE0hycm1HvAJCTg`~TL@KQ1_tUkx~(C$>}WK{O;DA0Z^IDR09+ ziLpd}%I^|Sk-uqe`;t!};wYCUMv@OBqU`(<^4;X_Ns@mNI$ot>AU4No#A08q_oFdo z9c{3s\n" "Language-Team: AE info \n" @@ -40,12 +40,12 @@ msgstr "numero de compte" msgid "%(club_account)s on %(bank_account)s" msgstr "%(club_account)s sur %(bank_account)s" -#: accounting/models.py:109 club/models.py:147 counter/models.py:271 +#: accounting/models.py:109 club/models.py:147 counter/models.py:291 #: launderette/models.py:122 msgid "start date" msgstr "date de début" -#: accounting/models.py:110 club/models.py:148 counter/models.py:272 +#: accounting/models.py:110 club/models.py:148 counter/models.py:292 msgid "end date" msgstr "date de fin" @@ -67,12 +67,12 @@ msgid "number" msgstr "numéro" #: accounting/models.py:154 core/models.py:404 core/models.py:680 -#: counter/models.py:209 counter/models.py:245 eboutic/models.py:14 +#: counter/models.py:209 counter/models.py:255 eboutic/models.py:14 #: eboutic/models.py:47 msgid "date" msgstr "date" -#: accounting/models.py:155 accounting/models.py:241 counter/models.py:237 +#: accounting/models.py:155 accounting/models.py:241 counter/models.py:247 msgid "label" msgstr "intitulé" @@ -80,8 +80,8 @@ msgstr "intitulé" msgid "remark" msgstr "remarque" -#: accounting/models.py:157 counter/models.py:210 counter/models.py:247 -#: eboutic/models.py:49 subscription/models.py:34 +#: accounting/models.py:157 counter/models.py:210 counter/models.py:256 +#: subscription/models.py:34 msgid "payment method" msgstr "méthode de paiement" @@ -89,7 +89,7 @@ msgstr "méthode de paiement" msgid "cheque number" msgstr "numéro de chèque" -#: accounting/models.py:159 eboutic/models.py:119 +#: accounting/models.py:159 eboutic/models.py:115 msgid "invoice" msgstr "facture" @@ -114,7 +114,7 @@ msgstr "Utilisateur" msgid "Club" msgstr "Club" -#: accounting/models.py:163 core/templates/core/user_base.jinja:17 +#: accounting/models.py:163 core/templates/core/user_base.jinja:18 msgid "Account" msgstr "Compte" @@ -207,7 +207,7 @@ msgstr "Nouveau compte club" #: accounting/templates/accounting/club_account_details.jinja:44 #: accounting/templates/accounting/journal_details.jinja:62 #: club/templates/club/club_detail.jinja:7 core/templates/core/file.jinja:38 -#: core/templates/core/page.jinja:31 core/templates/core/user_base.jinja:9 +#: core/templates/core/page.jinja:31 core/templates/core/user_base.jinja:10 #: core/templates/core/user_tools.jinja:33 #: counter/templates/counter/counter_list.jinja:15 #: counter/templates/counter/counter_list.jinja:18 @@ -269,7 +269,7 @@ msgstr "Fin" #: accounting/templates/accounting/club_account_details.jinja:20 #: accounting/templates/accounting/journal_details.jinja:23 #: core/templates/core/user_account.jinja:19 -#: core/templates/core/user_account.jinja:72 +#: core/templates/core/user_account.jinja:78 msgid "Amount" msgstr "Montant" @@ -324,13 +324,13 @@ msgstr "No" #: accounting/templates/accounting/journal_details.jinja:21 #: core/templates/core/user_account.jinja:16 -#: core/templates/core/user_account.jinja:41 -#: core/templates/core/user_account.jinja:70 +#: core/templates/core/user_account.jinja:44 +#: core/templates/core/user_account.jinja:76 msgid "Date" msgstr "Date" #: accounting/templates/accounting/journal_details.jinja:22 -#: core/templates/core/user_account.jinja:44 +#: core/templates/core/user_account.jinja:47 msgid "Label" msgstr "Intitulé" @@ -908,7 +908,7 @@ msgstr "Outils" msgid "Logout" msgstr "Déconnexion" -#: core/templates/core/base.jinja:36 +#: core/templates/core/base.jinja:36 core/templates/core/search.jinja:10 msgid "Users" msgstr "Utilisateurs" @@ -920,7 +920,7 @@ msgstr "Wiki" msgid "Pages" msgstr "Pages" -#: core/templates/core/base.jinja:39 +#: core/templates/core/base.jinja:39 core/templates/core/search.jinja:18 msgid "Clubs" msgstr "Clubs" @@ -938,23 +938,25 @@ msgid "Create %(name)s" msgstr "Créer %(name)s" #: core/templates/core/delete_confirm.jinja:4 +#: core/templates/core/delete_confirm.jinja:8 #: core/templates/core/file_delete_confirm.jinja:4 +#: core/templates/core/file_delete_confirm.jinja:8 msgid "Delete confirmation" msgstr "Confirmation de suppression" -#: core/templates/core/delete_confirm.jinja:6 -#: core/templates/core/file_delete_confirm.jinja:6 +#: core/templates/core/delete_confirm.jinja:10 +#: core/templates/core/file_delete_confirm.jinja:10 #, python-format msgid "Are you sure you want to delete \"%(obj)s\"?" msgstr "Êtes-vous sûr de vouloir supprimer \"%(obj)s\" ?" -#: core/templates/core/delete_confirm.jinja:7 -#: core/templates/core/file_delete_confirm.jinja:7 +#: core/templates/core/delete_confirm.jinja:11 +#: core/templates/core/file_delete_confirm.jinja:11 msgid "Confirm" msgstr "Confirmation" -#: core/templates/core/delete_confirm.jinja:8 -#: core/templates/core/file_delete_confirm.jinja:8 +#: core/templates/core/delete_confirm.jinja:14 +#: core/templates/core/file_delete_confirm.jinja:14 #: counter/templates/counter/counter_click.jinja:71 msgid "Cancel" msgstr "Annuler" @@ -1067,6 +1069,13 @@ msgstr "login" msgid "Lost password?" msgstr "Mot de passe perdu ?" +#: core/templates/core/macros.jinja:9 core/templates/core/macros.jinja:11 +#: core/templates/core/user_detail.jinja:12 +#: core/templates/core/user_edit.jinja:15 +#: core/templates/core/user_mini.jinja:4 +msgid "Profile" +msgstr "Profil" + #: core/templates/core/page.jinja:7 core/templates/core/page_list.jinja:4 #: core/templates/core/page_list.jinja:9 msgid "Page list" @@ -1219,6 +1228,10 @@ msgstr "" msgid "Your username is %(username)s." msgstr "Votre nom d'utilisateur est %(username)s." +#: core/templates/core/search.jinja:6 +msgid "Search result" +msgstr "Résultat de la recherche" + #: core/templates/core/user_account.jinja:4 #, python-format msgid "%(user_name)s's account" @@ -1233,47 +1246,50 @@ msgid "Refillings" msgstr "Rechargements" #: core/templates/core/user_account.jinja:17 -#: core/templates/core/user_account.jinja:42 +#: core/templates/core/user_account.jinja:45 #: counter/templates/counter/counter_click.jinja:24 msgid "Counter" msgstr "Comptoir" #: core/templates/core/user_account.jinja:18 -#: core/templates/core/user_account.jinja:43 +#: core/templates/core/user_account.jinja:46 msgid "Barman" msgstr "Barman" #: core/templates/core/user_account.jinja:20 -#: core/templates/core/user_account.jinja:47 -#: core/templates/core/user_account.jinja:73 +#: core/templates/core/user_account.jinja:50 msgid "Payment method" msgstr "Méthode de paiement" -#: core/templates/core/user_account.jinja:37 +#: core/templates/core/user_account.jinja:40 msgid "Account buyings" msgstr "Achat sur compte utilisateur" -#: core/templates/core/user_account.jinja:45 +#: core/templates/core/user_account.jinja:48 msgid "Quantity" msgstr "Quantité" -#: core/templates/core/user_account.jinja:46 +#: core/templates/core/user_account.jinja:49 msgid "Total" msgstr "Total" -#: core/templates/core/user_account.jinja:66 +#: core/templates/core/user_account.jinja:72 msgid "Eboutic invoices" msgstr "Facture eboutic" -#: core/templates/core/user_account.jinja:71 +#: core/templates/core/user_account.jinja:77 msgid "Items" msgstr "Articles" -#: core/templates/core/user_account.jinja:95 +#: core/templates/core/user_account.jinja:99 msgid "User has no account" msgstr "L'utilisateur n'a pas de compte" -#: core/templates/core/user_base.jinja:12 +#: core/templates/core/user_base.jinja:8 +msgid "Stats" +msgstr "Stats" + +#: core/templates/core/user_base.jinja:13 #: core/templates/core/user_tools.jinja:14 msgid "Groups" msgstr "Groupes" @@ -1283,12 +1299,6 @@ msgstr "Groupes" msgid "%(user_name)s's profile" msgstr "Profil de %(user_name)s" -#: core/templates/core/user_detail.jinja:12 -#: core/templates/core/user_edit.jinja:15 -#: core/templates/core/user_mini.jinja:4 -msgid "Profile" -msgstr "Profil" - #: core/templates/core/user_detail.jinja:21 #: core/templates/core/user_mini.jinja:12 msgid "Born: " @@ -1371,6 +1381,10 @@ msgstr "Éditer les groupes pour %(user_name)s" msgid "User list" msgstr "Liste d'utilisateurs" +#: core/templates/core/user_stats.jinja:4 +msgid "%(user_name)s's stats" +msgstr "Stats de %(user_name)s" + #: core/templates/core/user_tools.jinja:4 #, python-format msgid "%(user_name)s's tools" @@ -1522,7 +1536,7 @@ msgstr "comptoir" msgid "bank" msgstr "banque" -#: counter/models.py:214 counter/models.py:246 +#: counter/models.py:214 counter/models.py:258 msgid "is validated" msgstr "est validé" @@ -1530,29 +1544,29 @@ msgstr "est validé" msgid "refilling" msgstr "rechargement" -#: counter/models.py:241 eboutic/models.py:106 +#: counter/models.py:251 eboutic/models.py:102 msgid "unit price" msgstr "prix unitaire" -#: counter/models.py:242 eboutic/models.py:107 +#: counter/models.py:252 eboutic/models.py:103 msgid "quantity" msgstr "quantité" -#: counter/models.py:248 eboutic/models.py:48 +#: counter/models.py:257 msgid "Sith account" msgstr "Compte utilisateur" -#: counter/models.py:248 eboutic/models.py:48 sith/settings.py:272 -#: sith/settings.py:277 sith/settings.py:298 sith/settings_sample.py:258 +#: counter/models.py:257 sith/settings.py:272 sith/settings.py:277 +#: sith/settings.py:298 sith/settings_sample.py:258 #: sith/settings_sample.py:263 sith/settings_sample.py:284 msgid "Credit card" msgstr "Carte banquaire" -#: counter/models.py:251 +#: counter/models.py:261 msgid "selling" msgstr "vente" -#: counter/models.py:275 +#: counter/models.py:295 msgid "permanency" msgstr "permanence" @@ -1597,7 +1611,6 @@ msgid "Finish" msgstr "Terminer" #: counter/templates/counter/counter_click.jinja:73 -#: eboutic/templates/eboutic/eboutic_main.jinja:41 msgid "Products: " msgstr "Produits : " @@ -1694,27 +1707,27 @@ msgstr "ANN" msgid "You have not enough money to buy all the basket" msgstr "Vous n'avez pas assez d'argent pour acheter le panier" -#: eboutic/models.py:50 +#: eboutic/models.py:48 msgid "validated" msgstr "validé" -#: eboutic/models.py:60 +#: eboutic/models.py:61 msgid "Invoice already validated" msgstr "Facture déjà validée" -#: eboutic/models.py:103 +#: eboutic/models.py:99 msgid "product id" msgstr "ID du produit" -#: eboutic/models.py:104 +#: eboutic/models.py:100 msgid "product name" msgstr "nom du produit" -#: eboutic/models.py:105 +#: eboutic/models.py:101 msgid "product type id" msgstr "id du type du produit" -#: eboutic/models.py:116 +#: eboutic/models.py:112 msgid "basket" msgstr "panier" @@ -2047,4 +2060,3 @@ msgstr "Un utilisateur avec cette adresse email existe déjà" msgid "You must either choose an existing user or create a new one properly" msgstr "" "Vous devez soit choisir un utilisateur existant, ou en créer un proprement." - diff --git a/migrate.py b/migrate.py index 6e7953ed..82c6174b 100644 --- a/migrate.py +++ b/migrate.py @@ -513,13 +513,17 @@ def migrate_sellings(): """) Selling.objects.filter(payment_method="SITH_ACCOUNT").delete() print("Sith account selling deleted") + ae = Club.objects.filter(unix_name="ae").first() + mde = Counter.objects.filter(id=1).first() + root = User.objects.filter(id=0).first() + beer = Product.objects.filter(id=1).first() for r in cur: try: - product = Product.objects.filter(id=r['id_produit']).first() - club = Club.objects.filter(id=r['id_assocpt']).first() - counter = Counter.objects.filter(id=r['id_comptoir']).first() - op = User.objects.filter(id=r['id_utilisateur']).first() - customer = Customer.objects.filter(user__id=r['id_utilisateur_client']).first() + product = Product.objects.filter(id=r['id_produit']).first() or beer + club = Club.objects.filter(id=r['id_assocpt']).first() or ae + counter = Counter.objects.filter(id=r['id_comptoir']).first() or mde + op = User.objects.filter(id=r['id_utilisateur']).first() or root + customer = Customer.objects.filter(user__id=r['id_utilisateur_client']).first() or root.customer new = Selling( label=product.name, counter=counter, @@ -570,6 +574,7 @@ def main(): # migrate_subscriptions() # update_customer_account() # migrate_counters() + # migrate_permanencies() # migrate_typeproducts() # migrate_products() # migrate_products_to_counter() @@ -577,7 +582,6 @@ def main(): # migrate_invoices() # migrate_refillings() # migrate_sellings() - # migrate_permanencies() reset_index('core', 'counter') if __name__ == "__main__":