Commits

Kevin Veroneau committed 00cb7a5 Draft

Added cross-reference links for credits.

  • Participants
  • Parent commits 7c21c72

Comments (0)

Files changed (7)

File gamedb/models.py

         if self.known_as == '':
             self.known_as = self.owner.username
         return super(Writer, self).save(**kwargs)
+    @models.permalink
+    def get_absolute_url(self):
+        return ('writer_detail', [self.pk])
 
 class Artist(models.Model):
     owner = models.ForeignKey(User, blank=True, null=True, help_text='Is this artist part of this community?')
         if self.known_as == '':
             self.known_as = self.owner.username
         return super(Artist, self).save(**kwargs)
+    @models.permalink
+    def get_absolute_url(self):
+        return ('artist_detail', [self.pk])
 
 class Composer(models.Model):
     owner = models.ForeignKey(User, blank=True, null=True, help_text='Is this composer part of this community?')
         if self.known_as == '':
             self.known_as = self.owner.username
         return super(Composer, self).save(**kwargs)
+    @models.permalink
+    def get_absolute_url(self):
+        return ('composer_detail', [self.pk])
 
 class GameDownload(models.Model):
     GAME_WORKFLOW = (

File gamedb/templates/gamedb/artist_detail.html

+{% extends "base.html" %}
+{% load ohrrpgce %}
+
+{% block content %}
+<h2>{{artist}}</h2>
+<p>{{artist.bio}}</p>
+<b>Website/Portfolio:</b> {{artist.website|urlize}}
+<h3>Games with art by {{artist}}:</h3>
+<ul>
+  {% for game in artist.game_set.all %}
+  <li>{{game|link}}</li>
+  {% endfor %}
+</ul>
+{% endblock %}

File gamedb/templates/gamedb/composer_detail.html

+{% extends "base.html" %}
+{% load ohrrpgce %}
+
+{% block content %}
+<h2>{{composer}}</h2>
+<p>{{composer.bio}}</p>
+<b>Website/Portfolio:</b> {{composer.website|urlize}}
+<h3>Games with music composed by {{composer}}:</h3>
+<ul>
+  {% for game in composer.game_music_list.all %}
+  <li>{{game|link}}</li>
+  {% endfor %}
+</ul>
+<h3>Games with Sound FX composed by {{composer}}:</h3>
+<ul>
+  {% for game in composer.game_sfx_list.all %}
+  <li>{{game|link}}</li>
+  {% endfor %}
+</ul>
+{% endblock %}

File gamedb/templates/gamedb/game_detail.html

 {% extends "base.html" %}
+{% load ohrrpgce %}
 
 {% block content %}
 <div class="row-fluid">
     <div class="alert alert-info">Credits</div>
     <table class="table">
       <tbody>
-        <tr><th>Scenario:</th><td>{% for author in game.scenario.all %}<a href="#">{{author}}</a>{% endfor %}</td></tr>
-        <tr><th>Graphics:</th><td>{% for author in game.graphics.all %}<a href="#">{{author}}</a>{% endfor %}</td></tr>
-        <tr><th>Music:</th><td>{% for author in game.music.all %}<a href="#">{{author}}</a>{% endfor %}</td></tr>
-        <tr><th>Sound FX:</th><td>{% for author in game.sfx.all %}<a href="#">{{author}}</a>{% endfor %}</td></tr>
+        <tr><th>Scenario:</th><td>{% for author in game.scenario.all %}{{author|link}}{% endfor %}</td></tr>
+        <tr><th>Graphics:</th><td>{% for author in game.graphics.all %}{{author|link}}{% endfor %}</td></tr>
+        <tr><th>Music:</th><td>{% for author in game.music.all %}{{author|link}}{% endfor %}</td></tr>
+        <tr><th>Sound FX:</th><td>{% for author in game.sfx.all %}{{author|link}}{% endfor %}</td></tr>
       </tbody>
     </table>
     <div class="alert alert-info">More Screenshots</div>

File gamedb/templates/gamedb/writer_detail.html

+{% extends "base.html" %}
+{% load ohrrpgce %}
+
+{% block content %}
+<h2>{{writer}}</h2>
+<p>{{writer.bio}}</p>
+<h3>Games written by {{writer}}:</h3>
+<ul>
+  {% for game in writer.game_set.all %}
+  <li>{{game|link}}</li>
+  {% endfor %}
+</ul>
+{% endblock %}

File gamedb/urls.py

 from django.conf.urls import patterns, url
 from django.views.generic.base import TemplateView
-from gamedb.views import ViewGame, GameList
+from gamedb.views import ViewGame, GameList, ViewWriter, ViewArtist,\
+    ViewComposer
 
 urlpatterns = patterns('',
     url(r'^Games/$', GameList.as_view(), name='game_list'),
     url(r'^Games/(?P<slug>[\w-]+).html$', ViewGame.as_view(), name='game_detail'),
+    url(r'^Writer/(?P<pk>\d+)$', ViewWriter.as_view(), name='writer_detail'),
+    url(r'^Artist/(?P<pk>\d+)$', ViewArtist.as_view(), name='artist_detail'),
+    url(r'^Composer/(?P<pk>\d+)$', ViewComposer.as_view(), name='composer_detail'),
 )

File gamedb/views.py

 from django.views.generic.detail import DetailView
-from gamedb.models import Game
+from gamedb.models import Game, Writer, Artist, Composer
 from django.views.generic.list import ListView
 from gamedb.forms import FilterForm
 
             if 'style' in self.request.GET:
                 qs=qs.filter(style=self.filter_form.cleaned_data['style'])
         return qs
+
+class ViewWriter(DetailView):
+    model = Writer
+
+class ViewArtist(DetailView):
+    model = Artist
+
+class ViewComposer(DetailView):
+    model = Composer