Martin Owens has proposed merging
lp:~doctormo/loco-directory/previous-used-venues into lp:loco-directory.
Requested reviews:
loco-directory-dev (loco-directory-dev)
For more details, see:
https://code.launchpad.net/~doctormo/loco-directory/previous-used-venues/+merge/65071
Add in a previously-used venue section into the create-new event screen.
Also added a create-event link to the event-list screen to help UI.
--
https://code.launchpad.net/~doctormo/loco-directory/previous-used-venues/+merge/65071
Your team loco-directory-dev is requested to review the proposed merge of
lp:~doctormo/loco-directory/previous-used-venues into lp:loco-directory.
=== modified file 'loco_directory/events/forms.py'
--- loco_directory/events/forms.py 2011-02-17 21:24:49 +0000
+++ loco_directory/events/forms.py 2011-06-17 22:31:32 +0000
@@ -90,9 +90,22 @@
in a way that Django will convert to OptGroups
"""
venue_choices = [('', '---------')]
+ previous_venues = []
+ previous_choice = []
country_choices = []
current_country = ''
-
+
+ # Have a look for previously used event venues
+ team_events = TeamEvent.objects.filter(teams__lp_name__in=self.teams)
+ for event in team_events:
+ if event.venue not in previous_venues:
+ previous_venues.append(event.venue)
+ previous_choice.append((event.venue.id, str(event.venue)))
+
+ # Add a previously used menu list if required.
+ if previous_venues:
+ venue_choices.insert(1, (_("Previously Used"), previous_choice))
+
# Show the venues which belong the the 'current team' first. then show the other countries
venues_team = Venue.objects.filter(country__team__in=self.teams).order_by('country', 'spr', 'city')
venues_other = Venue.objects.all().exclude(country__team__in=self.teams).order_by('country', 'spr', 'city')
@@ -101,6 +114,9 @@
# Ordered by country so we can tell when we're done with one
# and starting another
for venue in venues:
+ # Ignore the venue if we've added it before.
+ if venue in previous_venues:
+ continue
# If this venue has a different country, start a new group
if venue.country != current_country:
# Add the old group to the list if it's non-empty
@@ -110,6 +126,7 @@
current_country = venue.country
# Add venue to the current country group
country_choices.append((venue.id, str(venue)))
+
# Add the last country group to the list if it's non-empty
if len(country_choices) > 0:
=== modified file 'loco_directory/teams/views.py'
--- loco_directory/teams/views.py 2011-02-26 02:09:43 +0000
+++ loco_directory/teams/views.py 2011-06-17 22:31:32 +0000
@@ -104,9 +104,13 @@
"""
team_object = get_object_or_404(Team, lp_name=team_slug)
team_event_list = team_object.teamevent_set.next_events()
+ is_member = False
+ if request.user.is_authenticated():
+ is_member = launchpad.is_team_member(request.user, team_object)
context = {
'team_object': team_object,
'team_event_list': team_event_list,
+ 'is_member' : is_member,
}
return render_to_response('teams/team_event_list.html', context,
RequestContext(request))
=== modified file 'loco_directory/templates/teams/team_event_list.html'
--- loco_directory/templates/teams/team_event_list.html 2010-11-20 17:25:50 +0000
+++ loco_directory/templates/teams/team_event_list.html 2011-06-17 22:31:32 +0000
@@ -7,6 +7,7 @@
<a class="sub-nav-item" href="{% url team-detail team_object.lp_name %}">{% trans "Back to Team Details" %}</a>
<a class="sub-nav-item" href="{% url team-event-history team_object.lp_name %}">{% trans "Past Events" %}</a>
<a class="sub-nav-item" href="{% url team-events-rss team_object.lp_name %}" title="{% trans "Team Events (RSS)" %}"">{% trans "Team Events (RSS)" %}</a>
+{% if is_member %}<a class="sub-nav-item" href="{% url team-event-new team_object.lp_name %}" title="{% trans "Add New Event" %}">{% trans "Add New Event" %}</a>{% endif %}
{% endblock %}
@@ -26,9 +27,10 @@
{% include "events/team_event_list.inc.html" %}
{% else %}
-<p>{% blocktrans with team_object.lp_name as teamname %}There are currently no Events for LoCo Team {{teamname}} :({% endblocktrans %}</p>
+<h2>{% blocktrans with team_object.lp_name as teamname %}There are currently no events for this team.{% endblocktrans %}</h2>
{% endif %}
+
</article>
{% endblock %}
_______________________________________________
Mailing list: https://launchpad.net/~loco-directory-dev
Post to : [email protected]
Unsubscribe : https://launchpad.net/~loco-directory-dev
More help : https://help.launchpad.net/ListHelp