diff --git a/gdgvietnam/templates/index.html b/gdgvietnam/templates/index.html
index 3f1454e..f4cad2d 100644
--- a/gdgvietnam/templates/index.html
+++ b/gdgvietnam/templates/index.html
@@ -1,71 +1,211 @@
{% extends "base.html" %}
-{% load i18n %}
+{% load i18n staticfiles mezzanine_tags %}
{% block meta_title %}{% trans "GDGVietnam" %}{% endblock %}
+{% block extra_css %}
+
+{% endblock %}
+{% block extra_js %}
+
+
+
+{% endblock %}
{% block main %}
-
-
-
-
-
-
- {% for event in events %}
-
-
- {% if event.event.is_ongoing %}
-
- {% else %}
-
- {% endif %}
-
+
+
+
+ {% if events.ongoing_events %}
+
+
+
+ {% for event in events.ongoing_events %}
+
+
Watch Youtube Live! for {{ event.title|truncatechars:30 }}
+ event
+
+
+
+
+
+
+ {% endfor %}
+
- {% endfor %}
-
+
+
+
+
+
+
+
+
+ {% endif %}
+ {% if events.future_events and not events.ongoing_events %}
+
+
+
+ {% for event in events.future_events %}
+
+
Watch Youtube Live! for {{ event.title|truncatechars:30 }}
+ event
-
-
-
-
-
-
-
-
+
+
+
+ OFFICAL
COUNTDOWN
+
+ {{ event.event.date|date:"d/m/y" }}
{{ event.event.start_datetime|date:"c" }}+07:00
+
+
+
+
+
+ {% endfor %}
+
+
+
+
+
+
+
+
+
+ {% endif %}
+ {% if events.lastest_events and not events.ongoing_events %}
+
+
+
+ {% for event in events.lastest_events %}
+
+
+
{{ event.title|truncatechars:100 }}
+
+
![]({{ MEDIA_URL }}{{ event.event.banner_photo }})
+
+
{{ event.event.content|richtext_filter|safe|truncatechars:500 }}
+
Read
+ more
+
+
+
+ {% endfor %}
+
+
+
+
+
+
+
+
+
+ {% endif %}
+
+
+ {#
#}
+ {# #}
+ {##}
+ {##}
+ {# #}
+ {#
#}
+ {# {% for event in events %}#}
+ {# {{ event }}#}
+ {#
#}
+ {# {% endfor %}#}
+ {#
#}
+ {##}
+ {# #}
+ {#
#}
+ {#
#}
+ {# #}
+ {#
#}
+ {#
#}
+ {# #}
+ {#
#}
+
+1231312321
+
-
- "...an independent group based on our interests of Google Technology"
-
+
+
+ "...an independent group based on our interests of Google Technology"
+
- We have frequent meetings for different topics and the format of the meetings varying from presenters to individual interactive groups that focus on one technology in detail. We welcome people from all kind of ages and industries who are interested in, want to share and learn more about technology
+ We have frequent meetings for different topics and the format of the meetings varying from presenters to
+ individual interactive groups that focus on one technology in detail. We welcome people from all kind of
+ ages and industries who are interested in, want to share and learn more about technology
+
-
+
+
+
+
+
What is new about Google Engine
+
post on 1 Oct 2013
+
+
+
by Admin
+
-{#
#}
-{#
#}
-{#
What is new about Google Engine
#}
-{#
post on 1 Oct 2013
#}
-{#
by Admin
#}
-{#
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum
#}
-{#
#}
-{#
#}
+
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh
+ euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis
+ nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem
+ vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu
+ feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum
+ zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend
+ option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent
+ claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt
+ lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur
+ mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram,
+ anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi,
+ qui nunc nobis videntur parum clari, fiant sollemnes in futurum
+
+
+
+
+
{% endblock %}
diff --git a/gdgvietnam/templates/pages/eventcontainer.html b/gdgvietnam/templates/pages/eventcontainer.html
index 7ab3688..7b868f1 100644
--- a/gdgvietnam/templates/pages/eventcontainer.html
+++ b/gdgvietnam/templates/pages/eventcontainer.html
@@ -1,5 +1,5 @@
{% extends "pages/page.html" %}
-{% load i18n %}
+{% load i18n staticfiles %}
{% load mezzanine_tags event %}
{% block main %}{{ block.super }}
@@ -39,17 +39,21 @@
{% for event in page.eventcontainer.events %}
{% if event.event.is_past_due %}
{% endif %}
{% endfor %}
diff --git a/gdgvietnam/templates/pages/partners.html b/gdgvietnam/templates/pages/partners.html
new file mode 100644
index 0000000..219405d
--- /dev/null
+++ b/gdgvietnam/templates/pages/partners.html
@@ -0,0 +1,23 @@
+{% extends "pages/page.html" %}
+
+{% load mezzanine_tags %}
+{% block title %}
+ Who Are We
+{% endblock %}
+{% block main %}{{ block.super }}
+
+{% endblock %}
diff --git a/gdgvietnam/wsgi.py b/gdgvietnam/wsgi.py
deleted file mode 100644
index e8461eb..0000000
--- a/gdgvietnam/wsgi.py
+++ /dev/null
@@ -1,9 +0,0 @@
-
-import os
-
-PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
-settings_module = "%s.settings" % PROJECT_ROOT.split(os.sep)[-1]
-os.environ.setdefault("DJANGO_SETTINGS_MODULE", settings_module)
-
-from django.core.wsgi import get_wsgi_application
-application = get_wsgi_application()
diff --git a/mezzanine-events/mezzanine_events/models.py b/mezzanine-events/mezzanine_events/models.py
index e50d466..152d8d4 100644
--- a/mezzanine-events/mezzanine_events/models.py
+++ b/mezzanine-events/mezzanine_events/models.py
@@ -1,3 +1,7 @@
+from datetime import datetime as dt
+import os
+from datetime import datetime
+
from django.db import models
from mezzanine.pages.models import Page
from mezzanine.core.models import RichText
@@ -5,124 +9,179 @@
from geopy.geocoders import GoogleV3 as GoogleMaps
from geopy.geocoders.googlev3 import GQueryError
from django.contrib.sites.models import Site
-from datetime import timedelta, datetime as dt
from mezzanine.utils.sites import current_site_id
from mezzanine.conf import settings
-import os
-from datetime import date
+
+
def _get_current_domain():
- return Site.objects.get(id=current_site_id()).domain
+ return Site.objects.get(id=current_site_id()).domain
+
+
def get_image_path(instance, filename):
- path= os.path.join('', str(instance.id), filename)
+ path = os.path.join('', str(instance.id), filename)
print path
return path
+
class Event(Page, RichText):
- date = models.DateField()
- start_time = models.TimeField()
- end_time = models.TimeField()
- speakers = models.TextField(blank=True, help_text="Leave blank if not relevant. Write one name per line.")
- location = models.TextField()
- mappable_location = models.CharField(max_length=128, blank=True, help_text="This address will be used to calculate latitude and longitude. Leave blank and set Latitude and Longitude to specify the location yourself, or leave all three blank to auto-fill from the Location field.")
- lat = models.DecimalField(max_digits=10, decimal_places=7, blank=True, null=True, verbose_name="Latitude", help_text="Calculated automatically if mappable location is set.")
- lon = models.DecimalField(max_digits=10, decimal_places=7, blank=True, null=True, verbose_name="Longitude", help_text="Calculated automatically if mappable location is set.")
- rsvp = models.TextField(blank=True, help_text="RSVP information. Leave blank if not relevant. Emails will be converted into links.")
- banner_photo = models.ImageField(upload_to=get_image_path, blank=True, null=True, help_text="960px : 300px")
- small_banner_photo = models.ImageField(upload_to=get_image_path, blank=True, null=True, help_text="width : height = 4:3")
- live_youtube_link = models.TextField(blank=True, help_text="Ongoing event will be post in homepage.")
-
- def speakers_list(self):
- return [x for x in self.speakers.split("\n") if x.strip() != ""]
-
- def start_datetime(self):
- return dt.combine(self.date, self.start_time)
-
- def end_datetime(self):
- return dt.combine(self.date, self.end_time)
-
- def clean(self):
- super(Event, self).clean()
-
- if self.lat and not self.lon:
- raise ValidationError("Longitude required if specifying latitude.")
-
- if self.lon and not self.lat:
- raise ValidationError("Latitude required if specifying longitude.")
-
- if not (self.lat and self.lon) and not self.mappable_location:
- self.mappable_location = self.location.replace("\n",", ")
-
- if self.mappable_location: #location should always override lat/long if set
- g = GoogleMaps(domain=settings.MZEVENTS_GOOGLE_MAPS_DOMAIN)
- try:
- location, (lat, lon) = g.geocode(self.mappable_location.encode('utf-8'))
- except GQueryError as e:
- raise ValidationError("The mappable location you specified could not be found on {service}: \"{error}\" Try changing the mappable location, removing any business names, or leaving mappable location blank and using coordinates from getlatlon.com.".format(service="Google Maps", error=e.message))
- except ValueError as e:
- raise ValidationError("The mappable location you specified could not be found on {service}: \"{error}\" Try changing the mappable location, removing any business names, or leaving mappable location blank and using coordinates from getlatlon.com.".format(service="Google Maps", error=e.message))
- self.mappable_location = location
- self.lat = lat
- self.lon = lon
-
- def save(self, *args, **kwargs):
- # determine whether the page needs to be hidden
- # this has to be done here because we don't have access to the parent in clean()
- hide_page = False
-
- if self.parent is not None:
- hide_page = isinstance(self.parent.get_content_model(), EventContainer) and self.parent.get_content_model().hide_children
-
- if hide_page:
- # older versions
- self.in_navigation = False
- # newer versions
- self.in_menus = ""
-
- super(Event, self).save(*args, **kwargs)
- @property
- def is_past_due(self):
- if date.today() > self.date:
- return True
- return False
- @property
- def is_future_due(self):
- if date.today() < self.date:
- return True
- return False
- @property
- def is_ongoing(self):
- if date.today() == self.date:
- return True
- return False
- class Meta:
- verbose_name = "Event"
-
-class EventContainer (Page):
- hide_children = models.BooleanField(default=True, verbose_name="Hide events in this container from navigation")
- class Meta:
- verbose_name = "Event Container"
-
- def events(self):
- """Convenience method for getting at all events in a container, in the right order, from a template."""
- return self.children.published().order_by('_order')
- def future_events(self):
- events = self.children.published().order_by('_order')
- event_list=[]
- for event in events:
- if event.event.is_future_due:
- event_list.append(event)
- return event_list
- @property
- def has_past_due(self):
- events = self.events()
- for event in events:
- if event.event.is_past_due:
- return True
- return False
- @property
- def has_future_due(self):
- events = self.events()
- for event in events:
- if event.event.is_future_due:
- return True
- return False
+ date = models.DateField()
+ start_time = models.TimeField()
+ end_time = models.TimeField()
+ speakers = models.TextField(
+ blank=True, help_text="Leave blank if not relevant. Write one name per line.")
+ location = models.TextField()
+ mappable_location = models.CharField(
+ max_length=128, blank=True,
+ help_text="This address will be used to calculate latitude and longitude. Leave blank and set Latitude and Longitude to specify the location yourself, or leave all three blank to auto-fill from the Location field.")
+ lat = models.DecimalField(
+ max_digits=10, decimal_places=7, blank=True, null=True,
+ verbose_name="Latitude", help_text="Calculated automatically if mappable location is set.")
+ lon = models.DecimalField(
+ max_digits=10, decimal_places=7, blank=True, null=True,
+ verbose_name="Longitude", help_text="Calculated automatically if mappable location is set.")
+ rsvp = models.TextField(
+ blank=True, help_text="RSVP information. Leave blank if not relevant. Emails will be converted into links.")
+ banner_photo = models.ImageField(
+ upload_to=get_image_path, blank=True, null=True, help_text="960px : 300px")
+ small_banner_photo = models.ImageField(
+ upload_to=get_image_path, blank=True, null=True, help_text="width : height = 4:3")
+ live_youtube_link = models.TextField(
+ blank=True, help_text="Ongoing event will be post in homepage.")
+
+ def speakers_list(self):
+ return [x for x in self.speakers.split("\n") if x.strip() != ""]
+
+ def start_datetime(self):
+ return dt.combine(self.date, self.start_time)
+
+ def end_datetime(self):
+ return dt.combine(self.date, self.end_time)
+
+ def clean(self):
+ super(Event, self).clean()
+
+ if self.lat and not self.lon:
+ raise ValidationError("Longitude required if specifying latitude.")
+
+ if self.lon and not self.lat:
+ raise ValidationError("Latitude required if specifying longitude.")
+
+ if not (self.lat and self.lon) and not self.mappable_location:
+ self.mappable_location = self.location.replace("\n", ", ")
+
+ # location should always override lat/long if set
+ if self.mappable_location:
+ g = GoogleMaps(domain=settings.MZEVENTS_GOOGLE_MAPS_DOMAIN)
+ try:
+ location, (lat, lon) = g.geocode(
+ self.mappable_location.encode('utf-8'))
+ except GQueryError as e:
+ raise ValidationError(
+ "The mappable location you specified could not be found on {service}: \"{error}\" Try changing the mappable location, removing any business names, or leaving mappable location blank and using coordinates from getlatlon.com.".format(
+ service="Google Maps", error=e.message))
+ except ValueError as e:
+ raise ValidationError(
+ "The mappable location you specified could not be found on {service}: \"{error}\" Try changing the mappable location, removing any business names, or leaving mappable location blank and using coordinates from getlatlon.com.".format(
+ service="Google Maps", error=e.message))
+ self.mappable_location = location
+ self.lat = lat
+ self.lon = lon
+
+ def save(self, *args, **kwargs):
+ # determine whether the page needs to be hidden
+ # this has to be done here because we don't have access to the parent
+ # in clean()
+ hide_page = False
+
+ if self.parent is not None:
+ hide_page = isinstance(self.parent.get_content_model(),
+ EventContainer) and self.parent.get_content_model().hide_children
+
+ if hide_page:
+ # older versions
+ self.in_navigation = False
+ # newer versions
+ self.in_menus = ""
+
+ super(Event, self).save(*args, **kwargs)
+
+ @property
+ def is_past_due(self):
+ if datetime.today().date() > self.date:
+ return True
+ return False
+
+ @property
+ def is_future_due(self):
+ if datetime.today().date() < self.date:
+ return True
+ return False
+
+ @property
+ def is_ongoing(self):
+ if self.date == datetime.today().date():
+ return True
+ return False
+
+ class Meta:
+ verbose_name = "Event"
+
+
+class EventContainer(Page):
+ hide_children = models.BooleanField(
+ default=True, verbose_name="Hide events in this container from navigation")
+
+ class Meta:
+ verbose_name = "Event Container"
+
+ def events(self):
+ """Convenience method for getting at all events in a container, in the right order, from a template."""
+ return self.children.published().order_by('_order')
+
+ def ongoing_events(self):
+ events = self.children.published().order_by('_order')
+ event_list = []
+ for event in events:
+ if event.event.is_ongoing:
+ event_list.append(event)
+ return event_list
+
+ def future_events(self):
+ events = self.children.published().order_by('_order')
+ event_list = []
+ for event in events:
+ if event.event.is_future_due:
+ event_list.append(event)
+ return event_list
+
+ def past_events(self):
+ events = self.children.published().order_by('_order')
+ event_list = []
+ for event in events:
+ if event.event.is_past_due:
+ event_list.append(event)
+ return event_list
+
+ @property
+ def has_past_due(self):
+ events = self.events()
+ for event in events:
+ if event.event.is_past_due:
+ return True
+ return False
+
+ @property
+ def has_future_due(self):
+ events = self.events()
+ for event in events:
+ if event.event.is_future_due:
+ return True
+ return False
+
+ @property
+ def has_ongoing(self):
+ events = self.events()
+ for event in events:
+ if event.event.is_ongoing:
+ return True
+ return False