Commit 7cfe87b2 authored by Florent Chehab's avatar Florent Chehab

Twaeks to make front work again

parent 0304b762
Pipeline #26540 passed with stages
in 2 minutes and 4 seconds
from rest_framework import viewsets, permissions
from rest_framework import permissions
from .myModelSerializer import MyModelSerializer
from backend.models.tools import NoDeleteIfNotAdmin
from backend.models.tools import DictModeViewSet
class MyModelViewSet(viewsets.ModelViewSet): # TODO switch to dict
class MyModelViewSet(DictModeViewSet): # TODO switch to dict
serializer_class = MyModelSerializer
permission_classes = (
permissions.IsAuthenticated,
......
from backend.models.university import University
from rest_framework import viewsets, permissions
from rest_framework import permissions
from backend.models.university.campus import CampusSerializer
from backend.models.tools import NoDeleteIfNotAdmin
from backend.models.my_model import MyModelSerializer
from backend.models.my_model import MyModelSerializer, MyModelViewSet
class UniversitySerializer(MyModelSerializer):
......@@ -13,7 +13,7 @@ class UniversitySerializer(MyModelSerializer):
fields = '__all__'
class UniversityViewSet(viewsets.ModelViewSet): # TODO switch to dict
class UniversityViewSet(MyModelViewSet):
serializer_class = UniversitySerializer
permission_classes = (
......
......@@ -38,6 +38,17 @@ class UnivMap extends Component {
if (this.props.isLoading || this.props.invalidated) {
return <Loading />;
}
let universities = this.props.universities;
let univ_to_plot = [];
for (let univ_pk in universities) {
let univ = universities[univ_pk];
if (univ.univ_campus.length > 0) {
univ_to_plot.push({
name: univ.name,
main_campus: univ.univ_campus[0]
})
}
}
return (
<Map center={[35, 0]} zoom={2} style={{ height: "800px" }}>
......@@ -79,8 +90,8 @@ class UnivMap extends Component {
</LayersControl>
{
this.props.universities.map((el) => (
<Marker position={[el.univ_campus[0].lat, el.univ_campus[0].lon]}>
univ_to_plot.map((el) => (
<Marker position={[el.main_campus.lat, el.main_campus.lon]}>
<Popup>
{el.name}
</Popup>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment