Compare commits
3 commits
main
...
thubrecht/
Author | SHA1 | Date | |
---|---|---|---|
047ef80bec | |||
2cd6e228fb | |||
8174611e9e |
7 changed files with 195 additions and 66 deletions
|
@ -1,5 +1,7 @@
|
|||
from datetime import date
|
||||
|
||||
from authens.models import CASAccount
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
|
||||
|
@ -36,7 +38,7 @@ class Command(BaseCommand):
|
|||
else:
|
||||
promo = self.get_current_promo()
|
||||
|
||||
if promo < 2000 or promo > 2100:
|
||||
if promo is not None and (promo < 2000 or promo > 2100):
|
||||
raise CommandError("Promotion invalide : {}".format(promo))
|
||||
|
||||
verbosity = options["verbosity"]
|
||||
|
@ -48,7 +50,7 @@ class Command(BaseCommand):
|
|||
)
|
||||
|
||||
# On vire les élèves déjà existants
|
||||
existing_users = set(User.objects.values_list("username", flat=True))
|
||||
existing_users = set(CASAccount.objects.values_list("cas_login", flat=True))
|
||||
clippers = [
|
||||
clipper for clipper in clipper_list if clipper.uid not in existing_users
|
||||
]
|
||||
|
@ -62,9 +64,14 @@ class Command(BaseCommand):
|
|||
users_to_create = []
|
||||
profiles_to_create = []
|
||||
dept_m2m_to_create = []
|
||||
cas_account_to_create = []
|
||||
|
||||
for clipper in clippers:
|
||||
user = User(username=clipper.uid, email=clipper.email)
|
||||
cas_account = CASAccount(
|
||||
user=user, cas_login=clipper.uid, entrance_year=clipper.year
|
||||
)
|
||||
cas_account_to_create.append(cas_account)
|
||||
profile = Profile(user=user, full_name=clipper.name, promotion=clipper.year)
|
||||
users_to_create.append(user)
|
||||
profiles_to_create.append(profile)
|
||||
|
@ -83,10 +90,14 @@ class Command(BaseCommand):
|
|||
# p.id = pid
|
||||
|
||||
# _manual_ids(User, users_to_create)
|
||||
# _manual_ids(CASAccount, cas_account_to_create)
|
||||
# _manual_ids(Profile, profiles_to_create)
|
||||
# _manual_ids(Profile.department.through, dept_m2m_to_create)
|
||||
|
||||
User.objects.bulk_create(users_to_create)
|
||||
for cas_account in cas_account_to_create:
|
||||
cas_account.user_id = cas_account.user.id
|
||||
CASAccount.objects.bulk_create(cas_account_to_create)
|
||||
for profile in profiles_to_create:
|
||||
profile.user_id = profile.user.id
|
||||
Profile.objects.bulk_create(profiles_to_create)
|
||||
|
|
|
@ -28,65 +28,21 @@
|
|||
font-weight: 400;
|
||||
src: local("Source Code Pro Regular"), local("SourceCodePro-Regular"), url("../fonts/source-code-pro/source-code-pro-v12-latin-regular.woff2") format("woff2"), url("../fonts/source-code-pro/source-code-pro-v12-latin-regular.woff") format("woff");
|
||||
}
|
||||
#main-menu a a, #account-area a, a {
|
||||
a, #main-menu a a, #account-area a {
|
||||
text-decoration: none;
|
||||
color: #FFDC00;
|
||||
}
|
||||
|
||||
#main-menu a a:hover, #account-area a:hover, a:hover,
|
||||
a:hover, #main-menu a a:hover, #account-area a:hover,
|
||||
a:active,
|
||||
#main-menu a a:active,
|
||||
#account-area a:active,
|
||||
a:active,
|
||||
a:focus,
|
||||
#main-menu a a:focus,
|
||||
#account-area a:focus,
|
||||
a:focus {
|
||||
#account-area a:focus {
|
||||
color: #ffbb00;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body, html {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
display: grid;
|
||||
grid-template-columns: auto auto;
|
||||
grid-template-areas: "aside main";
|
||||
background-color: #301827;
|
||||
color: #FFFFFF;
|
||||
font-family: "Fira Sans", "Roboto", sans-serif;
|
||||
}
|
||||
|
||||
#aside {
|
||||
grid-area: aside;
|
||||
padding: 0 0 0 10vw;
|
||||
background-color: #1f0e19;
|
||||
box-shadow: 4px 0 0 rgba(31, 14, 25, 0.3);
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
#main {
|
||||
grid-area: main;
|
||||
padding: 0 10vw 0 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
background-color: #301827;
|
||||
z-index: 500;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 1200px) {
|
||||
#header {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#main {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
#menu {
|
||||
display: grid;
|
||||
float: right;
|
||||
|
@ -95,6 +51,15 @@ body {
|
|||
grid-template-rows: auto auto auto auto 120px;
|
||||
grid-template-areas: "title" "language" "search" "menu" "account";
|
||||
}
|
||||
#menu #hamburger {
|
||||
display: none;
|
||||
grid-area: hamburger;
|
||||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABhGlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9TS1VaHOwg4pChOlkoKuKoVShChVIrtOpgcukXNGlIUlwcBdeCgx+LVQcXZ10dXAVB8APEzc1J0UVK/F9SaBHjwXE/3t173L0DhGaVqWZPHFA1y8gkE2IuvyoGXyEggD6EEZeYqc+l0yl4jq97+Ph6F+NZ3uf+HGGlYDLAJxLPMt2wiDeIpzctnfM+cYSVJYX4nHjcoAsSP3JddvmNc8lhgWdGjGxmnjhCLJa6WO5iVjZU4iniqKJqlC/kXFY4b3FWq3XWvid/YaigrSxzneYIkljEEtIQIaOOCqqwEKNVI8VEhvYTHv5hx58ml0yuChg5FlCDCsnxg//B727N4uSEmxRKAIEX2/4YBYK7QKth29/Htt06AfzPwJXW8deawMwn6Y2OFj0CBraBi+uOJu8BlzvA0JMuGZIj+WkKxSLwfkbflAcGb4H+Nbe39j5OH4AsdZW6AQ4OgbESZa97vLu3u7d/z7T7+wEsq3KLN3ZkxAAAAAlwSFlzAAAA7AAAAOwBeShxvQAAADNJREFUWMPt1EERAEAIA7Ee/h0hjpPBg0RBp49NrnvTmc0Btf2AARVAipVQikGKpdgArvsZZAhH7c55ywAAAABJRU5ErkJggg==");
|
||||
height: 30px;
|
||||
width: 30px;
|
||||
float: right;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
#title {
|
||||
grid-area: title;
|
||||
|
@ -545,4 +510,84 @@ body {
|
|||
text-align: center;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body, html {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
display: grid;
|
||||
grid-template-areas: "aside main";
|
||||
background-color: #301827;
|
||||
color: #FFFFFF;
|
||||
font-family: "Fira Sans", "Roboto", sans-serif;
|
||||
}
|
||||
|
||||
#aside {
|
||||
grid-area: aside;
|
||||
padding: 0 0 0 10vw;
|
||||
background-color: #1f0e19;
|
||||
box-shadow: 4px 0 0 rgba(31, 14, 25, 0.3);
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
#main {
|
||||
grid-area: main;
|
||||
padding: 0 10vw 0 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
background-color: #301827;
|
||||
z-index: 500;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 900px), (orientation: portrait) {
|
||||
body {
|
||||
grid-template-rows: max-content auto;
|
||||
grid-template-areas: "aside" "main";
|
||||
}
|
||||
|
||||
#aside,
|
||||
#main {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#content-home,
|
||||
#content-birthdays,
|
||||
#content-view-profile,
|
||||
#content-edit-profile {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
#content-home form input[type=submit] {
|
||||
grid-column: 1/3;
|
||||
}
|
||||
|
||||
#footer,
|
||||
.content {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
#menu {
|
||||
width: auto;
|
||||
float: none;
|
||||
grid-template-columns: auto 50px;
|
||||
grid-template-areas: "title hamburger" "language language" "search search" "menu menu" "account account";
|
||||
}
|
||||
#menu #hamburger {
|
||||
display: grid;
|
||||
}
|
||||
#menu #main-menu,
|
||||
#menu #account-area {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#search-area {
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
|
||||
/*# sourceMappingURL=annuaire.css.map */
|
||||
|
|
|
@ -15,7 +15,6 @@ body, html {
|
|||
|
||||
body {
|
||||
display: grid;
|
||||
grid-template-columns: auto auto;
|
||||
grid-template-areas:
|
||||
"aside main";
|
||||
|
||||
|
@ -42,13 +41,63 @@ body {
|
|||
z-index: 500;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 1200px) {
|
||||
#header {
|
||||
margin: 0;
|
||||
// Pour les vues mobile
|
||||
@media screen and (max-width: 900px), (orientation: portrait) {
|
||||
body {
|
||||
grid-template-rows: max-content auto;
|
||||
grid-template-areas:
|
||||
"aside"
|
||||
"main";
|
||||
}
|
||||
|
||||
#aside,
|
||||
#main {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#content-home,
|
||||
#content-birthdays,
|
||||
#content-view-profile,
|
||||
#content-edit-profile {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
#content-home {
|
||||
form {
|
||||
input[type="submit"] {
|
||||
grid-column: 1/3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#footer,
|
||||
.content {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
#menu {
|
||||
width: auto;
|
||||
float: none;
|
||||
grid-template-columns: auto 50px;
|
||||
grid-template-areas:
|
||||
"title hamburger"
|
||||
"language language"
|
||||
"search search"
|
||||
"menu menu"
|
||||
"account account";
|
||||
|
||||
#hamburger {
|
||||
display: grid;
|
||||
}
|
||||
|
||||
#main-menu,
|
||||
#account-area {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
#search-area {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,16 @@ $account-area-height: 120px;
|
|||
"search"
|
||||
"menu"
|
||||
"account";
|
||||
|
||||
#hamburger {
|
||||
display: none;
|
||||
grid-area: hamburger;
|
||||
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABhGlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9TS1VaHOwg4pChOlkoKuKoVShChVIrtOpgcukXNGlIUlwcBdeCgx+LVQcXZ10dXAVB8APEzc1J0UVK/F9SaBHjwXE/3t173L0DhGaVqWZPHFA1y8gkE2IuvyoGXyEggD6EEZeYqc+l0yl4jq97+Ph6F+NZ3uf+HGGlYDLAJxLPMt2wiDeIpzctnfM+cYSVJYX4nHjcoAsSP3JddvmNc8lhgWdGjGxmnjhCLJa6WO5iVjZU4iniqKJqlC/kXFY4b3FWq3XWvid/YaigrSxzneYIkljEEtIQIaOOCqqwEKNVI8VEhvYTHv5hx58ml0yuChg5FlCDCsnxg//B727N4uSEmxRKAIEX2/4YBYK7QKth29/Htt06AfzPwJXW8deawMwn6Y2OFj0CBraBi+uOJu8BlzvA0JMuGZIj+WkKxSLwfkbflAcGb4H+Nbe39j5OH4AsdZW6AQ4OgbESZa97vLu3u7d/z7T7+wEsq3KLN3ZkxAAAAAlwSFlzAAAA7AAAAOwBeShxvQAAADNJREFUWMPt1EERAEAIA7Ee/h0hjpPBg0RBp49NrnvTmc0Btf2AARVAipVQikGKpdgArvsZZAhH7c55ywAAAABJRU5ErkJggg==');
|
||||
height: 30px;
|
||||
width: 30px;
|
||||
float: right;
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
#title {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@use "common";
|
||||
@use "header";
|
||||
@use "content";
|
||||
@use "footer";
|
||||
@use "common";
|
||||
|
|
|
@ -16,6 +16,11 @@
|
|||
<body>
|
||||
<div id="aside">
|
||||
<div id="menu">
|
||||
<h1 id="title">
|
||||
{% block title %} <a href='{% url "home" %}'>{% trans "Annuaire des élèves de l'ENS" %}</a>{% endblock %}
|
||||
</h1>
|
||||
<a id="hamburger" href="javascript:void(0);" onclick="toggleMenu()"></a>
|
||||
|
||||
<div id="language_switch">
|
||||
<form action="{% url 'set_language' %}" method="post">
|
||||
{% csrf_token %}
|
||||
|
@ -31,11 +36,6 @@
|
|||
<button type="submit">{% trans "Rechercher" %}</button>
|
||||
</form>
|
||||
|
||||
<h1 id="title">
|
||||
{% block title %} <a href='{% url "home" %}'>{% trans "Annuaire des élèves de l'ENS" %}</a>{% endblock %}
|
||||
</h1>
|
||||
|
||||
|
||||
<div id="main-menu">
|
||||
<nav>
|
||||
<a href='{% url "home" %}'>{% trans "Accueil" %}</a>
|
||||
|
@ -77,7 +77,21 @@
|
|||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
function toggleMenu() {
|
||||
var menu = document.getElementById("main-menu");
|
||||
var account = document.getElementById("account-area");
|
||||
if (menu.style.display === "none") {
|
||||
menu.style.display = "grid"
|
||||
account.style.display = "grid"
|
||||
} else {
|
||||
menu.style.display = "none"
|
||||
account.style.display = "none"
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
{% block extra_js %}{% endblock %}
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue