page fiche (html)
This commit is contained in:
parent
9f254fc839
commit
a672e439e8
10 changed files with 119 additions and 14 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -4,11 +4,7 @@
|
|||
*~
|
||||
*#
|
||||
|
||||
/media/archives/*
|
||||
/media/images/*
|
||||
/media/documents/*
|
||||
/media/original_images/*
|
||||
/media/admin
|
||||
/media/picture
|
||||
|
||||
/recensements/
|
||||
/venv/
|
||||
|
|
|
@ -103,7 +103,7 @@ AUTH_PASSWORD_VALIDATORS = [
|
|||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/dev/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
LANGUAGE_CODE = 'fr-fr'
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
|
||||
|
@ -118,3 +118,7 @@ USE_TZ = True
|
|||
# https://docs.djangoproject.com/en/dev/howto/static-files/
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
||||
|
||||
MEDIA_URL = '/media/'
|
|
@ -16,8 +16,12 @@ Including another URLconf
|
|||
from django.conf import settings
|
||||
from django.contrib import admin
|
||||
from django.urls import path, include
|
||||
from django.conf.urls.static import static
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('fiche/', include('fiches.urls'))
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
|
24
fiches/migrations/0002_auto_20190408_1929.py
Normal file
24
fiches/migrations/0002_auto_20190408_1929.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
# Generated by Django 2.2 on 2019-04-08 19:29
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('fiches', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='phone',
|
||||
name='profile',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='fiches.Profile', verbose_name='profil'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='social',
|
||||
name='profile',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='fiches.Profile', verbose_name='profil'),
|
||||
),
|
||||
]
|
|
@ -26,23 +26,31 @@ class Profile(models.Model):
|
|||
keep_me = models.BooleanField(
|
||||
default=False, verbose_name=_("conserver la fiche annuaire ?")
|
||||
)
|
||||
def __str__(self):
|
||||
return self.full_name
|
||||
|
||||
|
||||
class Department(models.Model):
|
||||
name = models.CharField(max_length=1023, verbose_name=_("nom du département"))
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class Phone(models.Model):
|
||||
profile = models.OneToOneField(
|
||||
profile = models.ForeignKey(
|
||||
Profile, on_delete=models.CASCADE, verbose_name=_("profil")
|
||||
)
|
||||
name = models.CharField(max_length=1023, verbose_name=_("type"))
|
||||
number = models.CharField(max_length=1023, verbose_name=_("numéro"))
|
||||
def __str__(self):
|
||||
return "{} : {}".format(self.name, self.number)
|
||||
|
||||
|
||||
class Social(models.Model):
|
||||
profile = models.OneToOneField(
|
||||
profile = models.ForeignKey(
|
||||
Profile, on_delete=models.CASCADE, verbose_name=_("profil")
|
||||
)
|
||||
name = models.CharField(max_length=1023, verbose_name=_("type"))
|
||||
content = models.CharField(max_length=1023, verbose_name=_("contenu"))
|
||||
def __str__(self):
|
||||
return "{} : {}".format(self.name, self.content)
|
|
@ -1,12 +1,11 @@
|
|||
html {
|
||||
background: url(../images/background-motif.png) repeat;
|
||||
background-color: black;
|
||||
color: #FFF;
|
||||
font-family: Verdana, Verdana, Geneva, sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0 0 0.8em 0;
|
||||
background: transparent url(../images/background.png) no-repeat center top;
|
||||
min-height: 538px;
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1,66 @@
|
|||
{% extends "fiches/base.html" %}
|
||||
{% extends "fiches/base.html" %}
|
||||
{% block content %}
|
||||
<div>
|
||||
<div>
|
||||
<img src="{{ profile.picture.url }}" />
|
||||
</div>
|
||||
<div>
|
||||
<h3>{{ profile.full_name }}
|
||||
({{ profile.promotion }})
|
||||
{% if profile.nickname %}
|
||||
<em>alias:</em>{{ profile.nickname }})</h3>
|
||||
{% endif %}
|
||||
<p>
|
||||
{% if profile.department.exists %}
|
||||
<em>Département{{ profile.department.count|pluralize}} :</em>
|
||||
{% endif %}
|
||||
{% for dep in profile.department.all %}
|
||||
{{ dep }}
|
||||
{% if not forloop.last %}
|
||||
,
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if profile.birth_date %}
|
||||
</p>
|
||||
<p>
|
||||
{% if profile.phone_set.exists %}
|
||||
<em>Téléphone{{ profile.phone_set.count|pluralize}} :</em>
|
||||
{% endif %}
|
||||
{% for ph in profile.phone_set.all %}
|
||||
{{ ph }}
|
||||
{% if not forloop.last %}
|
||||
,<br/>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
{% if profile.social_set.exists %}
|
||||
<em>{{ profile.social_set.count|pluralize:"Réseau social,Réseaux sociaux"}} :</em>
|
||||
{% endif %}
|
||||
{% for ph in profile.social_set.all %}
|
||||
{{ ph }}
|
||||
{% if not forloop.last %}
|
||||
,<br/>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
<em>Date de naissance :</em> {{ profile.birth_date }}
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% if profile.thurne %}
|
||||
<p>
|
||||
<em>Thurne :</em> {{ profile.thurne }}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
{% if profile.text_field %}
|
||||
<p>
|
||||
<b>Champ libre :</b> {{ profile.text_field }}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -2,5 +2,5 @@ from django.urls import path
|
|||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path('',views.fiche, name='fiche')
|
||||
path('<int:id>',views.fiche, name='fiche')
|
||||
]
|
|
@ -1,6 +1,11 @@
|
|||
from django.shortcuts import render
|
||||
from django.shortcuts import get_object_or_404
|
||||
from .models import Profile
|
||||
|
||||
# Create your views here.
|
||||
|
||||
def fiche(request):
|
||||
return render(request,'fiches/fiche.html',{})
|
||||
def fiche(request,id):
|
||||
profile=get_object_or_404(Profile,id=id)
|
||||
return render(request,'fiches/fiche.html',{"profile":profile})
|
||||
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 3.5 KiB |
Loading…
Reference in a new issue