Commit d08b29b3 authored by Florent Chehab's avatar Florent Chehab
Browse files

univCampus => univ_campus for coherence

parent a6becde5
# Generated by Django 2.0.3 on 2018-08-24 07:10
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('backend', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='campus',
name='university',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='univ_campus', to='backend.University'),
),
]
...@@ -16,7 +16,7 @@ class Campus(BasicModule): ...@@ -16,7 +16,7 @@ class Campus(BasicModule):
comment = models.TextField(null=True, blank=True) comment = models.TextField(null=True, blank=True)
city = models.ForeignKey(City, on_delete=models.PROTECT, null=False) city = models.ForeignKey(City, on_delete=models.PROTECT, null=False)
university = models.ForeignKey( university = models.ForeignKey(
University, on_delete=models.PROTECT, null=False, related_name="univCampus") University, on_delete=models.PROTECT, null=False, related_name="univ_campus")
lat = models.DecimalField( lat = models.DecimalField(
max_digits=10, max_digits=10,
......
...@@ -4,11 +4,11 @@ from backend.models.university.campus import CampusSerializer ...@@ -4,11 +4,11 @@ from backend.models.university.campus import CampusSerializer
class UniversitySerializer(serializers.ModelSerializer): class UniversitySerializer(serializers.ModelSerializer):
univCampus = CampusSerializer(many=True, read_only=True) univ_campus = CampusSerializer(many=True, read_only=True)
class Meta: class Meta:
model = University model = University
fields = ('name', 'acronym', 'logo', 'id', 'univCampus') fields = ('name', 'acronym', 'logo', 'id', 'univ_campus')
class UniversityViewSet(viewsets.ModelViewSet): # TODO switch to dict class UniversityViewSet(viewsets.ModelViewSet): # TODO switch to dict
......
...@@ -80,7 +80,7 @@ class UnivMap extends Component { ...@@ -80,7 +80,7 @@ class UnivMap extends Component {
</LayersControl> </LayersControl>
{ {
this.props.universities.map((el) => ( this.props.universities.map((el) => (
<Marker position={[el.univCampus[0].lat, el.univCampus[0].lon]}> <Marker position={[el.univ_campus[0].lat, el.univ_campus[0].lon]}>
<Popup> <Popup>
{el.name} {el.name}
</Popup> </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