diff --git a/events/forms.py b/events/forms.py
index 8327f58..786f895 100644
--- a/events/forms.py
+++ b/events/forms.py
@@ -160,10 +160,10 @@ class TeamForm(ModelForm):
class NewTeamForm(ModelForm):
class Meta:
model = Team
- fields = ['name', 'country', 'spr', 'city', 'web_url', 'tz']
+ fields = ['name', 'city', 'web_url', 'tz']
widgets = {
- 'country': Lookup(source='/api/country/', label='name'),
- 'spr': Lookup(source='/api/spr/', label='name'),
+ #'country': Lookup(source='/api/country/', label='name'),
+ #'spr': Lookup(source='/api/spr/', label='name'),
'city': Lookup(source='/api/cities/', label='name'),
}
raw_id_fields = ('country','spr','city')
diff --git a/events/models/profiles.py b/events/models/profiles.py
index 1a75156..80a8dd9 100644
--- a/events/models/profiles.py
+++ b/events/models/profiles.py
@@ -141,9 +141,27 @@ class Team(models.Model):
members = models.ManyToManyField(UserProfile, through='Member', related_name="memberships", blank=True)
+ @property
+ def location_name(self):
+ if self.city:
+ return str(self.city)
+ elif self.spr:
+ return str(self.spr)
+ elif self.country:
+ return str(self.country)
+ else:
+ return ''
+
def __str__(self):
return u'%s' % (self.name)
+ def save(self, *args, **kwargs):
+ if self.city is not None:
+ self.spr = self.city.spr
+ self.country = self.spr.country
+ super().save(*args, **kwargs) # Call the "real" save() method.
+
+
class Member(models.Model):
NORMAL=0
MODERATOR=1
diff --git a/get_together/templates/get_together/base.html b/get_together/templates/get_together/base.html
index 9f114dc..d347319 100644
--- a/get_together/templates/get_together/base.html
+++ b/get_together/templates/get_together/base.html
@@ -86,9 +86,8 @@ form {
-
-
+
+
-
{% block javascript %}{% endblock %}