Commit 8bc80575 authored by Patrick's avatar Patrick

Use of django-angular==0.8.4

parent 3c844ea6
from django import forms
from django.contrib.admin.widgets import AdminDateWidget
from django.forms.formsets import formset_factory
from django.utils.translation import ugettext_lazy as _
from djangocms_text_ckeditor.widgets import TextEditorWidget
......@@ -57,7 +58,7 @@ class InvoiceOrderForm(forms.Form):
class PermanenceInvoicedForm(forms.Form):
payment_date = forms.DateField(label=_("payment date"), required=True)
payment_date = forms.DateField(label=_("payment date"), required=True) #, widget=AdminDateWidget())
def __init__(self, *args, **kwargs):
self.payment_date = kwargs.pop('payment_date', None)
......
......@@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: Repanier\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-12-07 17:28+0100\n"
"PO-Revision-Date: 2016-12-07 17:29+0100\n"
"PO-Revision-Date: 2016-12-14 20:08+0100\n"
"Last-Translator: Patrick Colmant <pcolmant@gmail.com>\n"
"Language-Team: Patrick Colmant <pcolmant@gmail.com>\n"
"Language: fr\n"
......@@ -3488,10 +3488,10 @@ msgid ""
"email. You have the choice to specify if your phone and/or mail are visible "
"to others members."
msgstr ""
"Toutes les informations ci-dessous sont visibles de tous les membres excepté "
"votre adresse, vos ✆ et ✉.<br/>Les autres membres voient votre localité qui "
"est encodée séparément de votre adresse.<br/>Vous avez le choix de spécifier "
"si vos ✆ et ✉ sont visibles des autres membres."
"Toutes les informations ci-dessous sont visibles de tous les membres.<br/"
">Les autres membres voient votre localité qui est encodée séparément de "
"votre adresse.<br/>Vous avez le choix de spécifier si vos ✆ et ✉ sont "
"visibles des autres membres."
#: templates/repanier/me_form.html:12
msgid "Your membership fee is valid until"
......@@ -4168,7 +4168,7 @@ msgstr "Destinataire(s)"
#: views/forms.py:199
msgid "Your name"
msgstr "Mon nom (par exemple <b>John Smith</b>)"
msgstr "Je m'appelle"
#: views/forms.py:200
msgid "My phones numbers are visible to all members"
......@@ -4188,11 +4188,11 @@ msgstr "Mes ✉ mail sont visibles à l'ensemble des membres"
#: views/forms.py:205
msgid "Your main email, used for password recovery and login"
msgstr "Mon ✉ mail principal pour me connecter au site"
msgstr "Mon ✉ mail pour me connecter au site"
#: views/forms.py:206
msgid "Your secondary email"
msgstr "Mon ✉ mail secondaire"
msgstr "Mon ✉ mail secondaire (ne permet pas de se connecter au site)"
#: views/forms.py:207
msgid "Your city"
......
/* check boxes : http://bootsnipp.com/snippets/featured/animated-radios-amp-checkboxes-nojs */
.checkbox label:after {
content: '';
display: table;
clear: both;
}
.checkbox .cr {
position: relative;
display: inline-block;
border: 1px solid #a9a9a9;
border-radius: .25em;
width: 1.3em;
height: 1.3em;
float: left;
margin-right: .5em;
}
.checkbox .cr .cr-icon {
position: absolute;
font-size: .8em;
line-height: 0;
top: 50%;
left: 20%;
}
.checkbox label input[type="checkbox"] {
display: none;
}
.checkbox label input[type="checkbox"] + .cr > .cr-icon {
transform: scale(3) rotateZ(-20deg);
opacity: 0;
transition: all .3s ease-in;
}
.checkbox label input[type="checkbox"]:checked + .cr > .cr-icon {
transform: scale(1) rotateZ(0deg);
opacity: 1;
}
.checkbox label input[type="checkbox"]:disabled + .cr {
opacity: .5;
}
\ No newline at end of file
/* Sticky footer styles
-------------------------------------------------- */
/* Sticky footer styles */
html {
position: relative;
min-height: 100%;
......@@ -97,9 +96,7 @@ body > .container {
code {
font-size: 80%;
}
/* automaticaly display menu on mouse over */
ul.nav li.dropdown:hover > ul.dropdown-menu {
display: block;
}
......@@ -121,4 +118,56 @@ a.skip_link{
}
.container-menu {
padding: 0 15px 0;
}
/* django-angular : style.css */
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
display: none !important;
}
form.ng-submitted .ng-invalid,
form .ng-invalid-bound.ng-pristine,
form .ng-invalid.ng-dirty {
border-color: #e9322d;
}
form.ng-submitted .ng-invalid:focus,
form .ng-invalid-bound.ng-pristine:focus,
form .ng-invalid.ng-dirty:focus {
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #ce8483;
}
label.djng-field-required::after {
content: "\00a0*";
}
ul.djng-form-errors, ul.djng-field-errors {
display: inline-block;
list-style-type: none;
margin: 5px 0 0 0;
padding: 0;
}
ul.djng-form-errors li, ul.djng-field-errors li {
color: #e9322d;
}
ul.djng-field-errors li.invalid::before {
content: "\2716";
margin-right: 10px;
}
ul.djng-field-errors li.valid::before {
color: #00c900;
content: "\2714";
}
/* django-angular : bootstrap3.css */
.djng-form-control-feedback {
position: absolute;
text-align: right;
/*top: -5px;*/
top: 36px;
right: 10px;
}
.djng-line-spreader {
height: 20px;
margin-bottom: 10px;
}
.checkbox + ul.djng-field-errors,
.checkbox + ul.djng-field-errors + ul.djng-field-errors {
display: none;
}
\ No newline at end of file
{% load cms_tags sekizai_tags menu_tags compress i18n l10n repanier_tags %}{% spaceless %}
{% addtoblock "css" %}<link rel="stylesheet" href="{{ STATIC_URL}}bootstrap/css/bootstrap.css">{% endaddtoblock %}
{% addtoblock "css" %}<link rel="stylesheet" href="{{ STATIC_URL}}bootstrap/css/custom.css">{% endaddtoblock %}
{% addtoblock "css" %}<link rel="stylesheet" href="{{ STATIC_URL}}css/custom.css">{% endaddtoblock %}
{% addtoblock "jshead" %}<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>{% endaddtoblock %}
{% addtoblock "jshead" %}<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>{% endaddtoblock %}
{% addtoblock "js" %}<script src="{{ STATIC_URL}}fluidvids/fluidvids.js"></script>{% endaddtoblock %}
......@@ -22,9 +22,10 @@
</style>
{% endif %}
{% endaddtoblock %}
{% endspaceless %}<!DOCTYPE html>{%get_current_language as LANGUAGE_CODE%}
<html lang="{{LANGUAGE_CODE}}">
{% endspaceless %}
{%get_current_language as LANGUAGE_CODE%}
<!DOCTYPE html>
<html lang="{{LANGUAGE_CODE}}" ng-app="repanier">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
......@@ -46,6 +47,10 @@
'Class': (typeof Class === 'function') ? Class : undefined,
'API': {}
};
var my_app = undefined;
if (angular) {
my_app = angular.module('repanier', ['djng.forms']);
}
</script>
</head>
<body>
......
......@@ -2,7 +2,7 @@
{% load cms_tags menu_tags compress i18n l10n crispy_forms_tags %}
{% block content %}
<link rel="stylesheet" href="{{ STATIC_URL}}bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="{{ STATIC_URL}}bootstrap/css/custom.css">
<link rel="stylesheet" href="{{ STATIC_URL}}css/custom.css">
<h4>{{ sub_title }}</h4>
<p></p>
<form action="" method="post">{% csrf_token %}
......
......@@ -2,7 +2,7 @@
{% load cms_tags menu_tags compress i18n l10n crispy_forms_tags %}
{% block content %}
<link rel="stylesheet" href="{{ STATIC_URL}}bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="{{ STATIC_URL}}bootstrap/css/custom.css">
<link rel="stylesheet" href="{{ STATIC_URL}}css/custom.css">
<h4>{{ sub_title }}</h4>
<p></p>
<form action="" method="post">{% csrf_token %}
......
......@@ -2,7 +2,7 @@
{% load cms_tags menu_tags i18n l10n %}
{% block content %}
<link rel="stylesheet" href="{{ STATIC_URL}}bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="{{ STATIC_URL}}bootstrap/css/custom.css">
<link rel="stylesheet" href="{{ STATIC_URL}}css/custom.css">
<style type="text/css">
.form-group input[type="checkbox"] {
display: none;
......
......@@ -2,7 +2,7 @@
{% load cms_tags menu_tags compress i18n l10n crispy_forms_tags %}
{% block content %}
<link rel="stylesheet" href="{{ STATIC_URL}}bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="{{ STATIC_URL}}bootstrap/css/custom.css">
<link rel="stylesheet" href="{{ STATIC_URL}}css/custom.css">
<h4>{{ sub_title }}</h4>
<p></p>
<form action="" method="post">{% csrf_token %}
......
......@@ -2,7 +2,7 @@
{% load cms_tags menu_tags compress i18n l10n crispy_forms_tags %}
{% block content %}
<link rel="stylesheet" href="{{ STATIC_URL}}bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="{{ STATIC_URL}}bootstrap/css/custom.css">
<link rel="stylesheet" href="{{ STATIC_URL}}css/custom.css">
<h4>{{ sub_title }}</h4>
<p></p>
<form action="" method="post">{% csrf_token %}
......
......@@ -2,7 +2,7 @@
{% load cms_tags menu_tags compress i18n l10n crispy_forms_tags %}
{% block content %}
<link rel="stylesheet" href="{{ STATIC_URL}}bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="{{ STATIC_URL}}bootstrap/css/custom.css">
<link rel="stylesheet" href="{{ STATIC_URL}}css/custom.css">
<style type="text/css">
.form-group input[type="checkbox"] {
display: none;
......
......@@ -2,7 +2,7 @@
{% load cms_tags menu_tags compress i18n l10n crispy_forms_tags %}
{% block content %}
<link rel="stylesheet" href="{{ STATIC_URL}}bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="{{ STATIC_URL}}bootstrap/css/custom.css">
<link rel="stylesheet" href="{{ STATIC_URL}}css/custom.css">
<h4>{{ sub_title }}</h4>
<p></p>
<form action="" method="post">{% csrf_token %}
......
{% extends "admin/base_site.html" %}
{% load cms_tags menu_tags compress i18n l10n crispy_forms_tags %}
{% load cms_tags menu_tags i18n l10n crispy_forms_tags %}
{% block content %}
<link rel="stylesheet" href="{{ STATIC_URL}}bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="{{ STATIC_URL}}bootstrap/css/custom.css">
<link rel="stylesheet" href="{{STATIC_URL}}bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="{{STATIC_URL}}css/custom.css">
{#<script type="text/javascript" src="/fr/coordi/jsi18n/"></script>#}
{#<script type="text/javascript" src="/static_001/admin/js/core.js"></script>#}
{#<script type="text/javascript" src="/static_001/admin/js/vendor/jquery/jquery.js"></script>#}
{#<script type="text/javascript" src="/static_001/admin/js/jquery.init.js"></script>#}
{#<script type="text/javascript" src="/static_001/admin/js/admin/RelatedObjectLookups.js"></script>#}
{#<script type="text/javascript" src="/static_001/admin/js/actions.js"></script>#}
{#<script type="text/javascript" src="/static_001/admin/js/urlify.js"></script>#}
{#<script type="text/javascript" src="/static_001/admin/js/prepopulate.js"></script>#}
{#<script type="text/javascript" src="/static_001/admin/js/vendor/xregexp/xregexp.js"></script>#}
{#<script type="text/javascript" src="/static_001/admin/js/calendar.js"></script>#}
{#<script type="text/javascript" src="/static_001/admin/js/admin/DateTimeShortcuts.js"></script>#}
<style type="text/css">
.form-group input[type="checkbox"] {
display: none;
......@@ -22,6 +34,10 @@
.form-group input[type="checkbox"]:checked + .btn-group > label span:last-child {
display: none;
}
.button, input[type=submit], input[type=button], .submit-row input, a.button {
color: initial !important;
cursor: initial !important;
}
.colorgraph {
height: 5px;
border-top: 0;
......@@ -33,7 +49,6 @@
background-image: linear-gradient(to right, #c4e17f, #62c2e4);
}
</style>
<h4>{{ sub_title }}</h4>
<p></p>
<form action="" method="post">{% csrf_token %}
......@@ -46,16 +61,16 @@
<fieldset class="module aligned ">
<div class="submit-row">
<div class="form-group">
<h6>{{ permanence_form.non_field_errors }}</h6>
{{ permanence_form.non_field_errors }}
<div class="fieldWrapper">
{% if permanence_form.payment_date.errors %}
<ul class="errorlist">
{% for error in permanence_form.payment_date.errors %}
<li><h6>{{ error|escape }}</h6></li>
<li>{{ error|escape }}</li>
{% endfor %}
</ul>
{% endif %}
<label for="id_payment_date"><h6>{% trans "payment date" %}&nbsp;:</h6></label>
<label for="id_payment_date">{% trans "payment date" %}&nbsp;:</label>
{{ permanence_form.payment_date }}
</div>
</div>
......@@ -87,7 +102,7 @@
<span>&nbsp;</span>
</label>
<label for="id_form-{{ forloop.counter0 }}-selected" class="btn active btn-sm">
{{ f_form.short_profile_name.value }}
{{ f_form.short_profile_name.value | truncatechars:20 }}
{% trans ", calculated : " %}
{{ f_form.calculated_invoiced_balance.value }}
{% trans ", balance claimed by the supplier : " %}
......@@ -116,7 +131,7 @@
{% endfor %}
}
function toggle_producer(source) {
source.checked != source.checked;
source.checked = !source.checked;
all_checked = true;
{% for f_form in producer_invoiced_formset %}
checkbox = document.getElementsByName("form-{{ forloop.counter0 }}-selected");
......@@ -126,4 +141,4 @@
all_checkboxes[0].checked = all_checked;
}
</script>
{% endblock %}
{% endblock %}
\ No newline at end of file
......@@ -2,7 +2,7 @@
{% load cms_tags menu_tags compress i18n l10n crispy_forms_tags %}
{% block content %}
<link rel="stylesheet" href="{{ STATIC_URL}}bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="{{ STATIC_URL}}bootstrap/css/custom.css">
<link rel="stylesheet" href="{{ STATIC_URL}}css/custom.css">
<h4>{% if pre_open %}{% trans "Pre-opening of orders" %}{% else %}{% trans "Opening of orders" %}{% endif %} : {{ permanence }}</h4>
<p></p>
<form action="" method="post">{% csrf_token %}
......
......@@ -2,7 +2,7 @@
{% load cms_tags menu_tags compress i18n l10n crispy_forms_tags %}
{% block content %}
<link rel="stylesheet" href="{{ STATIC_URL}}bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="{{ STATIC_URL}}bootstrap/css/custom.css">
<link rel="stylesheet" href="{{ STATIC_URL}}css/custom.css">
<h4>{{ sub_title }}</h4>
<p></p>
<form action="" method="post">{% csrf_token %}
......
......@@ -2,7 +2,7 @@
{% load cms_tags menu_tags compress i18n l10n crispy_forms_tags %}
{% block content %}
<link rel="stylesheet" href="{{ STATIC_URL}}bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="{{ STATIC_URL}}bootstrap/css/custom.css">
<link rel="stylesheet" href="{{ STATIC_URL}}css/custom.css">
<style type="text/css">
.form-group input[type="checkbox"] {
display: none;
......
......@@ -3,7 +3,7 @@
{% block content %}
{% addtoblock "jshead" %}<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>{% endaddtoblock %}
{% addtoblock "css" %}<link rel="stylesheet" href="{{ STATIC_URL}}bootstrap/css/bootstrap.css">{% endaddtoblock %}
{% addtoblock "css" %}<link rel="stylesheet" href="{{ STATIC_URL}}bootstrap/css/custom.css">{% endaddtoblock %}
{% addtoblock "css" %}<link rel="stylesheet" href="{{ STATIC_URL}}css/custom.css">{% endaddtoblock %}
<h4>{{ sub_title }}</h4>
<p></p>
<form enctype="multipart/form-data" action="" method="post">{% csrf_token %}
......
{% extends 'cms_subpage.html' %}
{% load cms_tags sekizai_tags i18n l10n %}
{% addtoblock "jshead" %}
<script type="text/javascript">if (typeof CMS === 'undefined') {
CMS.$ = $
}</script>{% endaddtoblock %}
{% load static cms_tags sekizai_tags i18n l10n %}
{% block sub_content %}
{% if update == "Ok" %}<p class="bg-success" style="color: #cec7c7"><strong>{% trans "Update done." %}</strong></p>{% endif %}
{% if update == "Nok" %}<div class="has-error"><span class="help-block"><strong>{% trans "Update not done." %}</strong></span></div>{% endif %}
<p>{% trans "All informations bellow are visible to all members except your phone and email. You have the choice to specify if your phone and/or mail are visible to others members." %}</p>
<p>{% if membership_fee_valid_until %}<i>{% trans "Your membership fee is valid until" %} : <u>{{ membership_fee_valid_until }}</u></i>{% endif %}</p>
<form method="post" action="." validate>
{% csrf_token %}
{{ form.as_div }}
<div class="form-group"><label class="control-label">&nbsp;</label></div>
<div class="form-group"><button type="submit" class="btn btn-primary">{% trans "Update" %}</button></div>
</form>
{% if update == "Ok" %}<p class="bg-success" style="color: #cec7c7"><strong>{% trans "Update done." %}</strong></p>{% endif %}
{% if update == "Nok" %}<div class="has-error"><span class="help-block"><strong>{% trans "Update not done." %}</strong></span></div>{% endif %}
<p>{% trans "All informations bellow are visible to all members except your phone and email. You have the choice to specify if your phone and/or mail are visible to others members." %}</p>
<p>{% if membership_fee_valid_until %}<i>{% trans "Your membership fee is valid until" %} : <u>{{ membership_fee_valid_until }}</u></i>{% endif %}</p>
<form name="{{ form.form_name }}" method="post" action="." validate>
{% csrf_token %}
{{ form.as_div }}
<div class="form-group"><label class="control-label">&nbsp;</label></div>
<div class="form-group"><button type="submit" ng-disabled="{{ form.form_name }}.$invalid" class="btn btn-primary">{% trans "Update" %}</button></div>
</form>
{% addtoblock "css" %}{{ form.media.css }}{% endaddtoblock %}
{% addtoblock "jshead" %}{{ form.media.js }}{% endaddtoblock %}
{% endblock %}
\ No newline at end of file
{% extends 'cms_subpage.html' %}
{% load cms_tags sekizai_tags i18n l10n %}
{% block sub_content %}
{% if coordinator %}
<div class="bg-danger">
<blockquote><small>
{% trans "This message will be send to all members as coordinator." %}
</small></blockquote>
</div>
{% else %}
{% trans "This message will be send only to members who accept to show they email." %}
{% endif %}
<form method="post" action="." validate>
{% csrf_token %}
{{ form.as_div }}
<div class="form-group"><button type="submit" class="btn btn-primary">{% trans "Send e-mail" %}</button></div>
</form>
{% if coordinator %}
<div class="bg-danger">
<blockquote><small>
{% trans "This message will be send to all members as coordinator." %}
</small></blockquote>
</div>
{% else %}
{% trans "This message will be send only to members who accept to show they email." %}
{% endif %}
<form name="{{ form.form_name }}" method="post" action="." validate>
{% csrf_token %}
{{ form.as_div }}
<div class="form-group"><button type="submit" ng-disabled="{{ form.form_name }}.$invalid" class="btn btn-primary">{% trans "Send e-mail" %}</button></div>
</form>
{% addtoblock "css" %}{{ form.media.css }}{% endaddtoblock %}
{% addtoblock "jshead" %}{{ form.media.js }}{% endaddtoblock %}
{% endblock %}
\ No newline at end of file
......@@ -2,10 +2,12 @@
{% load cms_tags sekizai_tags i18n l10n %}
{% block sub_content %}
{% if update %}<p class="bg-danger">{% trans "Which coordinator(s) have you selected ?" %}</p>{% endif %}
<p>{% trans "This message will be send only to coordinators you have selected." %}</p>
<form method="post" action="." validate>
{% csrf_token %}
{{ form.as_div }}
<div class="form-group"><button type="submit" class="btn btn-primary">{% trans "Send e-mail" %}</button></div>
</form>
<p><b>{% trans "This message will be send only to coordinators you have selected." %}</b></p>
<form name="{{ form.form_name }}" method="post" action="." validate>
{% csrf_token %}
{{ form.as_div }}
<div class="form-group"><button type="submit" ng-disabled="{{ form.form_name }}.$invalid" class="btn btn-primary">{% trans "Send e-mail" %}</button></div>
</form>
{% addtoblock "css" %}{{ form.media.css }}{% endaddtoblock %}
{% addtoblock "jshead" %}{{ form.media.js }}{% endaddtoblock %}
{% endblock %}
\ No newline at end of file
{% load cms_tags sekizai_tags i18n l10n repanier_tags thumbnail filer_tags filer_image_tags %}
<div data-id="{{ offer.id|unlocalize }}" class="btn btn-primary" onclick="window.open('http://www.google.be', '{% trans "Preview" %}', 'height=500,width=800,resizable=yes,scrollbars=no');">
{% trans "Preview" %}
</div>
<span id="id_preview_product_order"></span>
{#<script type="text/javascript">#}
{#function refresh_preview(event) {#}
{# t_row=$(event.relatedTarget);#}
{# var getIdFromRow = t_row.data('id');#}
{# t_row.attr('class', 'danger');#}
{# var lien = '{% url 'preview_product_order_ajax' producer.offer_uuid %}/' + getIdFromRow + '/';#}
{# $.ajax({#}
{# url: lien,#}
{# cache: false,#}
{# async: false,#}
{# success: function (result) {#}
{# $('span.id_preview_product_order').html(result)#}
{# },#}
{# error: function (result) {#}
{# $('span.id_preview_product_order').html($('{% trans "Communication error" %}'));#}
{# }#}
{# });#}
{#}#}
{#</script>#}
\ No newline at end of file
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit
# -*- coding: utf-8
from __future__ import unicode_literals
from djng.styling.bootstrap3.forms import Bootstrap3Form
from django import forms
from django.conf import settings
from django.contrib.auth import authenticate, get_user_model
from django.contrib.auth import authenticate
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.forms import PasswordResetForm, SetPasswordForm
from django.contrib.auth.models import User
......@@ -15,12 +17,10 @@ from django.utils import timezone
from django.utils import translation
from django.utils.translation import ugettext_lazy as _
from djangocms_text_ckeditor.widgets import TextEditorWidget
from parler.models import TranslationDoesNotExist
import repanier.apps
from repanier.const import DECIMAL_ONE, DECIMAL_ZERO, LUT_PRODUCER_PRODUCT_ORDER_UNIT, EMPTY_STRING, DEMO_EMAIL
from repanier.models import LUT_ProductionMode, Staff, Customer, Configuration
from repanier.picture.const import SIZE_M, SIZE_S
from repanier.picture.const import SIZE_M
from repanier.picture.widgets import AjaxPictureWidget
from repanier.widget.select_bootstrap import SelectBootstrapWidget
from repanier.widget.select_producer_order_unit import SelectProducerOrderUnitWidget
......@@ -151,85 +151,14 @@ class AuthRepanierSetPasswordForm(SetPasswordForm):
return self.user
class CoordinatorsContactForm(forms.Form):
def __init__(self, *args, **kwargs):
super(CoordinatorsContactForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_id = 'contact_form'
self.helper.form_class = 'form-horizontal'
self.helper.label_class = 'col-lg-2'
self.helper.field_class = 'col-lg-10'
for staff in Staff.objects.filter(is_active=True, is_contributor=False):
r = staff.customer_responsible
if r is not None:
try:
sender_function = staff.long_name
except TranslationDoesNotExist:
sender_function = EMPTY_STRING
if r.long_basket_name is not None:
signature = "%s : %s" % (sender_function, r.long_basket_name)
else:
signature = "%s :%s" % (sender_function, r.short_basket_name)
self.fields["staff_%d" % staff.id] = forms.BooleanField(label=signature, required=False)
self.fields["your_email"] = forms.EmailField(label=_('Your Email'))
self.fields["subject"] = forms.CharField(label=_('Subject'))
self.fields["message"] = forms.CharField(label=_('Message'), widget=Textarea)
self.helper.add_input(Submit('submit', _('Send e-mail')))
class MembersContactForm(forms.Form):
recipient = forms.CharField(label=_('Recipient(s)'))
your_email = forms.EmailField(label=_('Your Email'))
subject = forms.CharField(label=_('Subject'))
message = forms.CharField(label=_('Message'), widget=Textarea)
def __init__(self, *args, **kwargs):
super(MembersContactForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_id = 'contact_form'
self.helper.form_class = 'form-horizontal'
self.helper.label_class = 'col-lg-2'
self.helper.field_class = 'col-lg-10'
self.helper.add_input(Submit('submit', _('Send e-mail')))
class CustomerForm(forms.Form):
# error_css_class = 'has-warning'
class RepanierForm(Bootstrap3Form):
required_css_class = 'djng-field-required'
long_basket_name = forms.CharField(label=_("Your name"), max_length=100)
accept_phone_call_from_members = forms.BooleanField(label=_('My phones numbers are visible to all members'),
required=False)
phone1 = forms.CharField(label=_('Your main phone'), max_length=25)
phone2 = forms.CharField(label=_('Your secondary phone'), max_length=25, required=False)
accept_mails_from_members = forms.BooleanField(label=_('My emails are visible to all members'), required=False)
email1 = forms.EmailField(label=_('Your main email, used for password recovery and login'))
email2 = forms.EmailField(label=_('Your secondary email'), required=False)
city = forms.CharField(label=_('Your city'), max_length=50, required=False)
address = forms.CharField(label=_('address'), widget=Textarea(attrs={'cols': '40', 'rows': '3'}), required=False)
picture = forms.CharField(
label=_("picture"),
widget=AjaxPictureWidget(upload_to="customer", size=SIZE_S, bootstrap=True),
required=False)
about_me = forms.CharField(label=_('About me'), widget=TextEditorWidget, required=False)
def clean_email1(self):
email1 = self.cleaned_data['email1']
user_model = get_user_model()
user = user_model.objects.filter(email=email1).order_by('?').first()
if user is not None and user.id != self.request.user.id:
self.add_error('email1', _('The given email is used by another user'))
return email1
def __init__(self, *args, **kwargs):
self.request = kwargs.pop('request', None)
super(CustomerForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_id = 'customer_form'
self.helper.form_class = 'form-horizontal'
self.helper.label_class = 'col-lg-2'
self.helper.field_class = 'col-lg-10'
self.helper.add_input(Submit('submit', _('Update')))
class Media:
js = (
'https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js',
'djng/js/django-angular.js'
)
class ProducerProductForm(forms.Form):
......
......@@ -3,15 +3,68 @@ from __future__ import unicode_literals
from os import sep as os_sep
from django import forms
from django.contrib.auth import (get_user_model)
from django.contrib.auth.decorators import login_required
from django.http import Http404
from django.shortcuts import render
from django.utils.translation import ugettext_lazy as _
from django.views.decorators.cache import never_cache
from django.views.decorators.csrf import csrf_protect
from djangocms_text_ckeditor.widgets import TextEditorWidget
from djng.forms import NgFormValidationMixin
from repanier.const import DECIMAL_ZERO
from forms import CustomerForm
from repanier.const import DECIMAL_ZERO, EMPTY_STRING
from repanier.picture.const import SIZE_S
from repanier.picture.widgets import AjaxPictureWidget
from repanier.views.forms import RepanierForm
from repanier.widget.checkbox import CheckboxWidget
class CustomerForm(RepanierForm):
long_basket_name = forms.CharField(label=_("Your name"), max_length=100)