--- /dev/null
+from django.contrib import admin
+
+from util.admin import PgwebAdmin
+from models import *
+
+class PUGAdmin(PgwebAdmin):
+ list_display = ('title', 'approved', )
+ list_filter = ('approved', )
+ search_fields = ('title', )
+
+admin.site.register(PUG, PUGAdmin)
--- /dev/null
+from django.db import models
+from pgweb.util.bases import PgModel
+
+class PUG(PgModel, models.Model):
+ """
+ contains information about a local PostgreSQL user group
+ """
+ country = models.ForeignKey('core.Country')
+ org = models.ForeignKey('core.Organisation', null=True, blank=True, help_text='Organization that manages the PUG and its contents')
+ approved = models.BooleanField(null=False, blank=False, default=False)
+ locale = models.CharField(max_length=255, help_text="Locale where the PUG meets, e.g. 'New York City'")
+ title = models.CharField(max_length=255, help_text="Title/Name of the PUG, e.g. 'NYC PostgreSQL User Group'")
+ website_url = models.TextField(null=True, blank=True)
+ mailing_list_url = models.TextField(null=True, blank=True)
+
+ def __unicode__(self):
+ return self.title
--- /dev/null
+from django.shortcuts import render_to_response
+
+from pgweb.util.decorators import cache
+from pgweb.util.contexts import NavContext
+
+from models import PUG
+
+def index(request):
+ """
+ contains list of PUGs, in country/locale alphabetical order
+ """
+ pug_list = []
+ for pug in PUG.objects.filter(approved=True).order_by('country__name', 'title').all():
+ if pug_list and pug_list[-1].get('country') == pug.country.name:
+ pug_list['pugs'].append(pug)
+ else:
+ pug_list.append({
+ 'country': pug.country.name,
+ 'pugs': [pug]
+ })
+ return render_to_response('pugs/index.html', {
+ 'pug_list': pug_list,
+ }, NavContext(request, 'community'))
'pgweb.featurematrix',
'pgweb.pwn',
'pgweb.search',
+ 'pgweb.pugs',
]
(r'^community/lists/listinfo/$', 'lists.views.listinfo'),
(r'^community/survey/vote/(\d+)/$', 'survey.views.vote'),
(r'^community/survey[/\.](\d+)(-.*)?/$', 'survey.views.results'),
+ (r'^community/user-groups/$', 'pugs.views.index'),
(r'^community/weeklynews/$', 'pwn.views.index'),
(r'^community/weeklynews/pwn(\d{4})(\d{2})(\d{2})/$', 'pwn.views.post'),
{'title': 'Archives', 'link':'/list/'},
]},
{'title': 'IRC', 'link':'/community/irc/'},
+ {'title': 'Local User Groups', 'link':'/community/user-groups/'},
{'title': 'Featured Users', 'link':'/about/users/'},
{'title': 'International Sites','link':'/community/international/'},
{'title': 'Propaganda', 'link':'/community/propaganda/'},
--- /dev/null
+{%extends "base/page.html"%}
+{%block title%}Local PostgreSQL User Groups (PUGS){%endblock%}
+{%block contents%}
+
+<h1>Local User Groups</h1>
+<p>The PostgreSQL community is proud to have many local chapters that advocate and educate users about PostgreSQL. Below is a list of PostgreSQL User Groups (PUGs) sorted by country and local area. If you would like to start a PostgreSQL User Group, please join the <a href="{% url lists.views.subscribe %}">pgsql-advocacy mailing list</a> and describe the PUG that you want to create.</p>
+<p>If a PUG already exists in your area, follow the URLs below to find out how to attend and participate.</p>
+
+
+{% for pug_group in pug_list %}
+ <h2>{{ pug_group.country }}</h2>
+ <ul>
+ {% for pug in pug_group.pugs %}
+ <li>
+ <strong>{{ pug.locale }}</strong>:
+ {{ pug.title }}
+ {% if pug.website_url %}
+ (<a href="{{ pug.website_url }}">website</a>)
+ {% endif %}
+ {% if pug.mailing_list_url %}
+ (<a href="{{ pug.mailing_list_url }}">mailing list</a>)
+ {% endif %}
+ </li>
+ {% endfor %}
+ </ul>
+{% endfor %}
+{%endblock%}