Compare commits

..

4 commits

Author SHA1 Message Date
selfhoster1312 ACAB
8d7ba5e616 Merge branch 'feat-distribution-place' into 'develop'
Draft: feature: Add placekey relationship for distribution spots

See merge request la-chariotte/la-chariotte!129
2025-03-02 19:15:45 +00:00
selfhoster1312
f2d8d9b9c2 feature: Add placekey relationship for distribution spots 2025-03-02 15:23:27 +01:00
Laetitia
19c4a0b6ed feat: update gitlab links everywhere else 2025-02-16 10:35:00 +00:00
Laetitia
9589bcf48d feat: update gitlab link to framagit 2025-02-16 10:35:00 +00:00
7 changed files with 38 additions and 11 deletions

View file

@ -6,7 +6,7 @@ started.
The first step is to clone the project, you can find more information about that in The first step is to clone the project, you can find more information about that in
the [getting started guide](../install.md). Once that's done, you can: the [getting started guide](../install.md). Once that's done, you can:
- choose a task [on the board](https://gitlab.com/la-chariotte/la_chariotte/-/boards) and assign it to - choose a task [on the board](https://framagit.org/la-chariotte/la-chariotte/-/boards) and assign it to
yourself - if you don't know which task to do, feel free to reach to yourself - if you don't know which task to do, feel free to reach to
us. us.
- create a new branch **from develop** naming it to reflect what you want to do - create a new branch **from develop** naming it to reflect what you want to do

View file

@ -11,7 +11,7 @@
- **docs.chariotte.fr**, the docs you are reading now. It's handled by [readthedocs.org](https://readthedocs.org). - **docs.chariotte.fr**, the docs you are reading now. It's handled by [readthedocs.org](https://readthedocs.org).
- **chariotte.fr**, the main instance. It's deployed on Alwaysdata - **chariotte.fr**, the main instance. It's deployed on Alwaysdata
- **blog.chariotte.fr**, our blog. It's [a static website](https://gitlab.com/la-chariotte/la-chariotte.gitlab.io) deployed on Gitlab pages. - **blog.chariotte.fr**, our blog. It's [a static website](https://framagit.org/la-chariotte/la-chariotte.frama.io) deployed on Gitlab pages.
## The main instance ## The main instance

View file

@ -1,7 +1,7 @@
First, clone the project First, clone the project
```bash ```bash
git clone git@gitlab.com:la-chariotte/la_chariotte.git git clone https://framagit.org/la-chariotte/la-chariotte.git
``` ```
## Virtual environment ## Virtual environment

View file

@ -12,13 +12,13 @@
Créer un nouveau lieu de distribution</a> Créer un nouveau lieu de distribution</a>
</div> </div>
{% if lieu_context.lieu_liste %} {% if lieu_context.lieu_liste %}
<p class="is-size-4">Commandes groupées à venir</p>
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th>Lieu</th> <th>Lieu</th>
<th>Commandes</th>
<th>Description</th> <th>Description</th>
<th>URL</th> <th>URL</th>
<th> </th> <th> </th>
</tr> </tr>
</thead> </thead>
@ -29,11 +29,29 @@
<a title="Détail du lieu de distribution" href="{% url 'lieu:lieu_update' lieu.url %}">{{ lieu }}</a> <a title="Détail du lieu de distribution" href="{% url 'lieu:lieu_update' lieu.url %}">{{ lieu }}</a>
</td> </td>
<td> <td>
{{ lieu.description }} {% if lieu.url in lieu_context.commandes.keys %}
{% for lieu_url, lieu_commandes in lieu_context.commandes.items %}
{% if lieu_url == lieu.url %}
{% for commande in lieu_commandes %}
{% url 'order:grouped_order_detail' code=commande.code as order_url %}
{% if order_url %}
<a href="{{ order_url }}">{{commande.name}}</a><br>
{% else %}
{{ commande.name }}<br>
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% else %}
Aucune
{% endif %}
</td>
<td>
{{ lieu.description }}
</td>
<td>
{{ lieu.url }}
</td> </td>
<td>
{{ lieu.url }}
</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>

View file

@ -11,6 +11,7 @@ from django.views import generic
from django_weasyprint import WeasyTemplateResponseMixin from django_weasyprint import WeasyTemplateResponseMixin
from icalendar import Calendar, Event, vCalAddress, vText from icalendar import Calendar, Event, vCalAddress, vText
from la_chariotte.order.models import GroupedOrder
from la_chariotte.order.views.mixins import UserIsOrgaMixin from la_chariotte.order.views.mixins import UserIsOrgaMixin
from ..forms import LieuForm from ..forms import LieuForm
@ -25,9 +26,15 @@ class IndexView(LoginRequiredMixin, generic.ListView):
def get_queryset(self): def get_queryset(self):
lieux = Lieu.objects.filter(orga=self.request.user) lieux = Lieu.objects.filter(orga=self.request.user)
commandes_par_lieu = dict()
for lieu in lieux:
orders = GroupedOrder.objects.all().filter(placekey=lieu)
if orders:
commandes_par_lieu[lieu.url] = orders
return { return {
"lieu_liste": lieux, "lieu_liste": lieux,
"commandes": commandes_par_lieu,
} }
@ -52,6 +59,8 @@ class LieuUpdateView(UserIsOrgaMixin, generic.UpdateView):
template_name = "lieu/lieu_update.html" template_name = "lieu/lieu_update.html"
context_object_name = "lieu" context_object_name = "lieu"
form_class = LieuForm form_class = LieuForm
# Can't change URL after creation
form_class.base_fields["url"].disabled = True
def get_object(self, queryset=None): def get_object(self, queryset=None):
return get_object_or_404(Lieu, url=self.kwargs.get("url")) return get_object_or_404(Lieu, url=self.kwargs.get("url"))

View file

@ -7,7 +7,7 @@ from sentry_sdk.integrations.django import DjangoIntegration
BASE_DIR = Path(__file__).resolve().parent.parent BASE_DIR = Path(__file__).resolve().parent.parent
BASE_URL = os.getenv("BASE_URL", "http://127.0.0.1:8000") BASE_URL = os.getenv("BASE_URL", "http://127.0.0.1:8000")
PROJECT_NAME = os.getenv("PROJECT_NAME", "La Chariotte") PROJECT_NAME = os.getenv("PROJECT_NAME", "La Chariotte")
GITLAB_LINK = "https://gitlab.com/la-chariotte/la_chariotte" GITLAB_LINK = "https://framagit.org/la-chariotte/la-chariotte"
CONTACT_MAIL = "contact@chariotte.fr" CONTACT_MAIL = "contact@chariotte.fr"
HELLOASSO_LINK = "https://www.helloasso.com/associations/la-chariotte/" HELLOASSO_LINK = "https://www.helloasso.com/associations/la-chariotte/"
FEEDBACK_LINK = "https://framaforms.org/votre-avis-sur-la-chariotte-1709742328" FEEDBACK_LINK = "https://framaforms.org/votre-avis-sur-la-chariotte-1709742328"

View file

@ -1,7 +1,7 @@
site_name: La chariotte site_name: La chariotte
site_description: An application for grouped-orders site_description: An application for grouped-orders
repo_name: la-chariotte/la_chariotte repo_name: la-chariotte/la_chariotte
repo_url: https://gitlab.com/la-chariotte/la_chariotte repo_url: https://framagit.org/la-chariotte/la-chariotte
nav: nav:
- How-tos: - How-tos:
- Getting started: install.md - Getting started: install.md