Commit da328efe authored by Patrick's avatar Patrick

Work in progress

parent c2f38c51
...@@ -56,7 +56,8 @@ class ConfigurationAdmin(TranslatableAdmin): ...@@ -56,7 +56,8 @@ class ConfigurationAdmin(TranslatableAdmin):
'display_producer_on_order_form', 'display_producer_on_order_form',
'customers_must_confirm_orders', 'customers_must_confirm_orders',
('bank_account', 'max_week_wo_participation'), ('bank_account', 'max_week_wo_participation'),
('membership_fee', 'membership_fee_duration')), ('membership_fee', 'membership_fee_duration'),
'how_to_register'),
}), }),
] ]
if Producer.objects.filter(producer_pre_opening=True).order_by('?').only('id').exists(): if Producer.objects.filter(producer_pre_opening=True).order_by('?').only('id').exists():
......
This diff is collapsed.
...@@ -101,6 +101,14 @@ class Configuration(TranslatableModel): ...@@ -101,6 +101,14 @@ class Configuration(TranslatableModel):
max_length=100, max_length=100,
default=EMPTY_STRING, default=EMPTY_STRING,
blank=True), blank=True),
how_to_register=HTMLField(_("how to register"),
help_text=EMPTY_STRING,
configuration='CKEDITOR_SETTINGS_MODEL2',
default=
"""
Pour créer un compte et passer commande, veuillez contacter ....
""",
blank=False),
offer_customer_mail=HTMLField(_("offer customer mail"), offer_customer_mail=HTMLField(_("offer customer mail"),
help_text=EMPTY_STRING, help_text=EMPTY_STRING,
configuration='CKEDITOR_SETTINGS_MODEL2', configuration='CKEDITOR_SETTINGS_MODEL2',
......
...@@ -116,19 +116,13 @@ class Customer(models.Model): ...@@ -116,19 +116,13 @@ class Customer(models.Model):
get_admin_date_balance.allow_tags = False get_admin_date_balance.allow_tags = False
def get_admin_date_joined(self): def get_admin_date_joined(self):
if self.user is not None: return self.user.date_joined.strftime(settings.DJANGO_SETTINGS_DATE)
return self.user.date_joined.strftime(settings.DJANGO_SETTINGS_DATE)
else:
return EMPTY_STRING
get_admin_date_joined.short_description = _("date joined") get_admin_date_joined.short_description = _("date joined")
get_admin_date_joined.allow_tags = False get_admin_date_joined.allow_tags = False
def get_admin_balance(self): def get_admin_balance(self):
if self.id is not None: return self.balance + self.get_bank_not_invoiced() - self.get_order_not_invoiced()
return self.balance + self.get_bank_not_invoiced() - self.get_order_not_invoiced()
else:
return REPANIER_MONEY_ZERO
get_admin_balance.short_description = (_("balance")) get_admin_balance.short_description = (_("balance"))
get_admin_balance.allow_tags = False get_admin_balance.allow_tags = False
...@@ -196,27 +190,23 @@ class Customer(models.Model): ...@@ -196,27 +190,23 @@ class Customer(models.Model):
get_balance.admin_order_field = 'balance' get_balance.admin_order_field = 'balance'
def get_last_membership_fee(self): def get_last_membership_fee(self):
if self.id is not None: last_membership_fee = purchase.Purchase.objects.filter(
last_membership_fee = purchase.Purchase.objects.filter( customer_id=self.id,
customer_id=self.id, offer_item__order_unit=PRODUCT_ORDER_UNIT_MEMBERSHIP_FEE
offer_item__order_unit=PRODUCT_ORDER_UNIT_MEMBERSHIP_FEE ).order_by("-id")
).order_by("-id") if last_membership_fee.exists():
if last_membership_fee.exists(): return last_membership_fee.first().selling_price
return last_membership_fee.first().selling_price
return REPANIER_MONEY_ZERO
get_last_membership_fee.short_description = _("last membership fee") get_last_membership_fee.short_description = _("last membership fee")
get_last_membership_fee.allow_tags = False get_last_membership_fee.allow_tags = False
def last_membership_fee_date(self): def last_membership_fee_date(self):
if self.id is not None: last_membership_fee = purchase.Purchase.objects.filter(
last_membership_fee = purchase.Purchase.objects.filter( customer_id=self.id,
customer_id=self.id, offer_item__order_unit=PRODUCT_ORDER_UNIT_MEMBERSHIP_FEE
offer_item__order_unit=PRODUCT_ORDER_UNIT_MEMBERSHIP_FEE ).order_by("-id").prefetch_related("customer_invoice")
).order_by("-id").prefetch_related("customer_invoice") if last_membership_fee.exists():
if last_membership_fee.exists(): return last_membership_fee.first().customer_invoice.date_balance
return last_membership_fee.first().customer_invoice.date_balance
return
last_membership_fee_date.short_description = _("last membership fee date") last_membership_fee_date.short_description = _("last membership fee date")
last_membership_fee_date.allow_tags = False last_membership_fee_date.allow_tags = False
...@@ -227,35 +217,31 @@ class Customer(models.Model): ...@@ -227,35 +217,31 @@ class Customer(models.Model):
last_membership_fee_date = self.last_membership_fee_date() last_membership_fee_date = self.last_membership_fee_date()
if last_membership_fee_date is not None: if last_membership_fee_date is not None:
return last_membership_fee_date.strftime(settings.DJANGO_SETTINGS_DATE) return last_membership_fee_date.strftime(settings.DJANGO_SETTINGS_DATE)
return return EMPTY_STRING
get_last_membership_fee_date.short_description = _("last membership fee date") get_last_membership_fee_date.short_description = _("last membership fee date")
get_last_membership_fee_date.allow_tags = False get_last_membership_fee_date.allow_tags = False
def get_participation(self): def get_participation(self):
if self.id is not None: now = timezone.now()
now = timezone.now() return permanenceboard.PermanenceBoard.objects.filter(
return permanenceboard.PermanenceBoard.objects.filter( customer_id=self.id,
customer_id=self.id, permanence_date__gte=now - datetime.timedelta(
permanence_date__gte=now - datetime.timedelta( days=365),
days=365), permanence_date__lt=now,
permanence_date__lt=now, permanence_role__is_counted_as_participation=True
permanence_role__is_counted_as_participation=True ).order_by('?').count()
).order_by('?').count()
return DECIMAL_ZERO
get_participation.short_description = _("participation") get_participation.short_description = _("participation")
get_participation.allow_tags = False get_participation.allow_tags = False
def get_purchase(self): def get_purchase(self):
if self.id is not None: now = timezone.now()
now = timezone.now() return invoice.CustomerInvoice.objects.filter(
return invoice.CustomerInvoice.objects.filter( customer_id=self.id,
customer_id=self.id, total_price_with_tax__gt=DECIMAL_ZERO,
total_price_with_tax__gt=DECIMAL_ZERO, date_balance__gte=now - datetime.timedelta(365)
date_balance__gte=now - datetime.timedelta(365) ).count()
).count()
return DECIMAL_ZERO
get_purchase.short_description = _("purchase") get_purchase.short_description = _("purchase")
get_purchase.allow_tags = False get_purchase.allow_tags = False
......
{% extends 'cms_page.html' %} {% extends 'cms_page.html' %}
{% load cms_tags sekizai_tags i18n l10n thumbnail filer_tags filer_image_tags %} {% load cms_tags sekizai_tags i18n l10n thumbnail filer_tags filer_image_tags %}
{% block sub_content %} {% block sub_content %}
{#<div class="container-repanier">#} {% if is_anonymous %}
{#<div class="container">#}
{% if is_anonymous %}
<div class="row"> <div class="row">
<div class="panel panel-danger"> <div class="panel-group">
<div class="panel-heading"> <div class="panel panel-primary">
<a href="{% url "login_form" %}?next={% url 'order_delivery_view' permanence.id delivery_id %}" class="btn btn-primary">{% trans "Login me" %}</a> <div class="panel-body">
<div class="col-xs-3">
<a href="{% url "login_form" %}?next={% url 'order_delivery_view' permanence.id delivery_id %}" class="btn btn-primary">{% trans "Login me" %}</a>
</div>
<div class="col-xs-9">
<div class="accordion-toggle collapsed" data-toggle="collapse" data-target="#collapse">
<span class="btn btn-primary">{% trans "Create an account" %}</span>
</div>
<div id="collapse" class="panel-collapse collapse">
{{ how_to_register }}
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> {% elif not may_order%}
{% elif not may_order%}
<div class="row"> <div class="row">
<div class="panel panel-danger"> <div class="panel panel-danger">
<div class="panel-heading"> <div class="panel-heading">
...@@ -19,7 +29,7 @@ ...@@ -19,7 +29,7 @@
</div> </div>
</div> </div>
</div> </div>
{% else %} {# not is_anonymous and may_order#} {% else %} {# not is_anonymous and may_order#}
<div class="row"> <div class="row">
<div class="panel panel-default"> <div class="panel panel-default">
{% if permanence.offer_description and permanence.offer_description.strip %} {% if permanence.offer_description and permanence.offer_description.strip %}
...@@ -60,7 +70,7 @@ ...@@ -60,7 +70,7 @@
<span id="span_btn_confirm_order"></span> <span id="span_btn_confirm_order"></span>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endif %} {# not is_anonymous and may_order#} {% endif %} {# not is_anonymous and may_order#}
{% if not is_anonymous or display_anonymous_order_form %} {% if not is_anonymous or display_anonymous_order_form %}
<div class="row"> <div class="row">
<nav class="col-xs-12 col-sm-3 hidden-xs bs-docs-sidebar"> <nav class="col-xs-12 col-sm-3 hidden-xs bs-docs-sidebar">
...@@ -154,7 +164,7 @@ ...@@ -154,7 +164,7 @@
{{ offer.cache_part_a | safe }} {{ offer.cache_part_a | safe }}
</div> </div>
<div class="col-sm-6 col-lg-3" data-id="{{ offer.id|unlocalize }}" data-product="{{ offer.get_long_name }}"> <div class="col-sm-6 col-lg-3" data-id="{{ offer.id|unlocalize }}" data-product="{{ offer.get_long_name }}">
{% if offer.may_order %}<select name="offer_item{{ offer.id|unlocalize }}" id="offer_item{{ offer.id|unlocalize }}" onchange="order_ajax({{ offer.id|unlocalize }})" class="form-control"></select>{% endif %} {% if offer.may_order %}<select name="offer_item{{ offer.id|unlocalize }}" id="offer_item{{ offer.id|unlocalize }}" {% if is_anonymous %}disabled{% else %}onchange="order_ajax({{ offer.id|unlocalize }})"{% endif %} class="form-control"></select>{% endif %}
<span id="box_offer_item{{ offer.id|unlocalize }}"></span> <span id="box_offer_item{{ offer.id|unlocalize }}"></span>
{{ offer.cache_part_b | safe }} {{ offer.cache_part_b | safe }}
{% if not offer.is_box %}<br/><span class="btn_like{{ offer.id|unlocalize }}" style="cursor: pointer;"></span>{% endif %} {% if not offer.is_box %}<br/><span class="btn_like{{ offer.id|unlocalize }}" style="cursor: pointer;"></span>{% endif %}
...@@ -275,8 +285,6 @@ ...@@ -275,8 +285,6 @@
</div> </div>
</div> </div>
{% endif %} {# not is_anonymous or display_anonymous_order_form #} {% endif %} {# not is_anonymous or display_anonymous_order_form #}
{#</div>#}
{#</div>#}
{% endblock %} {% endblock %}
{% block footer %} {% block footer %}
<div class="visible-xs"> <div class="visible-xs">
...@@ -466,6 +474,7 @@ ...@@ -466,6 +474,7 @@
}); });
} }
$(document).ready(function () { $(document).ready(function () {
{% if not is_anonymous %}
var lien = '{% url 'order_init_ajax' %}?{% for offer in offeritem_list %}oi={{ offer.id|unlocalize }}&{% endfor %}pe={{ permanence.id|unlocalize }}{% if delivery_id > 0 %}&de={{ delivery_id|unlocalize }}{% endif %}{% if communication %}&co={{ communication }}{% endif %}{% if basket %}&ba={{ basket }}{% endif %}'; var lien = '{% url 'order_init_ajax' %}?{% for offer in offeritem_list %}oi={{ offer.id|unlocalize }}&{% endfor %}pe={{ permanence.id|unlocalize }}{% if delivery_id > 0 %}&de={{ delivery_id|unlocalize }}{% endif %}{% if communication %}&co={{ communication }}{% endif %}{% if basket %}&ba={{ basket }}{% endif %}';
$.ajax({ $.ajax({
url: lien, url: lien,
...@@ -529,6 +538,7 @@ ...@@ -529,6 +538,7 @@
}); });
} }
}); });
{% endif %}
$('#orderModal').modal({ $('#orderModal').modal({
keyboard: true, keyboard: true,
backdrop: false, backdrop: false,
......
...@@ -7,43 +7,59 @@ ...@@ -7,43 +7,59 @@
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title" id="loginModalLabel">{% trans "Login" %}</h4> <h4 class="modal-title" id="loginModalLabel">{% trans "Login" %}</h4>
</div> </div>
<div class="modal-body"> {# <div class="modal-body">#}
<form role="form" action="{{ app_path }}" method="post" accept-charset="UTF-8" id="login-form">{% csrf_token %} <form role="form" action="{{ app_path }}" method="post" accept-charset="UTF-8" id="login-form">{% csrf_token %}
<div class="modal-body">
{#<div class="row">#}
<div class="form-group"> <div class="form-group">
{% if form.non_field_errors %} {% if form.non_field_errors %}
<p class="bg-danger"> <p class="bg-danger">
{% for error in form.non_field_errors %} {% for error in form.non_field_errors %}
{{ error }} {{ error }}
{% endfor %} {% endfor %}
</p> </p>
{% endif %} {% endif %}
<label for="id_username">{% trans "Username" %}</label> <label for="id_username">{% trans "Username" %}</label>
{% if form.username.errors %} {% if form.username.errors %}
<p class="bg-danger"> <p class="bg-danger">
{% for error in form.username.errors %} {% for error in form.username.errors %}
{{ error }} {{ error }}
{% endfor %} {% endfor %}
</p> </p>
{% endif %} {% endif %}
<input type="text" class="form-control" id="id_username" placeholder="{% trans "Username" %}" name="username"> <input type="text" class="form-control" id="id_username" placeholder="{% trans "Username" %}" name="username">
<br/> <br/>
<label for="id_password">{% trans "Password" %}</label> <label for="id_password">{% trans "Password" %}</label>
{% if form.password.errors %} {% if form.password.errors %}
<p class="bg-danger"> <p class="bg-danger">
{% for error in form.password.errors %} {% for error in form.password.errors %}
{{ error }} {{ error }}
{% endfor %} {% endfor %}
</p> </p>
{% endif %} {% endif %}
<input type="password" class="form-control" id="id_password" placeholder="{% trans "Password" %}" name="password"> <input type="password" class="form-control" id="id_password" placeholder="{% trans "Password" %}" name="password">
<input type="hidden" name="this_is_the_login_form" value="1" /> <input type="hidden" name="this_is_the_login_form" value="1" />
<input type="hidden" name="next" value="{{ next }}" /> <input type="hidden" name="next" value="{{ next }}" />
</div> </div>
<button class="btn btn-primary" type="submit">{% trans "Login" %}</button> <p></p>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="{% url "admin_password_reset" %}" style="color : inherit;">{% trans "Password reset" %}</a> <div class="form-group">
<div class="accordion-toggle collapsed" data-toggle="collapse" data-target="#collapse">
<span class="btn btn-primary">{% trans "Create an account" %}</span>
</div>
<div id="collapse" class="panel-collapse collapse">
{{ how_to_register }}
</div>
</div>
</div>
<div class="modal-footer">
<div class="form-group">
<button class="btn btn-primary" type="submit">{% trans "Login" %}</button>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="{% url "admin_password_reset" %}" class="btn btn-primary">{% trans "Password reset" %}</a>
</div>
</div>
</form> </form>
</div><!-- /form --> {# </div><!-- /form -->#}
</div><!-- /.modal-content --> </div><!-- /.modal-content -->
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->
<script type="text/javascript"> <script type="text/javascript">
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<br/> <br/>
{% endfor %} {% endfor %}
<br/> <br/>
<p>{% trans "If you want to show information about you, then" %} <a href="{% url 'me_view' %}">{% trans "update your profil" %}</a>.</p> <p>{% trans "If you want to show information about you, then" %} <a href="{% url 'my_profile_view' %}">{% trans "update your profil" %}</a>.</p>
<div class="panel-group" id="accordion"> <div class="panel-group" id="accordion">
{% if coordinator %} {% if coordinator %}
<div class="bg-danger"> <div class="bg-danger">
......
...@@ -1083,7 +1083,7 @@ def my_basket(is_order_confirm_send, order_amount, to_json): ...@@ -1083,7 +1083,7 @@ def my_basket(is_order_confirm_send, order_amount, to_json):
msg_html = '<span class="glyphicon glyphicon-shopping-cart"></span> %s&nbsp;&nbsp;&nbsp;<span class="glyphicon glyphicon-exclamation-sign"></span>&nbsp;<span class="glyphicon glyphicon-floppy-remove"></span></a>' % ( msg_html = '<span class="glyphicon glyphicon-shopping-cart"></span> %s&nbsp;&nbsp;&nbsp;<span class="glyphicon glyphicon-exclamation-sign"></span>&nbsp;<span class="glyphicon glyphicon-floppy-remove"></span></a>' % (
order_amount,) order_amount,)
else: else:
msg_html = '<span class="glyphicon glyphicon-shopping-cart"></span> %s&nbsp;&nbsp;&nbsp;<font color="#32CD32"><span class="glyphicon glyphicon-floppy-saved"></span></font></a>' % ( msg_html = '<span class="glyphicon glyphicon-shopping-cart"></span> %s&nbsp;&nbsp;&nbsp;<span class="glyphicon glyphicon-ok"></span></a>' % (
order_amount,) order_amount,)
option_dict = {'id': "#my_basket", 'html': msg_html} option_dict = {'id': "#my_basket", 'html': msg_html}
to_json.append(option_dict) to_json.append(option_dict)
......
...@@ -23,7 +23,7 @@ from repanier.views.forms import AuthRepanierSetPasswordForm, AuthRepanierPasswo ...@@ -23,7 +23,7 @@ from repanier.views.forms import AuthRepanierSetPasswordForm, AuthRepanierPasswo
from repanier.views.like_ajax import like_ajax from repanier.views.like_ajax import like_ajax
from repanier.views.login_view import login_view from repanier.views.login_view import login_view
from repanier.views.logout_view import logout_view from repanier.views.logout_view import logout_view
from repanier.views.me_view import me_view from repanier.views.my_profile_view import my_profile_view
from repanier.views.my_balance_ajax import my_balance_ajax from repanier.views.my_balance_ajax import my_balance_ajax
from repanier.views.order_ajax import order_ajax from repanier.views.order_ajax import order_ajax
from repanier.views.order_class import OrderView from repanier.views.order_class import OrderView
...@@ -128,7 +128,7 @@ urlpatterns = [ ...@@ -128,7 +128,7 @@ urlpatterns = [
url(r'^coordinators/$', send_mail_to_coordinators_view, name='send_mail_to_coordinators_view'), url(r'^coordinators/$', send_mail_to_coordinators_view, name='send_mail_to_coordinators_view'),
url(r'^members/$', send_mail_to_all_members_view, name='send_mail_to_all_members_view'), url(r'^members/$', send_mail_to_all_members_view, name='send_mail_to_all_members_view'),
url(r'^who/$', who_is_who_view, name='who_is_who_view'), url(r'^who/$', who_is_who_view, name='who_is_who_view'),
url(r'^me/$', me_view, name='my_profile_view'), url(r'^me/$', my_profile_view, name='my_profile_view'),
# url(r'^jsi18n/$', JavaScriptCatalog.as_view(), name='javascript-catalog'), # url(r'^jsi18n/$', JavaScriptCatalog.as_view(), name='javascript-catalog'),
url(r'^rest/permanences/$', permanences_rest, name='permanences_rest'), url(r'^rest/permanences/$', permanences_rest, name='permanences_rest'),
url(r'^rest/permanence/(?P<permanence_id>\d+)/(?P<producer_name>.*)/(?P<reference>.*)/$', url(r'^rest/permanence/(?P<permanence_id>\d+)/(?P<producer_name>.*)/(?P<reference>.*)/$',
......
...@@ -26,6 +26,7 @@ def login_view(request, template_name='repanier/registration/login.html', ...@@ -26,6 +26,7 @@ def login_view(request, template_name='repanier/registration/login.html',
""" """
Displays the login form and handles the login action. Displays the login form and handles the login action.
""" """
from repanier.apps import REPANIER_SETTINGS_CONFIG
redirect_to = request.POST.get(redirect_field_name, redirect_to = request.POST.get(redirect_field_name,
request.GET.get(redirect_field_name, EMPTY_STRING)) request.GET.get(redirect_field_name, EMPTY_STRING))
...@@ -51,6 +52,7 @@ def login_view(request, template_name='repanier/registration/login.html', ...@@ -51,6 +52,7 @@ def login_view(request, template_name='repanier/registration/login.html',
redirect_field_name: redirect_to, redirect_field_name: redirect_to,
'site' : current_site, 'site' : current_site,
'site_name' : current_site.name, 'site_name' : current_site.name,
'how_to_register' : REPANIER_SETTINGS_CONFIG.how_to_register
} }
if extra_context is not None: if extra_context is not None:
context.update(extra_context) context.update(extra_context)
......
...@@ -70,7 +70,7 @@ class CustomerValidationForm(NgFormValidationMixin, CustomerForm): ...@@ -70,7 +70,7 @@ class CustomerValidationForm(NgFormValidationMixin, CustomerForm):
@login_required() @login_required()
@csrf_protect @csrf_protect
@never_cache @never_cache
def me_view(request): def my_profile_view(request):
if request.user.is_staff or request.user.is_superuser: if request.user.is_staff or request.user.is_superuser:
raise Http404 raise Http404
else: else:
...@@ -110,9 +110,9 @@ def me_view(request): ...@@ -110,9 +110,9 @@ def me_view(request):
data["email1"] = customer.user.email data["email1"] = customer.user.email
data["email2"] = customer.email2 data["email2"] = customer.email2
form = CustomerValidationForm(data, request=request) form = CustomerValidationForm(data, request=request)
return render(request, "repanier/me_form.html", return render(request, "repanier/my_profile_form.html",
{'form': form, 'membership_fee_valid_until': membership_fee_valid_until, 'update': 'Ok'}) {'form': form, 'membership_fee_valid_until': membership_fee_valid_until, 'update': 'Ok'})
return render(request, "repanier/me_form.html", return render(request, "repanier/my_profile_form.html",
{'form': form, 'membership_fee_valid_until': membership_fee_valid_until, 'update': 'Nok'}) {'form': form, 'membership_fee_valid_until': membership_fee_valid_until, 'update': 'Nok'})
else: else:
form = CustomerValidationForm() # An unbound form form = CustomerValidationForm() # An unbound form
...@@ -141,5 +141,5 @@ def me_view(request): ...@@ -141,5 +141,5 @@ def me_view(request):
field = form.fields["about_me"] field = form.fields["about_me"]
field.initial = customer.about_me field.initial = customer.about_me
return render(request, "repanier/me_form.html", return render(request, "repanier/my_profile_form.html",
{'form': form, 'membership_fee_valid_until': membership_fee_valid_until, 'update': None}) {'form': form, 'membership_fee_valid_until': membership_fee_valid_until, 'update': None})
...@@ -88,7 +88,8 @@ class OrderView(ListView): ...@@ -88,7 +88,8 @@ class OrderView(ListView):
context = super(OrderView, self).get_context_data(**kwargs) context = super(OrderView, self).get_context_data(**kwargs)
context['permanence'] = self.permanence context['permanence'] = self.permanence
context['delivery_id'] = self.delivery_id context['delivery_id'] = self.delivery_id
from repanier.apps import REPANIER_SETTINGS_DISPLAY_PRODUCER_ON_ORDER_FORM, REPANIER_SETTINGS_DISPLAY_ANONYMOUS_ORDER_FORM from repanier.apps import REPANIER_SETTINGS_DISPLAY_PRODUCER_ON_ORDER_FORM, \
REPANIER_SETTINGS_DISPLAY_ANONYMOUS_ORDER_FORM, REPANIER_SETTINGS_CONFIG
if REPANIER_SETTINGS_DISPLAY_PRODUCER_ON_ORDER_FORM: if REPANIER_SETTINGS_DISPLAY_PRODUCER_ON_ORDER_FORM:
producer_set = Producer.objects.filter(permanence=self.permanence.id).only("id", "short_profile_name") producer_set = Producer.objects.filter(permanence=self.permanence.id).only("id", "short_profile_name")
else: else:
...@@ -141,6 +142,10 @@ class OrderView(ListView): ...@@ -141,6 +142,10 @@ class OrderView(ListView):
context['communication'] = self.communication context['communication'] = self.communication
context['q'] = self.q context['q'] = self.q
context['is_anonymous'] = self.is_anonymous context['is_anonymous'] = self.is_anonymous
if self.is_anonymous:
context['how_to_register'] = REPANIER_SETTINGS_CONFIG.how_to_register
else:
context['how_to_register'] = EMPTY_STRING
context['may_order'] = self.may_order context['may_order'] = self.may_order
context['display_anonymous_order_form'] = REPANIER_SETTINGS_DISPLAY_ANONYMOUS_ORDER_FORM context['display_anonymous_order_form'] = REPANIER_SETTINGS_DISPLAY_ANONYMOUS_ORDER_FORM
return context return context
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment