Index: trunk/www/www/forms.py =================================================================== diff -u --- trunk/www/www/forms.py (revision 0) +++ trunk/www/www/forms.py (revision 13) @@ -0,0 +1,6 @@ +from django import forms + +class ContactForm(forms.Form): + from_email = forms.EmailField(required=True, label="Courriel") + subject = forms.CharField(required=True, label="Sujet") + message = forms.CharField(widget=forms.Textarea, required=True, label="Message") Index: trunk/www/ordipourtous/templates/ordi-pour-tous-home.html =================================================================== diff -u --- trunk/www/ordipourtous/templates/ordi-pour-tous-home.html (revision 0) +++ trunk/www/ordipourtous/templates/ordi-pour-tous-home.html (revision 13) @@ -0,0 +1,19 @@ +{% extends "base.html" %} +{% load static %} + +{% block content %} +
+

Initiative

+

Un ordinateur, un écran voir une imprimante peut s'avérer nécessaire dans cette période de confinement.

+

Vous avez peut-être besoin de matériel ou vous avez peut-être du matériel qui prend la poussière qui fonctionne on qui ne fonctionne plus. Notre initiative dans cette période de confinement est de rendre service aux particuliers.

+

Si vous avez du matériel que vous n'utilisez plus, nous prendrons contact avec vous pour récupérer votre matériel, nous nous engageons à effacer toutes les données avant de le reconditionner. Cliquez sur le bouton ci-dessous.

+
+ +
+

Si vous avez besoin de matériel, nous prendrons contact avec vous afin de déterminer vos besoins et vous céder le matériel en stock le plus adpaté. Cliquez sur le bouton ci-dessous.

+
+ +
+

IMPORTANT: cette initiative dans le cadre du covid n'est aucun cas lucrative et nous n'utiliserons aucunes des informations communiquées à des fins commerciales.

+
+{% endblock content %} Fisheye: Tag 13 refers to a dead (removed) revision in file `trunk/www/ordipourtous/templates/home.html'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/www/www/settings.py =================================================================== diff -u -r12 -r13 --- trunk/www/www/settings.py (.../settings.py) (revision 12) +++ trunk/www/www/settings.py (.../settings.py) (revision 13) @@ -23,7 +23,7 @@ SECRET_KEY = '30m!gi4%622f_(2w+sbh_lh9gh)vw9tl$^j5et+0!1att=8s=l' # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +DEBUG = False ALLOWED_HOSTS = [ 'www.accrosys.com', @@ -61,9 +61,10 @@ TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], + 'DIRS': [os.path.join(BASE_DIR, 'templates'),], 'APP_DIRS': True, 'OPTIONS': { + 'builtins': [ 'templatetags.myfilters' ], 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', @@ -82,6 +83,13 @@ DATABASES = { 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'NAME': 'wwwdb', + 'USER': 'wwwuser', + 'PASSWORD': '5Edqt.U2rbr.gd7Sn', + 'HOST': '/var/run/postgresql', + }, + 'sqlite3': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } @@ -110,7 +118,7 @@ # Internationalization # https://docs.djangoproject.com/en/3.0/topics/i18n/ -LANGUAGE_CODE = 'en-us' +LANGUAGE_CODE = 'fr-FR' TIME_ZONE = 'UTC' @@ -134,3 +142,4 @@ EMAIL_HOST_USER='services@accrosys.com' EMAIL_HOST_PASSWORD='7Upqu.sQ6qq.5Vxve' EMAIL_USE_SSL=True +EMAIL_TO=['services@accrosys.com',] Index: trunk/www/templates/email.html =================================================================== diff -u --- trunk/www/templates/email.html (revision 0) +++ trunk/www/templates/email.html (revision 13) @@ -0,0 +1,17 @@ +{% extends "base.html" %} +{% load static %} +{% load crispy_forms_tags %} + +{% block title %}Contact{% endblock %} + +{% block content %} +

Contact

+
+ {% csrf_token %} + {{ form | crispy }} +
+ +
+
+{% endblock content %} + Index: trunk/www/www/views.py =================================================================== diff -u --- trunk/www/www/views.py (revision 0) +++ trunk/www/www/views.py (revision 13) @@ -0,0 +1,37 @@ +from django.shortcuts import render, redirect +from django.http import HttpResponse, HttpResponseRedirect +from django.views.generic import TemplateView +from django.conf import settings + +# Create your views here. + +class HomeView(TemplateView): + template_name = 'home.html' + +class NumerisationView(TemplateView): + template_name = 'numerisation.html' + +class DepannageView(TemplateView): + template_name = 'depannage.html' + +from .forms import ContactForm +from django.core.mail import send_mail, BadHeaderError + +def ContactView(request): + if request.method == 'GET': + form = ContactForm() + else: + form = ContactForm(request.POST) + if form.is_valid(): + subject = form.cleaned_data['subject'] + from_email = form.cleaned_data['from_email'] + message = form.cleaned_data['message'] + try: + send_mail("[contact] - " + subject, message, from_email, settings.EMAIL_TO) + except BadHeaderError: + return HttpResponse('Invalid header found.') + return redirect('success') + return render(request, "email.html", {'form': form}) + +class SuccessView(TemplateView): + template_name = 'success.html' Index: trunk/www/static/images/logo-chouette-accrosys-197x190.png =================================================================== diff -u Binary files differ Index: trunk/www/templates/success.html =================================================================== diff -u --- trunk/www/templates/success.html (revision 0) +++ trunk/www/templates/success.html (revision 13) @@ -0,0 +1,17 @@ +{% extends "base.html" %} +{% load static %} + +{% block title %}Confirmation{% endblock %} + +{% block content %} + +
+
+
+

Les informations ont été enregistrées, nous allons reprendre contact avec vous.

+
+ Accrosys +
+
+ +{% endblock content %} Index: trunk/www/templates/base.html =================================================================== diff -u --- trunk/www/templates/base.html (revision 0) +++ trunk/www/templates/base.html (revision 13) @@ -0,0 +1,67 @@ +{% load static %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {% block title %}{% endblock %} + + +

+ +

+
+
+
+ {% block content %} {% endblock %} +
+
+
+ + Index: trunk/www/templates/numerisation.html =================================================================== diff -u --- trunk/www/templates/numerisation.html (revision 0) +++ trunk/www/templates/numerisation.html (revision 13) @@ -0,0 +1,39 @@ +{% extends "base.html" %} +{% load static %} + +{% block title %}Service Numérisation{% endblock%} + +{% block content %} +

Vous avez des photos/diapos qui prennent la poussière ? vous aimeriez partager ces souvenirs en envoyant des clés USB à vos proches ? nous vous proposons de numériser vos documents et de les classer pour vous selon vos critères.contactez-nous pour prendre rendez-vous afin d'établir vos besoins.

+ +
+

Tarifs Diapos/Photos

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Quantité de documentsPrix Unitaire TTC
Jusqu'à 25 diapos/photos1€
Jusqu'à 50 diapos/photos0.75€
Jusqu'à 200 diapos/photos0.50€
Au delàNous consulter
+
+Les documents numérisés vous seront remis sur deux DVDs identiques +{% endblock content %} Index: trunk/www/templatetags/__init__.py =================================================================== diff -u --- trunk/www/templatetags/__init__.py (revision 0) +++ trunk/www/templatetags/__init__.py (revision 13) @@ -0,0 +1 @@ \ No newline at end of file Index: trunk/www/static/css/base.css =================================================================== diff -u --- trunk/www/static/css/base.css (revision 0) +++ trunk/www/static/css/base.css (revision 13) @@ -0,0 +1,32 @@ +h1{ + display:flex; + justify-content:flex-start; +} + +.form_main_middle{ + display:flex; + flex-direction:column; + align-items:center; + margin:10px; +} + +.button_main_middle{ + width:300px; + height:40px; + margin:20px; + border: 1px black solid; + border-radius:4px; +} + +/* Couleur utilisée pour les liens */ +.navbar-nav > li > a { + color: white; +} + +/* Couleur utilisée pour les liens lorsque la souris passe dessus ou que le lien est actif */ +.navbar-nav > li > .active, +.navbar-nav > li > a:hover, +.navbar-nav > li > a:focus { + color: orange; +} + Index: trunk/www/ordipourtous/models.py =================================================================== diff -u -r12 -r13 --- trunk/www/ordipourtous/models.py (.../models.py) (revision 12) +++ trunk/www/ordipourtous/models.py (.../models.py) (revision 13) @@ -16,7 +16,7 @@ computer_ok = models.BooleanField(verbose_name='Ordinateur complet ou PC portable') printer_ok = models.BooleanField('Une imprimante') screen_ok = models.BooleanField('Un Ecran') - something_is_broken = models.BooleanField('Quelque chose est cassé') + something_is_broken = models.BooleanField('Quelque chose ne fonctionne plus') other = models.BooleanField(verbose_name='Autre ... (à préciser dans les commentaires)') name = models.CharField(max_length=40, verbose_name='Nom/Prénom', null=True, blank=True) email = models.EmailField(max_length=60, verbose_name='Courriel') Index: trunk/www/static/images/logo-accrosys-57x81.png =================================================================== diff -u -r12 -r13 Binary files differ Fisheye: Tag 13 refers to a dead (removed) revision in file `trunk/www/ordipourtous/templates/givenitems.html'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/www/ordipourtous/templates/ordi-pour-tous-givenitems.html =================================================================== diff -u --- trunk/www/ordipourtous/templates/ordi-pour-tous-givenitems.html (revision 0) +++ trunk/www/ordipourtous/templates/ordi-pour-tous-givenitems.html (revision 13) @@ -0,0 +1,10 @@ +{% extends "base.html" %} +{% load static %} +{% load crispy_forms_tags %} + +{% block content %} +
+

J'ai du matériel à céder

+
+ {% crispy form %} +{% endblock content %} Index: trunk/www/ordipourtous/templates/ordi-pour-tous-neededitems.html =================================================================== diff -u --- trunk/www/ordipourtous/templates/ordi-pour-tous-neededitems.html (revision 0) +++ trunk/www/ordipourtous/templates/ordi-pour-tous-neededitems.html (revision 13) @@ -0,0 +1,11 @@ +{% extends "base.html" %} +{% load static %} +{% load crispy_forms_tags %} + +{% block content %} +
+

J'ai besoin de quelque chose

+
+ {% crispy form %} +{% endblock content %} + Index: trunk/www/templates/contact.html =================================================================== diff -u --- trunk/www/templates/contact.html (revision 0) +++ trunk/www/templates/contact.html (revision 13) @@ -0,0 +1,8 @@ +{% extends "base.html" %} +{% load static %} + +{% block title %}Contact{% endblock%} + +{% block content %} +home +{% endblock content %} Fisheye: Tag 13 refers to a dead (removed) revision in file `trunk/www/ordipourtous/templates/apropos.html'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/www/db.sqlite3 =================================================================== diff -u -r12 -r13 Binary files differ Index: trunk/www/static/images/logo-accrosys-35x45.png =================================================================== diff -u Binary files differ Index: trunk/www/ordipourtous/templates/ordi-pour-tous-base.html =================================================================== diff -u -r12 -r13 --- trunk/www/ordipourtous/templates/ordi-pour-tous-base.html (.../ordi-pour-tous-base.html) (revision 12) +++ trunk/www/ordipourtous/templates/ordi-pour-tous-base.html (.../ordi-pour-tous-base.html) (revision 13) @@ -1,23 +1,37 @@ {% load static %} +{% load myfilters %} - - Ordi Pour Tous + + + + + + Ordi Pour Tous +

+ +

-

Ordi Pour Tous

- -
{% block content %} {% endblock %}
- A propos ...
Index: trunk/www/www/urls.py =================================================================== diff -u -r12 -r13 --- trunk/www/www/urls.py (.../urls.py) (revision 12) +++ trunk/www/www/urls.py (.../urls.py) (revision 13) @@ -15,8 +15,14 @@ """ from django.contrib import admin from django.urls import path, include +from .views import HomeView, NumerisationView, DepannageView, ContactView, SuccessView urlpatterns = [ path('admin/', admin.site.urls), + path('', HomeView.as_view()), path('ordipourtous/', include('ordipourtous.urls')), + path('numerisation/', NumerisationView.as_view()), + path('depannage/', DepannageView.as_view()), + path('contact/', ContactView), + path('success/', SuccessView.as_view(), name='success'), ] Index: trunk/www/templates/depannage.html =================================================================== diff -u --- trunk/www/templates/depannage.html (revision 0) +++ trunk/www/templates/depannage.html (revision 13) @@ -0,0 +1,52 @@ +{% extends "base.html" %} +{% load static %} + +{% block title %}Service Dépannage{% endblock%} + +{% block content %} +

Un ordinateur qui ne démarre plus, une boite aux lettres qui ne fonctionne plus, un virus informatique vous empêche d'utiliser votre ordinateur ?, contactez-nous pour déterminer l'origine de la panne.

+ +
+

Tarifs pour les particuliers

+

Possibilité d'établir un devis gratuit sur demande

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type d'interventionDépannageTarif TTC
Panne sur matériel connecté à internetA distance par prise de contrôle de l'ordinateur30€ jusqu'à 1h, 75€ pour 2h, au dela, forfait 100€
Panne sans possibilité d'intervention à distanceRécupération du matériel à domicile/Intervention à domicileentre 50€ 150€, hors matériel
Optimisation du PC, remplacement de composants matérielRécupération du matériel à domicile/Intervention à domicileentre 50€ 100€, hors matériel
Réinstallation du système d'exploitationRécupération du matériel à domicileforfait: 100€
Récupération de données d'un disque défectueuxRécupération du matériel à domicileforfait: 100€
+

Tarifs pour les entreprises

+ Nous contacter. +
+ +{% endblock content %} Fisheye: Tag 13 refers to a dead (removed) revision in file `trunk/www/ordipourtous/templates/tobecontinued.html'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/www/ordipourtous/urls.py =================================================================== diff -u -r12 -r13 --- trunk/www/ordipourtous/urls.py (.../urls.py) (revision 12) +++ trunk/www/ordipourtous/urls.py (.../urls.py) (revision 13) @@ -1,10 +1,9 @@ from django.urls import path, include -from .views import OrdipourtousView, GivenItemsView, ToBeContinuedView, AProposView +from .views import OrdipourtousView, GivenItemsView, NeededItemsView urlpatterns = [ path('', OrdipourtousView.as_view(), name='ordipourtous'), - path('apropos', AProposView.as_view(), name='apropos'), - path('asuivre', ToBeContinuedView.as_view(), name='asuivre'), path('jedonne', GivenItemsView.as_view(), name='jedonne'), + path('jaibesoin', NeededItemsView.as_view(), name='jaibesoin'), ] Index: trunk/www/templatetags/myfilters.py =================================================================== diff -u --- trunk/www/templatetags/myfilters.py (revision 0) +++ trunk/www/templatetags/myfilters.py (revision 13) @@ -0,0 +1,23 @@ +from django import template + +register = template.Library() +@register.filter(name='my_field_type') +def my_field_type(field, ftype): + try: + t = field.field.widget.__class__.__name__ + return t.lower() == ftype + except: + pass + return False + +# from: https://stackoverflow.com/questions/340888/navigation-in-django +@register.simple_tag +def my_active(request, pattern): + import re + if re.search(pattern, request.path): + return 'active' + return '' + +@register.simple_tag +def my_home_url(request): + return request.build_absolute_uri('/')[:-1] Fisheye: Tag 13 refers to a dead (removed) revision in file `trunk/www/static/css/ordi-pour-tous.css'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/www/templates/home.html =================================================================== diff -u --- trunk/www/templates/home.html (revision 0) +++ trunk/www/templates/home.html (revision 13) @@ -0,0 +1,18 @@ +{% extends "base.html" %} +{% load static %} + +{% block title %}Accrosys{% endblock%} + +{% block content %} +
+

Bienvenue

+

Implanté à Vendenheim, à quelques pas de Strasbourg, Accrosys a été fondé en 2000. Nous intervenons principalement auprès des entreprises mais notre expertise s'ouvre également aux particuliers.

+

Entreprises

+

Spécialisé dans le développement d'applications, automatisation de tests, gestion de site internet, administration système et securité.

+

Particuliers

+

Service de dépannage, conseils, formations, numérisation de photos et diapositives.

+

Contact

+

Une question ? n'hésitez pas à prendre contact avec nous.

+ + +{% endblock content %} Index: trunk/www/ordipourtous/views.py =================================================================== diff -u -r12 -r13 --- trunk/www/ordipourtous/views.py (.../views.py) (revision 12) +++ trunk/www/ordipourtous/views.py (.../views.py) (revision 13) @@ -2,26 +2,18 @@ from django.http import HttpResponse, HttpResponseRedirect from django.views.generic import TemplateView from django.views.generic.edit import CreateView +from django.conf import settings # Create your views here. class OrdipourtousView(TemplateView): - template_name = 'home.html' + template_name = 'ordi-pour-tous-home.html' -class ToBeContinuedView(TemplateView): - template_name = 'tobecontinued.html' +from .models import GivenItems, NeededItems -class AProposView(TemplateView): - template_name = 'apropos.html' +class ItemsViewBase(CreateView): + success_url = "/success" -from .models import GivenItems - -class GivenItemsView(CreateView): - model = GivenItems - template_name = 'givenitems.html' - fields = [ 'computer_ok', 'computer_nok', 'printer_ok', 'screen_ok', 'other', 'name', 'email', 'phone', 'comments' ] - success_url = "asuivre" - def form_valid(self, form): self.object = form.save() # print("success", dir(self.object), dir(form)) @@ -30,23 +22,23 @@ for f in self.fields: body += f + ':' + str(getattr(self.object, f)) + "\n" send_mail( - '[ordipourtous] - matériel disponible - ' + " ".join(str(self.object.name)[:30].split()), + '[ordipourtous] - ' + self.email_pre_subject + ' - ' + " ".join(str(self.object.name)[:30].split()), body, 'ordipourtous@accrosys.com', - ['services@accrosys.com'], + settings.EMAIL_TO, fail_silently=False, ) return HttpResponseRedirect(self.get_success_url()) def get_form(self, form_class=None): if form_class is None: form_class = self.get_form_class() - form = super(GivenItemsView, self).get_form(form_class) + form = super(ItemsViewBase, self).get_form(form_class) from crispy_forms.helper import FormHelper form.helper = FormHelper() # Moving field labels into placeholders - from crispy_forms.layout import Layout, Field, Submit + from crispy_forms.layout import Layout, Field, Submit, ButtonHolder form.helper.layout = Layout() for field_name, field in form.fields.items(): # print("get_form", field_name, field.label, dir(field), field.widget.__class__.__name__) @@ -56,5 +48,21 @@ else: form.helper.layout.append(Field(field_name)) # form.helper.form_show_labels = False - form.helper.add_input(Submit('submit', 'Envoyer')) + form.helper.layout.append( + ButtonHolder( + Submit('submit', 'Envoyer', css_class='btn btn-dark'), + css_class='text-center'), + ) return form + +class GivenItemsView(ItemsViewBase): + model = GivenItems + template_name = 'ordi-pour-tous-givenitems.html' + fields = [ 'computer_ok', 'computer_nok', 'printer_ok', 'screen_ok', 'other', 'name', 'email', 'phone', 'comments' ] + email_pre_subject = 'matériel disponible' + +class NeededItemsView(ItemsViewBase): + model = NeededItems + template_name = 'ordi-pour-tous-neededitems.html' + fields = [ 'computer_ok', 'printer_ok', 'screen_ok', 'something_is_broken', 'other', 'name', 'email', 'phone', 'comments' ] + email_pre_subject = 'besoin de quelque chose' Fisheye: Tag 13 refers to a dead (removed) revision in file `trunk/www/ordipourtous/templatetags/myfilters.py'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 13 refers to a dead (removed) revision in file `trunk/www/ordipourtous/templatetags/__init__.py'. Fisheye: No comparison available. Pass `N' to diff?