Commit 007bff84 authored by Myriam Begel's avatar Myriam Begel

Site en prod

parent 2baa7f7e
*.pyc
*~
*.jpg
*.png
*.ico
*.mp4
*.ogv
*.avi
*.wmv
*.webm
*.jepg
*.gif
*.JPG
File mode changed from 100644 to 100755
No preview for this file type
from django.contrib import admin
from faq.models import Question
# Register your models here.
admin.site.register(Question)
No preview for this file type
# -*- coding: utf-8 -*-
from django import forms
class PoserQ(forms.Form):
auteur = forms.CharField(max_length=50, label="Votre nom ")
mail = forms.EmailField(label="Votre adresse mail ", required=False)
question = forms.CharField(widget=forms.Textarea, label="Votre question ")
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Question',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('question', models.TextField()),
('auteurQ', models.CharField(max_length=42)),
('reponse', models.TextField(null=True)),
('auteurR', models.CharField(max_length=42)),
('date', models.DateTimeField(auto_now_add=True, verbose_name=b'Date de parution')),
],
options={
},
bases=(models.Model,),
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('faq', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='question',
name='auteurR',
field=models.CharField(max_length=42, null=True),
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('faq', '0002_auto_20150723_1912'),
]
operations = [
migrations.AddField(
model_name='question',
name='mail',
field=models.EmailField(max_length=75, null=True),
preserve_default=True,
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('faq', '0003_question_mail'),
]
operations = [
migrations.AlterField(
model_name='question',
name='auteurR',
field=models.CharField(max_length=42, null=True, blank=True),
),
migrations.AlterField(
model_name='question',
name='mail',
field=models.EmailField(max_length=75, null=True, blank=True),
),
migrations.AlterField(
model_name='question',
name='reponse',
field=models.TextField(null=True, blank=True),
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('faq', '0004_auto_20150724_2030'),
]
operations = [
migrations.AlterField(
model_name='question',
name='mail',
field=models.EmailField(max_length=254, null=True, blank=True),
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('faq', '0005_auto_20150816_0914'),
]
operations = [
migrations.AlterField(
model_name='question',
name='mail',
field=models.EmailField(max_length=75, null=True, blank=True),
),
]
File mode changed from 100644 to 100755
No preview for this file type
# -*- coding: utf-8 -*-
from django.db import models
# Create your models here.
class Question(models.Model):
question = models.TextField()
auteurQ = models.CharField(max_length=42)
reponse = models.TextField(null=True, blank=True)
auteurR = models.CharField(max_length=42, null=True, blank=True)
date = models.DateTimeField(auto_now_add=True, auto_now=False,
verbose_name="Date de parution")
mail = models.EmailField(null=True, blank=True)
def __unicode__(self):
return u'%s' %(self.question)
\ No newline at end of file
No preview for this file type
{% extends "admin/base_site.html" %}
{% load i18n %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
&rsaquo; {% trans 'Documentation' %}</a>
</div>
{% endblock %}
{% block title %}{% trans 'Documentation' %}{% endblock %}
{% block content %}
<h1>{% trans 'Documentation' %}</h1>
<div id="content-main">
<h3><a href="tags/">{% trans 'Tags' %}</a></h3>
<p>{% trans 'List of all the template tags and their functions.' %}</p>
<h3><a href="filters/">{% trans 'Filters' %}</a></h3>
<p>{% trans 'Filters are actions which can be applied to variables in a template to alter the output.' %}</p>
<h3><a href="models/">{% trans 'Models' %}</a></h3>
<p>{% trans 'Models are descriptions of all the objects in the system and their associated fields. Each model has a list of fields which can be accessed as template variables' %}.</p>
<h3><a href="views/">{% trans 'Views' %}</a></h3>
<p>{% trans 'Each page on the public site is generated by a view. The view defines which template is used to generate the page and which objects are available to that template.' %}</p>
<h3><a href="bookmarklets/">{% trans 'Bookmarklets' %}</a></h3>
<p>{% trans 'Tools for your browser to quickly access admin functionality.' %}</p>
</div>
{% endblock %}
{% extends "base.html" %}
{% load static %}
{% block css %}<link rel="stylesheet" href="{% static 'css/style_questions.css' %}">
<link rel="stylesheet" href="{% static 'css/style_accueil.css' %}">{% endblock %}
{% block title %}Slamball France{% endblock %}
<link rel="stylesheet" href="{% static 'css/style_global.css' %}">
<script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
<script src="{% static 'js/ajuster_nb_images.js' %}"></script>
{% endblock %}
{% block title %}Foire aux questions - SlamballFrance{% endblock %}
{% block onload %}onload="ajuster_nb_images('a_tronquer','fond_a_tronquer');"{% endblock %}
{% block onglet_7 %} actif {% endblock %}
{% block barre_secondaire %}
<li>
Test
<a href="#poserQ"> Poser ma question </a>
</li>
{% endblock %}
{% block defile-droit %} {% url "accueil" %} {% endblock %}
{% block defile-gauche %} {% url "sponsor" %} {% endblock %}
{% block corps %}
<section class="liste">
<section class="liste" id="a_tronquer">
{% if envoi %}
<p id="envoiOK"> Votre question a bien été publiée dans la FAQ. L'équipe de SlamballFrance vous répondra aussi rapidement que possible. </p>
{% endif %}
<ul>
{% for question in questions %}
<li>
<p class="question">
Question ?
{{ question.question }} <span class="auteur">Postée par {{ question.auteurQ }} </span>
</p>
<p class="reponse">
Réponse.
</p>
<p class="auteur">
Postée par auteur, date.
</p>
</li>
<li>
<p class="question">
Question ?
<p class="reponseauteur
"> {% if question.auteurR != null %} Réponse de {{ question.auteurR }}.{% endif %}
</p>
<p class="reponse">
Réponse.
</p>
<p class="auteur">
Postée par auteur, date.
{% if question.reponse != null %}
{{ question.reponse }}
{% else %}
L'équipe de SlamballFrance va bientôt vous répondre !
{% endif %}
</p>
</li>
{% endfor %}
</ul>
<form action="" method="">
<input type="submit" value="Poser ma question" />
</form>
</section>
<section class="section-paragraphe">
<img src="{% static 'jpg/word_ffsb.jpg' %}" alt="fond" class="fond"/>
<img src="{% static 'Images/Image_internet/Sit_in_air.jpg' %}" alt="fond" class="fond fond_a_tronquer"/>
<img src="{% static 'jpg/im1.jpg' %}" alt="fond" class="fond fond_a_tronquer"/>
</section>
<section id="poserQ">
<div class="texte paragraphe formulaire">
<div class="paragraphe_simple">
<p> Si vous aussi vous avez une question non privée à nous poser, vous pouvez utiliser cette foire aux questions. Pour les contacts d'ordre privée, référez vous à la rubrique Contacts.</p>
<form action="{% url "questions" %}" method="post">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Envoyer ma question" />
</form>
<p> Pour vos messages, merci de faire un effort d'orthographe, d'éviter le style sms. Evitez également de diffuser des informations privées dans votre message comme votre adresse mail, postale, numéro de téléphone.<br/> Tout message aggressif, diffamatoire, raciste, illégal ou publicitaire se verra supprimer. </p>
</div>
</div>
<img src="{% static 'jpg/im1.jpg' %}" alt="fond" class="fond"/>
</section>{% endblock %}
</section>
{% endblock %}
import datetime
from django.utils import timezone
from django.test import TestCase
# Create your tests here.
from .models import Publication
class PublicationMethodTests(TestCase):
def test_recent_with_future_question(self):
"""
recent() should return False for publication whose
date is in the future.
"""
time = timezone.now() + datetime.timedelta(years=1)
future_publication = Publication(date=time)
self.assertIs(future_publication.recent(), False)
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic import TemplateView
from django.views.generic import ListView
from faq.models import Question
urlpatterns = patterns('',
url(r'^questions$',TemplateView.as_view(template_name='faq/questions.html'),name="questions"),
)
# url(r'^questions$',ListView.as_view(model=Question,template_name='faq/questions.html',context_object_name="questions"),name="questions"),
url(r'^questions$', 'faq.views.poserQ', name="questions"),
)
\ No newline at end of file
No preview for this file type
# -*- coding: utf-8 -*-
from django.shortcuts import render
from faq.forms import PoserQ
from faq.models import Question
# Create your views here.
def poserQ(request):
if request.method == 'POST': # S'il s'agit d'une requête POST
form = PoserQ(request.POST) # Nous reprenons les données
if form.is_valid(): # Nous vérifions que les données envoyées sont valides
# Ici nous pouvons traiter les données du formulaire
auteur = form.cleaned_data['auteur']
mail = form.cleaned_data['mail']
question = form.cleaned_data['question']
data = Question(auteurQ=auteur, question=question, mail=mail)
data.save()
# Nous pourrions ici envoyer l'e-mail grâce aux données que nous venons de récupérer
envoi = True
form = PoserQ()
else: # Si ce n'est pas du POST, c'est probablement une requête GET
form = PoserQ() # Nous créons un formulaire vide
questions = Question.objects.order_by('-date')
return render(request, 'faq/questions.html', locals())
File mode changed from 100644 to 100755
No preview for this file type
from django.contrib import admin
from general.models import Block,Sponsor
class BlockAdmin(admin.ModelAdmin):
list_display = ('titre', 'page',)
list_filter = ('page',)
ordering = ('page', )
search_fields = ('titre', 'page')
admin.site.register(Block, BlockAdmin)
admin.site.register(Sponsor)
# Register your models here.
No preview for this file type
from importlib import import_module
import os
from django.core.exceptions import AppRegistryNotReady, ImproperlyConfigured
from django.utils.module_loading import module_has_submodule
from django.utils._os import upath
MODELS_MODULE_NAME = 'models'
class AppConfig(object):
"""
Class representing a Django application and its configuration.
"""
def __init__(self, app_name, app_module):
# Full Python path to the application eg. 'django.contrib.admin'.
self.name = app_name
# Root module for the application eg. <module 'django.contrib.admin'
# from 'django/contrib/admin/__init__.pyc'>.
self.module = app_module
# The following attributes could be defined at the class level in a
# subclass, hence the test-and-set pattern.
# Last component of the Python path to the application eg. 'admin'.
# This value must be unique across a Django project.
if not hasattr(self, 'label'):
self.label = app_name.rpartition(".")[2]
# Human-readable name for the application eg. "Admin".
if not hasattr(self, 'verbose_name'):
self.verbose_name = self.label.title()
# Filesystem path to the application directory eg.
# u'/usr/lib/python2.7/dist-packages/django/contrib/admin'. Unicode on
# Python 2 and a str on Python 3.
if not hasattr(self, 'path'):
self.path = self._path_from_module(app_module)
# Module containing models eg. <module 'django.contrib.admin.models'
# from 'django/contrib/admin/models.pyc'>. Set by import_models().
# None if the application doesn't have a models module.
self.models_module = None
# Mapping of lower case model names to model classes. Initially set to
# None to prevent accidental access before import_models() runs.
self.models = None
def __repr__(self):
return '<%s: %s>' % (self.__class__.__name__, self.label)
def _path_from_module(self, module):
"""Attempt to determine app's filesystem path from its module."""
# See #21874 for extended discussion of the behavior of this method in
# various cases.
# Convert paths to list because Python 3.3 _NamespacePath does not
# support indexing.
paths = list(getattr(module, '__path__', []))
if len(paths) != 1:
filename = getattr(module, '__file__', None)
if filename is not None:
paths = [os.path.dirname(filename)]
if len(paths) > 1:
raise ImproperlyConfigured(
"The app module %r has multiple filesystem locations (%r); "
"you must configure this app with an AppConfig subclass "
"with a 'path' class attribute." % (module, paths))
elif not paths:
raise ImproperlyConfigured(
"The app module %r has no filesystem location, "
"you must configure this app with an AppConfig subclass "
"with a 'path' class attribute." % (module,))
return upath(paths[0])
@classmethod
def create(cls, entry):
"""
Factory that creates an app config from an entry in INSTALLED_APPS.
"""
try:
# If import_module succeeds, entry is a path to an app module,
# which may specify an app config class with default_app_config.
# Otherwise, entry is a path to an app config class or an error.
module = import_module(entry)
except ImportError:
# Track that importing as an app module failed. If importing as an
# app config class fails too, we'll trigger the ImportError again.
module = None
mod_path, _, cls_name = entry.rpartition('.')
# Raise the original exception when entry cannot be a path to an
# app config class.
if not mod_path:
raise
else:
try:
# If this works, the app module specifies an app config class.
entry = module.default_app_config
except AttributeError:
# Otherwise, it simply uses the default app config class.
return cls(entry, module)
else:
mod_path, _, cls_name = entry.rpartition('.')
# If we're reaching this point, we must attempt to load the app config
# class located at <mod_path>.<cls_name>
# Avoid django.utils.module_loading.import_by_path because it
# masks errors -- it reraises ImportError as ImproperlyConfigured.
mod = import_module(mod_path)
try:
cls = getattr(mod, cls_name)
except AttributeError:
if module is None:
# If importing as an app module failed, that error probably
# contains the most informative traceback. Trigger it again.
import_module(entry)
else:
raise
# Check for obvious errors. (This check prevents duck typing, but
# it could be removed if it became a problem in practice.)
if not issubclass(cls, AppConfig):
raise ImproperlyConfigured(
"'%s' isn't a subclass of AppConfig." % entry)
# Obtain app name here rather than in AppClass.__init__ to keep
# all error checking for entries in INSTALLED_APPS in one place.
try:
app_name = cls.name
except AttributeError:
raise ImproperlyConfigured(
"'%s' must supply a name attribute." % entry)
# Ensure app_name points to a valid module.
app_module = import_module(app_name)
# Entry is a path to an app config class.
return cls(app_name, app_module)
def check_models_ready(self):
"""
Raises an exception if models haven't been imported yet.
"""
if self.models is None:
raise AppRegistryNotReady(
"Models for app '%s' haven't been imported yet." % self.label)
def get_model(self, model_name):
"""
Returns the model with the given case-insensitive model_name.
Raises LookupError if no model exists with this name.
"""
self.check_models_ready()
try:
return self.models[model_name.lower()]
except KeyError:
raise LookupError(
"App '%s' doesn't have a '%s' model." % (self.label, model_name))
def get_models(self, include_auto_created=False,
include_deferred=False, include_swapped=False):
"""
Returns an iterable of models.
By default, the following models aren't included:
- auto-created models for many-to-many relations without
an explicit intermediate table,
- models created to satisfy deferred attribute queries,
- models that have been swapped out.
Set the corresponding keyword argument to True to include such models.
Keyword arguments aren't documented; they're a private API.
"""
self.check_models_ready()
for model in self.models.values():
if model._deferred and not include_deferred:
continue
if model._meta.auto_created and not include_auto_created:
continue
if model._meta.swapped and not include_swapped:
continue
yield model
def import_models(self, all_models):
# Dictionary of models for this app, primarily maintained in the
# 'all_models' attribute of the Apps this AppConfig is attached to.
# Injected as a parameter because it gets populated when models are
# imported, which might happen before populate() imports models.
self.models = all_models
if module_has_submodule(self.module, MODELS_MODULE_NAME):
models_module_name = '%s.%s' % (self.name, MODELS_MODULE_NAME)
self.models_module = import_module(models_module_name)
def ready(self):
"""
Override this method in subclasses to run code when Django starts.
"""
# -*- coding: utf-8 -*-
from django import forms
class SponsorForm(forms.Form):
nom = forms.CharField(max_length=50, label="Nom")
prenom = forms.CharField(max_length=50, label="Prénom")
genre = forms.ChoiceField(choices=[('F','Femme'),('H','Homme')], label="Sexe",widget=forms.RadioSelect)
is_societe = forms.ChoiceField(choices=[('soc','Société'), ('par','Particulier')], label="Statut", widget=forms.RadioSelect)
societe = forms.CharField(max_length=100, label="Nom de la société", required=False)
mail = forms.EmailField(label="Adresse mail")
message = forms.CharField(widget=forms.Textarea, label="Message")
\ No newline at end of file
# -*- coding: utf-8 -*-
from django import forms
class SponsorForm(forms.Form):
nom = forms.CharField(max_length=50, label="Nom")
prenom = forms.CharField(max_length=50, label="Prénom")
genre = forms.ChoiceField(choices=[(Femme,'Femme'),(Homme,'Homme')], label="Sexe")
is_societe = forms.ChoiceField(choices=[(soc,'Société'), (par,'Particulier')], label="Êtes-vous une société ou un particulier ?")
societe = forms.CharField(max_length=100, label="Nom de votre société")
mail = forms.EmailField(label="Adresse mail")
message = forms.CharField(widget=forms.Textarea, label="Message")
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='blocks',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('titre', models.CharField(max_length=100, null=True, blank=True)),
('contenu', models.TextField()),
],
options={