Commits

David Krauth committed 544053e

Incremental update

Comments (0)

Files changed (7)

             else:
                 raise PgnParseError('Invalid token "%s"' % ch, stream)
 
-        if pgn:
-            yield pgn
+        yield pgn or Pgn()
             
     return parse()
         
             models.Q(white__user=user) | models.Q(black__user=user),
             **kws
         )
+        
+    #---------------------------------------------------------------------------
+    def complete(self):
+        return self.exclude(result=Game.Result.UNDECIDED)
+
+    #---------------------------------------------------------------------------
+    def incomplete(self):
+        return self.filter(result=Game.Result.UNDECIDED)
 
         
 

templates/echess/base.html

-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
-    <link href="/media/chess/img/favicon.ico" rel="shortcut icon">
-    <title>{% block title %}The Check Is In the Mail{% endblock title %}</title>
- 
-    <!-- Framework CSS -->
-    <link rel="stylesheet" href="/media/css/blueprint/screen.css" type="text/css" media="screen, projection" />
-    <link rel="stylesheet" href="/media/css/blueprint/print.css" type="text/css" media="print" />
-    <!--[if IE]><link rel="stylesheet" href="/media/css/blueprint/ie.css" type="text/css" media="screen, projection" /><![endif]-->
-
-    <!-- Import fancy-type plugin. -->
-    <link rel="stylesheet" href="/media/css/blueprint/plugins/fancy-type/screen.css" type="text/css" media="screen, projection" />
-    <style type="text/css">
-        @import url("/media/chess/css/chess2.css");
-        h1 { margin-top: 1em; font-size: 2em; }
-        h1 a img { vertical-align: middle; }
-        table { border-collapse: collapse; border: 1px solid #c3d9ff; }
-        a { text-decoration: none; }
-    </style> 
-    <script src="/media/js/jquery/jquery.min.js" type="text/javascript" language="javascript"></script>
-    <script src="/media/chess/js/chess.js" type="text/javascript" language="javascript"></script>
-    <script type="text/javascript" charset="utf-8">
-        $(document).ready(function() { 
-            $("a[href='/chess/todo/']").addClass("todo");
-        });
-        
-    </script>
-    {% block extra_head %}{% endblock extra_head %}
-    
-</head>
-
-<body>
-    {% url chess-todo as todo_url %}
-    <div class="container">
-        <div id="header" class="span-24 last">
-            <h1>
-                <a href="/chess/">
-                    <img src="/media/chess/img/logoSmall.gif" alt="logo" />
-                    The Check Is In the Mail
-                </a>
-            </h1>
-        </div>
-    
-        <hr />
-        <div id="subheader" class="span-24 last">
-            <h2 class="alt">Play postal chess on-line.</h2>
-        </div>
-          
-        <hr />
-        <div class="span-17 colborder" id="content">
-            {% block chess_content %}{% endblock chess_content %}
-        </div>
-    
-        <div class="span-6 last" id="chess_sidebar">
-            {% block chess_sidebar %}
-            <div>
-                <h3 class="caps">Navigation</h3>
-                <div class="box quiet">
-                    <ul>
-                        {% if not user.is_authenticated %}
-                        <li>
-                            <strong><a href="{% url acct-login %}">Login</a></strong> &mdash; or 
-                            <strong><a href="{% url registration-register %}">Sign up!</a></strong>
-                        </li>
-                        {% else %}
-                        <li>
-                            <strong>Hello, {{ user }}</strong> &mdash; 
-                            <a href="{% url acct-logout %}">Logout</a>
-                            <ul style="margin-bottom: 1em">
-                                <li><a href="{% url chess-profile-games %}">My Game Log</a></li>
-                                <li><a href="{{ todo_url }}">My Profile</a></li>
-                            </ul>
-                        </li>
-                        <li><a href="{% url chess-game-new %}">New Game</a></li>
-                        {% endif %}
-                        <li><a href="{{ todo_url }}">Practice Game</a></li>
-                        <li><a href="{% url chess-openings %}">Opening Library</a></li>
-                        <li><a href="{% url chess-about %}">About</a></li>
-                        
-                    </ul>
-                </div>
-            </div>
-            {% endblock chess_sidebar %}
-        </div>
-    
-        <hr />
-        <div id="footer">
-            <div class="span-5 colborder">
-                <ul>
-                  <li><a class="quiet" href="{{ todo_url }}">Privacy Policy</a></li>
-                  <li><a class="quiet" href="{{ todo_url }}">Security Policy</a></li>
-                  <li><a class="quiet" href="{{ todo_url }}">Submit a Bug</a></li>
-                </ul>
-            </div>
-
-             <div class="prepend-top push-3 span-8 last">
-                <span class="quiet">Copyright &copy; 2010 David Krauth v3</span>
-            </div>
-        </div>
-    </div>
-</body>
-</html>

templates/echess/game_listing_inc.html

-        <table border="1">
+        <table>
             <thead>
                 <tr>
                     <th></th>

templates/echess/index.html

     <h3>Welcome</h3>
     <fieldset>
         <legend>Games in Progress</legend>
-        <ul class="chessbullet">
-            <li>
-                <a href="chess.cgi?id=2&amp;Action=MatchView">Test Game (9/15/2004)</a> 
-                [<a href="chess.cgi?id=2&amp;Action=MatchPlay">Play</a>] 
-            </li>
-        </ul>
+        {% ongoing_games %}
     </fieldset>
 
     <fieldset>
         <legend>Recently Completed Games</legend>
-        {% include "echess/game_listing_inc.html" %}
+        {% recent_games %}
     </fieldset>
     
     <fieldset>
+from django import template
 from django.conf.urls.defaults import *
 from jargon.shortcuts import to_template
 from echess import views
 
+
+template.add_to_builtins('echess.templatetags.echess_tags')
+
 urlpatterns = patterns('',
     url(r'^$', views.index, name='chess-index'),
     url(r'^games/$', views.games, name='chess-games'),
 
 #-------------------------------------------------------------------------------
 def index(request):
-    games = Game.objects.all()
-    return request_to_response(request, 'echess/index.html', dict(games=games))
+    return request_to_response(request, 'echess/index.html')
 
 
 #-------------------------------------------------------------------------------