Skip to content
This repository has been archived by the owner on Mar 30, 2021. It is now read-only.

Commit

Permalink
Adds basic meetup.com integration
Browse files Browse the repository at this point in the history
  • Loading branch information
zerok committed Feb 17, 2012
1 parent 4ada15a commit 918c971
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 1 deletion.
17 changes: 17 additions & 0 deletions migrations/versions/003_meetupfield.py
@@ -0,0 +1,17 @@
from sqlalchemy import *
from migrate import *

meta = MetaData()

meetup_tbl = Table('meetup', meta)
meetupcom_id_col = Column('meetupcom_eventid', String, nullable=True)

def upgrade(migrate_engine):
meta.bind = migrate_engine
meetup_tbl.create_column(meetupcom_id_col)
pass

def downgrade(migrate_engine):
meta.bind = migrate_engine
meetup_tbl.drop_column(meetupcom_id_col)
pass
1 change: 1 addition & 0 deletions pygraz_website/__init__.py
Expand Up @@ -48,6 +48,7 @@ def create_app(envar="FLASK_SETTINGS", config_object=None):
app.jinja_env.filters['rst'] = filters.rst
app.jinja_env.filters['urlencode'] = filters.urlencode
app.jinja_env.filters['urlize'] = filters.urlize
app.jinja_env.filters['in_future'] = filters.in_future
app.secret_key = app.config['SECRET_KEY']

db.init_app(app)
Expand Down
5 changes: 4 additions & 1 deletion pygraz_website/filters.py
Expand Up @@ -93,4 +93,7 @@ def urlize(v, return_matches=False):
if return_matches:
return UrlizeResult(result, matches)
return result


def in_future(meetup):
return meetup.start > datetime.datetime.utcnow()

2 changes: 2 additions & 0 deletions pygraz_website/forms.py
Expand Up @@ -48,6 +48,7 @@ class UniqueMeetupStartDate(Validator):
fail = _('There already is a meetup on this day')

def validate(self, element, state):
#import pdb; pdb.set_trace()
if element.value is None:
return False
other_meetups = models.Meetup.query_by_date(element.value).all()
Expand Down Expand Up @@ -104,6 +105,7 @@ class MeetupForm(flatland.Form):
notes = flatland.String.using(optional=True)
location = flatland.String.using(optional=True)
address = flatland.String.using(optional=True)
meetupcom_eventid = flatland.String.using(optional=True)


class LoginForm(flatland.Form):
Expand Down
1 change: 1 addition & 0 deletions pygraz_website/models.py
Expand Up @@ -12,6 +12,7 @@ class Meetup(db.Model):
location = db.Column(db.String(255))
address = db.Column(db.String(255))
notes = db.Column(db.Text)
meetupcom_eventid = db.Column(db.String(255))

def as_dict(self):
return instance_dict(self)
Expand Down
Binary file added pygraz_website/static/s/meetup-logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions pygraz_website/static/s/src/screen.scss
Expand Up @@ -391,3 +391,35 @@ form {
line-height: 1.5em;
margin-top: 10px;
}

#body .meetupcom {
@include border-radius(3px);
background: #EFEFEF url(meetup-logo.png) 2% 50% no-repeat;
padding: 10px 10px 10px 110px;
font-size: 110%;
p {
margin-bottom: 0 !important;
font-style: italic;
a {
font-weight: bold;
text-transform: uppercase;
font-style: normal;
}
}
p.info {
font-style:normal;
margin-top: 8px;
font-size: 80%;
}
margin-bottom: 1.5em;
}

#credits {
text-align: center;
margin: 2em 0;
font-size: 70%;
color: #AAA;
a {
color: #888;
}
}
1 change: 1 addition & 0 deletions pygraz_website/templates/base.html
Expand Up @@ -72,6 +72,7 @@
</div>
<footer>
{% block footer %}{% endblock %}
<p id="credits">Meetup.com logo provided by <a href="http://www.meetup.com/">meetup.com</a>.</p>
</footer>
</div>
</body>
Expand Down
11 changes: 11 additions & 0 deletions pygraz_website/templates/meetup.html
Expand Up @@ -3,6 +3,17 @@
{% block title %}Treffen vom {{ meetup.start|date }}{% endblock %}
{% block body %}
<h1>Treffen vom {{ meetup.start|date }}</h1>
{% if meetup.meetupcom_eventid and meetup|in_future %}
<div class="meetupcom">
<p>
Falls du kommen möchtest, melde dich bitte bei Gelegenheit auf <a href="http://www.meetup.com/PyGRAZ/events/{{ meetup.meetupcom_eventid }}/">Meetup.com</a>
zu diesem Treffen an.
</p>
<p class="info">
Eine Anmeldung ist zwar nicht zwingend erforderlich, hilft uns aber bei der Organisation.
</p>
</div>
{% endif %}
{% if meetup.notes %}
{{ meetup.notes|rst|safe }}
{% else %}
Expand Down
5 changes: 5 additions & 0 deletions pygraz_website/templates/meetups/edit.html
Expand Up @@ -31,6 +31,11 @@
{{ forms.errors(form.address) }}
<p class="info">... mit der auch Google Maps etwas anfangen kann.</p>
</div>
<div>
<label for="end">Meetup.com ID:</label>
{{ formgen.input(form.meetupcom_eventid, type="text") }}
{{ forms.errors(form.meetupcom_eventid) }}
</div>
<div>
<label for="notes">Notizen:</label>
{{ formgen.textarea(form.notes, type="text") }}
Expand Down
3 changes: 3 additions & 0 deletions pygraz_website/views/meetups.py
Expand Up @@ -238,6 +238,7 @@ def unvote_sessionidea(date, id):
def edit_meetup(date):
real_date = _extract_date(date)
meetup = models.Meetup.query_by_date(real_date).first()
print meetup.meetupcom_eventid
with utils.DocumentLock(meetup) as lock:
if request.method == 'POST':
form = forms.MeetupForm.from_flat(request.form)
Expand All @@ -248,6 +249,7 @@ def edit_meetup(date):
meetup.location = form['location'].value
meetup.address = form['address'].value
meetup.notes = form['notes'].value
meetup.meetupcom_eventid = form['meetupcom_eventid'].value
db.session.add(meetup)
db.session.commit()
lock.unlock()
Expand Down Expand Up @@ -302,6 +304,7 @@ def create_meetup():
meetup = models.Meetup(start=form['start'].value,
end=form['end'].value, location=form['location'].value,
address=form['address'].value,
meetupcom_id=form['meetupcom_id'].value,
notes=form['notes'].value)
db.session.add(meetup)
db.session.commit()
Expand Down

0 comments on commit 918c971

Please sign in to comment.