Browse files

Merge pull request #26 from pmclanahan/720019-remove-events-section

Remove events app and references.
  • Loading branch information...
2 parents 4130531 + f7c8ec6 commit b53479d9860ccdeeb666e5959352b94c292e53de @tofumatt tofumatt committed Feb 29, 2012
View
15 apps/events/admin.py
@@ -1,15 +0,0 @@
-from django.contrib import admin
-
-from events.models import Event, Venue
-
-
-class EventAdmin(admin.ModelAdmin):
- prepopulated_fields = {'slug': ('name',)}
-
-
-class VenueAdmin(admin.ModelAdmin):
- prepopulated_fields = {'slug': ('name', 'city')}
-
-
-admin.site.register(Event, EventAdmin)
-admin.site.register(Venue, VenueAdmin)
View
65 apps/events/migrations/0004_auto__del_venue__del_event.py
@@ -0,0 +1,65 @@
+# encoding: utf-8
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+
+ # Deleting model 'Venue'
+ db.delete_table('events_venue')
+
+ # Deleting model 'Event'
+ db.delete_table('events_event')
+
+ # Removing M2M table for field attendees on 'Event'
+ db.delete_table('events_event_attendees')
+
+
+ def backwards(self, orm):
+
+ # Adding model 'Venue'
+ db.create_table('events_venue', (
+ ('address_two', self.gf('django.db.models.fields.CharField')(max_length=150, blank=True)),
+ ('city', self.gf('django.db.models.fields.CharField')(max_length=100, blank=True)),
+ ('state', self.gf('django.db.models.fields.CharField')(max_length=100, blank=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
+ ('address', self.gf('django.db.models.fields.CharField')(max_length=150, blank=True)),
+ ('country', self.gf('django.db.models.fields.CharField')(max_length=100, blank=True)),
+ ('zip_code', self.gf('django.db.models.fields.CharField')(max_length=15, blank=True)),
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('slug', self.gf('django.db.models.fields.SlugField')(max_length=100, unique=True, db_index=True)),
+ ))
+ db.send_create_signal('events', ['Venue'])
+
+ # Adding model 'Event'
+ db.create_table('events_event', (
+ ('description', self.gf('django.db.models.fields.TextField')()),
+ ('featured', self.gf('django.db.models.fields.BooleanField')(default=False)),
+ ('featured_image', self.gf('django.db.models.fields.files.ImageField')(max_length=100, null=True, blank=True)),
+ ('end', self.gf('django.db.models.fields.DateTimeField')()),
+ ('slug', self.gf('django.db.models.fields.SlugField')(max_length=100, unique=True, db_index=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
+ ('venue', self.gf('django.db.models.fields.related.ForeignKey')(default=None, to=orm['events.Venue'], null=True)),
+ ('created_by', self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='events', null=True, to=orm['users.Profile'])),
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('start', self.gf('django.db.models.fields.DateTimeField')()),
+ ))
+ db.send_create_signal('events', ['Event'])
+
+ # Adding M2M table for field attendees on 'Event'
+ db.create_table('events_event_attendees', (
+ ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
+ ('event', models.ForeignKey(orm['events.event'], null=False)),
+ ('profile', models.ForeignKey(orm['users.profile'], null=False))
+ ))
+ db.create_unique('events_event_attendees', ['event_id', 'profile_id'])
+
+
+ models = {
+
+ }
+
+ complete_apps = ['events']
View
68 apps/events/models.py
@@ -1,68 +0,0 @@
-from django.conf import settings
-from django.db import models
-
-from tower import ugettext_lazy as _
-
-from innovate.models import BaseModel
-from users.models import Profile
-
-
-class Venue(BaseModel):
- name = models.CharField(verbose_name=_(u'Name'), max_length=100)
- slug = models.SlugField(verbose_name=_(u'URL Slug'), unique=True,
- max_length=100)
- address = models.CharField(verbose_name=_(u'Street Address 1'),
- max_length=150, blank=True)
- address_two = models.CharField(verbose_name=_(u'Street Address 2'),
- max_length=150, blank=True)
- city = models.CharField(verbose_name=_(u'City'), max_length=100,
- blank=True)
- state = models.CharField(verbose_name=_(u'State/Province'), max_length=100,
- blank=True)
- zip_code = models.CharField(verbose_name=_(u'Zip/Postal Code'),
- max_length=15, blank=True)
- country = models.CharField(verbose_name=_(u'Country'), max_length=100,
- blank=True)
-
- def __unicode__(self):
- return self.name
-
- @property
- def full_address(self):
- fields = (self.address, self.address_two, self.city, self.state,
- self.country, self.zip_code)
- populated = []
- for field in fields:
- if field:
- populated.append(field)
- return u', '.join(populated)
-
-
-class Event(BaseModel):
- name = models.CharField(verbose_name=_(u'Event Name'),
- max_length=100)
- slug = models.SlugField(verbose_name=_(u'Slug'), unique=True,
- max_length=100)
- start = models.DateTimeField(verbose_name=_(u'Start Date'))
- end = models.DateTimeField(verbose_name=_(u'End Date'))
- description = models.TextField(verbose_name=_(u'Description'))
- attendees = models.ManyToManyField(Profile, verbose_name=_(u'Attendees'),
- blank=True)
- venue = models.ForeignKey(Venue, null=True, default=None)
- featured = models.BooleanField(
- verbose_name=_(u'Featured?'), default=False,
- help_text=_(u'Display this event on the splash page'))
- featured_image = models.ImageField(
- verbose_name=_(u'Featured Image'),
- blank=True, null=True, upload_to=settings.EVENT_IMAGE_PATH,
- help_text=_(u'This image will appear on the splash page if this ' +
- 'is a featured project'))
- created_by = models.ForeignKey('users.Profile', related_name='events',
- null=True, default=None)
-
- @property
- def featured_image_or_default(self):
- return self.featured_image or 'img/featured-default.gif'
-
- def __unicode__(self):
- return self.name
View
62 apps/events/templates/events/all.html
@@ -1,62 +0,0 @@
-{% extends "base.html" %}
-{% from "layout/breadcrumbs.html" import breadcrumbs %}
-
-{% block page_title %}{{ _('Events : Mozilla Labs') }}{% endblock %}
-
-{% block page_id %}all_events{% endblock %}
-{% block section_class %}events{% endblock %}
-
-{% block breadcrumbs -%}
-{{ breadcrumbs(
- (url('innovate_splash'), _('Mozilla Labs Home')),
- last=_('Events')) }}
-{% endblock -%}
-
-{% block content -%}
-<h1 class="light c6">{{ _('Events') }}</h1>
-
-<section class="sup w1 clearfix">
- <ul class="c1">
- <li class="selected"><a class="brandColor" href="{{ url('events_all') }}">{{ _('Events') }}</a></li>
- </ul>
-</section>
-
-<section id="eventsContent" class="w3">
- <ul id="posts" class="clearfix">
- {% for event in events -%}
- <li class="post c3">
- <div class="eventMap">
- <a class="map" href="{{ url('events_show', slug=event.slug) }}">
- <span class="zoom2-hit"></span>
- <img class="zoom0 thick block" width="140" height="140" src="http://maps.google.com/maps/api/staticmap?zoom=7&amp;size=140x140&amp;maptype=roadmap&amp;sensor=false&amp;markers=color:red|{{ event.venue.full_address }}&center={{ event.venue.full_address }}">
- </a>
- </div>
- <div class="eventListInfo">
- <h3 class="normal"><a class="eventColor" href="{{ url('events_show', slug=event.slug) }}">{{ event.name }}</a></h3>
- <div class="blogHeader">
- <time datetime="{{ event.start.strftime('%Y-%m-%d') }}">{{ event.start.strftime('%B %d, %Y') }}</time>
- </div>
- <div class="content">
- {# editable by admin only. okay to use 'safe' here. #}
- <p class="serif">{{ event.description|truncate(160)|safe }}</p>
- </div>
- </div>
- </li>
- {% endfor -%}
- </ul>
-</section>
-
-{% if upcoming -%}
-<aside id="eventsSidebar" class="w2 clearfix">
- <div class="c2 paper">
- <h3 class="light">{{ _('Upcoming Events') }}</h3>
- <ul>
- {% for event in upcoming -%}
- <li><strong><time datetime="{{ event.start.strftime('%Y-%m-%d') }}">{{ event.start.strftime('%b %d') }}</time></strong> &mdash; <a class="brandColor" href="{{ url('events_show', slug=event.slug) }}">{{ event.name }}</a></li>
- {% endfor -%}
- </ul>
- </div>
-</aside>
-{% endif -%}
-
-{% endblock -%}
View
107 apps/events/templates/events/show.html
@@ -1,107 +0,0 @@
-{% extends "base.html" %}
-{% from "layout/breadcrumbs.html" import breadcrumbs %}
-
-{% block page_title -%}
-{{ _('{event_name} : Events : Mozilla Labs')|f(event_name=event.name) }}
-{% endblock -%}
-
-{% block page_id %}show_event{% endblock %}
-{% block section_class %}events{% endblock %}
-
-{% block breadcrumbs -%}
-{{ breadcrumbs(
- (url('innovate_splash'), _('Mozilla Labs Home')),
- (url('events_all'), _('Events')),
- last=event.name) }}
-{% endblock -%}
-
-{% if request.user.is_authenticated() -%}
- {% if request.user.get_profile() in event.attendees.all() -%}
- {% set form_action = url('events_unattend', slug=event.slug) %}
- {% set button_label = _('stop attending') %}
- {% else -%}
- {% set form_action = url('events_attend', slug=event.slug) %}
- {% set button_label = _('RSVP to this event') %}
- {% endif -%}
-{% endif -%}
-
-{% block content -%}
-<h1 class="light c6">{{ event.name }}</h1>
-
-<section class="w3">
- <div id="eventInfo" class="c3 paper">
-
- <a class="map" href="http://maps.google.com/maps?q={{ event.venue.full_address }}">
- <span class="zoom2-hit"></span>
- <img class="zoom0" width="420" height="300" src="http://maps.google.com/maps/api/staticmap?zoom=7&size=420x300&maptype=roadmap&sensor=false&markers=color:red|{{ event.venue.full_address }}&center={{ event.venue.full_address }}">
- <img class="zoom1" src="http://maps.google.com/maps/api/staticmap?zoom=11&size=420x300&maptype=roadmap&sensor=false&markers=color:red|{{ event.venue.full_address }}&center={{ event.venue.full_address }}">
- <img class="zoom2" src="http://maps.google.com/maps/api/staticmap?zoom=13&size=420x300&maptype=roadmap&sensor=false&markers=color:red|{{ event.venue.full_address }}&center={{ event.venue.full_address }}">
- </a>
-
- {% if request.user.is_authenticated() -%}
- <form method="post" action="{{ form_action }}">
- {{ csrf()|safe }}
- <button class="submit sans">{{ button_label }}</button>
- </form>
- {% endif -%}
-
- <div class="row clearfix">
- <div class="label">{{ _('Date:') }}</div>
- <div class="for">
- <span class="line">{{ event.start.strftime('%B %d, %Y') }}</span>
- </div>
- </div>
-
- <div class="row clearfix">
- <div class="label">{{ _('Time:') }}</div>
- <div class="for">
- <span class="line">{{ event.start.strftime('%H:%M') }} - {{ event.end.strftime('%H:%M') }}</span>
- </div>
- </div>
-
- {% if event.venue -%}
- <div class="row clearfix">
- <div class="label">{{ _('Location:') }}</div>
- <div class="for">
- <span class="line">{{ event.venue.address }}</span>
- <span class="line">{{ event.venue.city }}, {{ event.venue.state }}</span>
- <span class="line">{{ event.venue.country }} {{ event.venue.zip_code }}</span>
- </div>
- </div>
- {% endif -%}
- </div>
-
-</section>
-
-<section id="eventsContent" class="w3">
- <div class="eventHeader">
- <h4 class="sans">{{ _('About this event') }}</h4>
- </div>
- <div class="c3 content serif clearfix">
- {# events are only created by admins, so it's safe to use safe here. #}
- <p class="serif">{{ event.description|safe }}</p>
- </div>
-
-{% if event.attendees.all()|length > 0 -%}
- <hr>
-
- <div class="people clearfix">
- <div class="c3">
- <h2 class="light">{{ _('People attending ({count})')|f(count=event.attendees.all()|length) }}</h2>
- </div>
- <ul class="peopleList clearfix c3">
- {% for person in event.attendees.all() -%}
- <li>
- <a href="{{ url('users_profile', username=person.user.username) }}">
- <img src="{{ MEDIA_URL }}{{ person.avatar_or_default }}" height="32" width="32">
- </a>
- </li>
- {% endfor -%}
- </ul>
- </div>
-
-{% endif -%}
-</section>
-
-
-{% endblock -%}
View
11 apps/events/urls.py
@@ -1,11 +0,0 @@
-from django.conf.urls.defaults import patterns, url
-
-
-urlpatterns = patterns('',
- url('^/$', 'events.views.all', name='events_all'),
- url('^/(?P<slug>[\w-]+)/$', 'events.views.show', name='events_show'),
- url('^/(?P<slug>[\w-]+)/attend/$', 'events.views.attend',
- name='events_attend'),
- url('^/(?P<slug>[\w-]+)/unattend/$', 'events.views.unattend',
- name='events_unattend'),
-)
View
50 apps/events/views.py
@@ -1,50 +0,0 @@
-import jingo
-import datetime
-
-from django.contrib.auth.decorators import login_required
-from django.core.urlresolvers import reverse
-from django.http import HttpResponseRedirect
-from django.shortcuts import get_object_or_404
-from django.views.decorators.http import require_POST
-
-from events.models import Event
-
-
-def all(request):
- events = Event.objects.all().order_by('start')
- upcoming = Event.objects.filter(start__gte=datetime.datetime.now())
- return jingo.render(request, 'events/all.html', {
- 'events': events,
- 'upcoming': upcoming,
- })
-
-
-def show(request, slug):
- event = get_object_or_404(Event, slug=slug)
- return jingo.render(request, 'events/show.html', {
- 'event': event
- })
-
-
-@require_POST
-@login_required
-def attend(request, slug):
- event = get_object_or_404(Event, slug=slug)
- profile = request.user.get_profile()
- if profile not in event.attendees.all():
- event.attendees.add(profile)
- event.save()
- return HttpResponseRedirect(
- reverse('events_show', kwargs=dict(slug=slug)))
-
-
-@require_POST
-@login_required
-def unattend(request, slug):
- event = get_object_or_404(Event, slug=slug)
- profile = request.user.get_profile()
- if profile in event.attendees.all():
- event.attendees.remove(profile)
- event.save()
- return HttpResponseRedirect(
- reverse('events_show', kwargs=dict(slug=slug)))
View
15 apps/innovate/templates/innovate/splash.html
@@ -48,21 +48,6 @@ <h3 class="serif"><a class="brandColor" href="{{ entry.url }}">{{ entry.title }}
</article>
{% endif %}
</section>
- <section class="events c2">
- <h2><a href="{{ url('events_all') }}">{{ _('Events') }}</a></h2>
- <p>{% trans %}Find and participate in events happening in your area or engage in one of our online contests.{% endtrans %}</p>
- {% if featured_event %}
- <article class="paper">
- <div class="arrow"></div>
- <h3>{{ _('Featured Event') }}</h3>
- <a href="{{ url('events_show', slug=featured_event.slug) }}">
- <img class="block thick" src="{{ MEDIA_URL }}{{ featured_event.featured_image_or_default }}" width="260" height="125">
- <h4>{{ featured_event.name }}</h4>
- </a>
- <p>{{ featured_event.description|striptags|truncate(43) }}</p>
- </article>
- {% endif %}
- </section>
<section class="people c2">
<h2><a href="{{ url('users_all') }}">{{ _('People') }}</a></h2>
<p>{% trans %}The open web is made up of awesome people, connect and communicate with some of them here.{% endtrans %}</p>
View
4 apps/innovate/views.py
@@ -4,18 +4,16 @@
from users.models import Profile
from projects.models import Project
-from events.models import Event
from feeds.models import Entry
def splash(request):
- """Display splash page. With featured project, event, person, blog post."""
+ """Display splash page. With featured project, person, blog post."""
def get_random(cls, **kwargs):
choices = cls.objects.filter(**kwargs)
return choices and random.choice(choices) or None
return jingo.render(request, 'innovate/splash.html', {
'featured_project': get_random(Project, featured=True),
- 'featured_event': get_random(Event, featured=True),
'featured_user': get_random(Profile, featured=True),
'entry': get_random(Entry, link__featured=True)
})
View
12 templates/base.html
@@ -25,9 +25,6 @@
<li class="projects">
<a class="topic{{ active(request, url('projects_all')) }}" href="{{ url('projects_all') }}">{{ _('Projects') }}</a>
</li>
- <li class="events">
- <a class="event{{ active(request, url('events_all')) }}" href="{{ url('events_all') }}">{{ _('Events') }}</a>
- </li>
<li class="users">
<a class="users{{ active(request, url('users_all')) }}" href="{{ url('users_all') }}">{{ _('People') }}</a>
</li>
@@ -111,15 +108,6 @@
</ul>
</div>
<div class="c1">
- <strong>Events</strong>
- <ul>
- <li><a href="{{ url('events_all') }}">{{ _('events home') }}</a></li>
- {# TODO - Implement
- <li><a href="#">education</a></li>
- <li><a href="#">calendar</a></li> #}
- </ul>
- </div>
- <div class="c1">
<strong>{{ _('People') }}</strong>
<ul>
<li><a href="{{ url('users_all') }}">{{ _('all members') }}</a></li>
View
1 urls.py
@@ -7,7 +7,6 @@
urlpatterns = patterns('',
(r'^admin/', include(admin.site.urls)),
(r'^browserid/', include('django_browserid.urls')),
- (r'^events', include('events.urls')),
(r'^topics', include('topics.urls')),
(r'^push/subscriber/', include('django_push.subscriber.urls')),
(r'', include('innovate.urls')),

0 comments on commit b53479d

Please sign in to comment.