Author: floguy
Date: Sat Sep 20 22:02:28 2008
New Revision: 912
Modified:
trunk/local_apps/tribes/templatetags/tribe_tags.py
trunk/local_apps/tribes/urls.py
trunk/pinax/settings.py
trunk/pinax/templates/tribes/base.html
Log:
Switched tribes over to using django-things.
Modified: trunk/local_apps/tribes/templatetags/tribe_tags.py
==============================================================================
--- trunk/local_apps/tribes/templatetags/tribe_tags.py (original)
+++ trunk/local_apps/tribes/templatetags/tribe_tags.py Sat Sep 20 22:02:28
2008
@@ -1,11 +1,29 @@
-from django.template import Library
+from django import template
+from tribes.forms import TribeForm
-register = Library()
+register = template.Library()
[EMAIL PROTECTED]("tribes/topic_item.html")
def show_tribe_topic(topic):
return {"topic": topic}
+register.inclusion_tag("tribes/topic_item.html")(show_tribe_topic)
[EMAIL PROTECTED]("tribes/tribe_item.html")
def show_tribe(tribe):
return {"tribe": tribe}
+register.inclusion_tag("tribes/tribe_item.html")(show_tribe)
+
+def do_get_tribe_form(parser, token):
+ try:
+ tag_name, as_, context_name = token.split_contents()
+ except ValueError:
+ tagname = token.contents.split()[0]
+ raise template.TemplateSyntaxError, "%(tagname)r tag syntax is as
follows: {%% %(tagname)r as VARIABLE %%}" % locals()
+ return TribeFormNode(context_name)
+
+class TribeFormNode(template.Node):
+ def __init__(self, context_name):
+ self.context_name = context_name
+ def render(self, context):
+ context[self.context_name] = TribeForm()
+ return ''
+
+register.tag('get_tribe_form', do_get_tribe_form)
\ No newline at end of file
Modified: trunk/local_apps/tribes/urls.py
==============================================================================
--- trunk/local_apps/tribes/urls.py (original)
+++ trunk/local_apps/tribes/urls.py Sat Sep 20 22:02:28 2008
@@ -3,23 +3,25 @@
from tribes.models import Tribe
from wiki import models as wiki_models
+from tribes.thing import TribeThing
+tt = TribeThing(Tribe)
wiki_args = {'group_slug_field': 'slug',
'group_qs': Tribe.objects.all()}
-urlpatterns = patterns('',
+urlpatterns = tt.urls(url_prefix='', name_prefix='tribe_thing') +
patterns('',
url(r'^$', 'tribes.views.tribes', name="tribes_list"),
url(r'^your_tribes/$', 'tribes.views.your_tribes', name="your_tribes"),
- url(r'^(\w+)/$', 'tribes.views.tribe', name="tribe_detail"),
+ url(r'^tribe/(\w+)/$', 'tribes.views.tribe', name="tribe_detail"),
# topics
- url(r'^(\w+)/topics/$', 'tribes.views.topics', name="tribe_topics"),
+ url(r'^tribe/(\w+)/topics/$', 'tribes.views.topics',
name="tribe_topics"),
url(r'^topic/(\d+)/edit/$', 'tribes.views.topic', kwargs={"edit":
True}, name="tribe_topic_edit"),
url(r'^topic/(\d+)/delete/$', 'tribes.views.topic_delete',
name="tribe_topic_delete"),
url(r'^topic/(\d+)/$', 'tribes.views.topic', name="tribe_topic"),
# wiki
- url(r'^(?P<group_slug>\w+)/wiki/', include('wiki.urls'),
+ url(r'^tribe/(?P<group_slug>\w+)/wiki/', include('wiki.urls'),
kwargs=wiki_args),
-)
+)
\ No newline at end of file
Modified: trunk/pinax/settings.py
==============================================================================
--- trunk/pinax/settings.py (original)
+++ trunk/pinax/settings.py Sat Sep 20 22:02:28 2008
@@ -141,6 +141,7 @@
'games',
'locations',
'flag',
+ 'things',
# internal (for now)
'analytics',
Modified: trunk/pinax/templates/tribes/base.html
==============================================================================
--- trunk/pinax/templates/tribes/base.html (original)
+++ trunk/pinax/templates/tribes/base.html Sat Sep 20 22:02:28 2008
@@ -9,6 +9,6 @@
{% if user.is_authenticated %}
<li><a href="{% url your_tribes %} ">{% trans "Your
Tribes" %}</a></li>
{% endif %}
- <li><a href="{% url tribes_list %} ">{% trans "All
Tribes" %}</a></li>
+ <li><a href="{% url tribe_thing_list url_prefix="" %}">{%
trans "All Tribes" %}</a></li>
</ul>
{% endblock %}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pinax-updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---