Template - different layout for odd/even items

2008-05-07 Thread DuncanM
I have a template as such: --- | TITLE| |--| || | || | Item 1

Django equivilent of PHP date in templates.

2008-05-07 Thread DuncanM
Hi there, I'm wanting to display the durrent day, month and year on my site and wanted to know the easiest way to do it. Would I have to create a template tag, or is there anyway of just sticking it straight into the template? Something similar to what the following php returns: date("F j,

Re: Paginator Help

2008-04-22 Thread DuncanM
Thanks for the advice Peter. I did what you said, and nothing showed (meaning the {% if is_paginated %} was false). How would I make it so is_paginated=True? I don't see how this is set anywhere. When i removed the IF statement so I could just see if the {% load paginator %} code worked I get

Loop Counter

2008-03-26 Thread DuncanM
I have a template that looks like such: {% if object_list %} {% for menu in object_list %} {{ menu.name }} Description: {{ menu.description }} {% endfor %} {% else %} No menus have been created yet, please check

Re: Db not being populated for foreignkey

2008-03-09 Thread DuncanM
Just to clear up if its not obvious already. In the admin section when I add a new Menu, I get the MenuItems shown below to add, just when I click the save button it does not save them to the DB, but it does save the menu created. --~--~-~--~~~---~--~~ You

Re: Db not being populated for foreignkey

2008-03-09 Thread DuncanM
Yeah, I've done that, I actually created the models at the same time so they were all created at once. On Mar 9, 1:35 pm, Nick Fishman <[EMAIL PROTECTED]> wrote: > DuncanM wrote: > > I checked my DB and for somereason the MenuItem's are not being saved > > when I save a

Db not being populated for foreignkey

2008-03-09 Thread DuncanM
I was trying to create some models similar to that of the basic example "Polls" application. Except instead of Polls and Choice, it would be Menu and MenuItem. I have the following in my models: from django.db import models # -- # Menu Class # -- class Menu(models.Model):

Re: Multiple apps on one template

2008-03-08 Thread DuncanM
d the view in the Events application. How would I create a view external to all apps that I can add all the necessary code in to make my home template? Regards, Duncan On Mar 8, 8:11 pm, Nick Fishman <[EMAIL PROTECTED]> wrote: > DuncanM wrote: > > My events.views: > > [code] > &

datetime.date.today()

2008-03-06 Thread DuncanM
I want to create a model that doesn't ask for the users input on the date, it takes the days date automatically, I thought it would be as simple as doing: class News(models.Model): newsTitle = models.CharField("News Title", maxlength=200, core=True, help_text="Title of the news item e.g.

Re: Django Urls object_id/xxxxxx/object_id

2007-04-20 Thread DuncanM
Hi Karen, (r'^team/(?P[0-9]+)/results/(?P[0-9]+)/$', 'django.views.generic.list_detail.object_detail', dict(results_dict, template_name='teams/team_results_reports.html') doesn't work for me, but I've been thinking about your post, and you were right about me wanting to leave breadcrumbs (why

Re: Django Urls object_id/xxxxxx/object_id

2007-04-20 Thread DuncanM
Thanks for the help Tim, however I've tried that and it doesn't work : ( Is there any other way you could think of achieving it, even if it doesn't use generic views and urls? Thanks, Duncan --~--~-~--~~~---~--~~ You received this message because you are

Re: Django Urls object_id/xxxxxx/object_id

2007-04-20 Thread DuncanM
Firstly: there are many teams, each team can have many results. so obviously you'd need an id for the result id as well not just team/ 1/results/detail. Sorry it was a bad example in the previous post, it could be team/3/ results/5/ or team/10/results/522 (i.e. the team and results numbers

Django Urls object_id/xxxxxx/object_id

2007-04-20 Thread DuncanM
Hi, I have looked at the django docs and couldn't find anything exactly related to what I want to do. I have my urls set up currently so: team/ returns a page for that team team//results returns a results page for that team I'm stuck when trying to do: team//results/ which I'd like to return

Re: Restricting Access in the Django Admin to a instance of an object.

2007-04-16 Thread DuncanM
Thanks for the quick and detailed reply Russ, I'll have a look at the wiki now. Regards, Duncan On Apr 17, 12:33 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 4/17/07, DuncanM <[EMAIL PROTECTED]> wrote: > > > > > Briefly, I have

Restricting Access in the Django Admin to a instance of an object.

2007-04-16 Thread DuncanM
Briefly, I have a system set up to manage football teams, with fixtures, results, players etc. How would I go about editing the admin permissions so that User X could only edit the fixtures and results for Team X, and User Y could only edit the fixtures for Team Y? I've looked at the admin

Method problem with .save()

2007-03-14 Thread DuncanM
_field(fieldname).column cursor = connection.cursor() cursor.execute("SELECT COUNT(*)" + sql, params) cursor.execute("SELECT COUNT(%s)" % (column) + sql, params) return cursor.fetchone()[0] When I add a "squad selector" I get the follo

Re: referncing a model within a model

2007-03-14 Thread DuncanM
tscore }} {{ fixture.opponent }} {% endfor %} {% endfor %} However neither attempt at showing a result work, any help is much appreciated. Duncan On Mar 14, 11:27 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Wed, 2007-03-14 at 04:20 -0700, DuncanM wrote: > > Thank you f

Re: referncing a model within a model

2007-03-14 Thread DuncanM
Tredinnick <[EMAIL PROTECTED]> wrote: > On Wed, 2007-03-14 at 00:13 +, DuncanM wrote: > > I have a schema as follows: > [...] > > How would I get it so I had a template that showed: > > Result > > Team A 0 - 3 Team B 22/03/07 > > > e.g. the homeTeam and

Re: referncing a model within a model

2007-03-14 Thread DuncanM
Thats the problem, I have no idea where to start with it, so do not have any current code for it, or any errors. Duncan On Mar 14, 3:42 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Can you post your current code...and the error you are receiving? > > On

referncing a model within a model

2007-03-13 Thread DuncanM
I have a schema as follows: Team Fixture Result = ==== id id id name homeTeam fixture_id . awayTeam homeScore date awayScore

Re: Model question

2007-03-13 Thread DuncanM
I'm not sure exactly how you could do this, but for an employee to change department, you will edit it. This edit is saved in django's admin log (or whatever its called) so maybe you look at something similar to that where it only saves the changes for an employee where the department id has

Model help

2007-03-05 Thread DuncanM
I have some classes related to football (soccer), I have Player, Team, Fixture, Result, Squad, Squad Selector, Appearance and Scorer classes. They way I have modelled it is that A player belongs to a squad, and each team is picked from a squad (e.g. a squad may consist of 30 players but a team

Re: Newbie: Admin / Model help

2007-03-05 Thread DuncanM
Ooops I realise you can use a verbose name on a foreign key field you must just use verbose_name="xxx" e.g. Poll = models.ForeignKey(Poll, verbose_name="the related poll") On Mar 5, 9:16 am, "DuncanM" <[EMAIL PROTECTED]> wrote: > Thank you Kai, > I rea

Re: Newbie: Admin / Model help

2007-03-05 Thread DuncanM
ignKey(Fixture, "Fixture", core=True, help_text="Fixture to select squad for.") the bit "Fixture" which I have on all my fields because I thought it is a verbose name, which you cannot apparantly specify for a foreign key (I assume it gets it from the other table?) So it w

Re: Newbie: Admin / Model help

2007-03-04 Thread DuncanM
Any help please im desperatly stuck. TIA duncan On Mar 2, 5:13 pm, "DuncanM" <[EMAIL PROTECTED]> wrote: > On top of the above post, I've come accross an error when trying to > sync my db (with having simplified list_displays not those from > above). When ever I orde

Re: Newbie: Admin / Model help

2007-03-02 Thread DuncanM
call last): File "manage.py", line 11, in ? execute_manager(settings) File "/home2/duncanm/lib/python2.4/django/core/management.py", line 1319, in execute_manager execute_from_command_line(action_mapping, argv) File "/home2/duncanm/lib/python2.4/django/core/

Newbie: Admin / Model help

2007-03-02 Thread DuncanM
result'] I was wondering in the admin panel for the result, I have list_display = ('result', 'howdenscore', 'opponentscore') Is there anyway I can get that admin page to show some of the details from the fixture class? e.g. list_display = ('fixture.date', 'fixture.team', 'fixture.venue', 'fixture.opponen

Re: DateField

2007-03-02 Thread DuncanM
date in the dd/mm/yy format. And again only displays that date format to the user. DuncanM On Mar 2, 2:18 pm, Tim Chase <[EMAIL PROTECTED]> wrote: > > In my models I use DateField quite a few times, is there any > > way I can adjust it so it stores information in the databa

DateField

2007-03-02 Thread DuncanM
In my models I use DateField quite a few times, is there any way I can adjust it so it stores information in the database as dd/mm/yy and retrieves/handles it in this way too rather then its current -mm- dd format? Thanks --~--~-~--~~~---~--~~ You received

models.TimeField()

2007-02-27 Thread DuncanM
When you use this field type, django automatically places a clock next to the field which is very handy with quick links: 6am, noon, midnight, now() or something similar. Is there any way I can get the list that is displayed then to be set values? such as 10am, noon and 2pm? or will I have to

Re: Models Causing Admin to Crash

2007-02-27 Thread DuncanM
Any idea where outside it could be? I am using mod_python with apache. Thanks for all your help Duncan On Feb 26, 7:34 pm, "Honza Král" <[EMAIL PROTECTED]> wrote: > On 2/26/07, DuncanM <[EMAIL PROTECTED]> wrote: > > > > > > > Hi, > > I have so

Re: Models Causing Admin to Crash

2007-02-26 Thread DuncanM
On Feb 26, 5:45 pm, "oggie rob" <[EMAIL PROTECTED]> wrote: > I can't tell if this is the cause, but you should remove the "pass" > right under "class Admin": > > -rob Nope I have that on my other classes as well and I don't have any problems with them, I did try removing it just in case but

Models Causing Admin to Crash

2007-02-26 Thread DuncanM
Hi, I have some models related to a football (soccer) team, I had models for everything working fine except my Results model. I tried adding it yesterday and encountered a few problems with it, which was solved due to the help from these groups (thanks). However now when I run syncdb I don't

Re: Newbie: Accessor and Definition help

2007-02-25 Thread DuncanM
Indeed, I am such an idiot at times. Once again your help is very much appreciated. Many thanks Duncan On Feb 26, 1:06 am, "Chase" <[EMAIL PROTECTED]> wrote: > I don't know exactly what it's referring to, but check to make sure > that any True's in your model (I don't see any in the one you

Re: Newbie: Accessor and Definition help

2007-02-25 Thread DuncanM
Thank you Honza and Chase, you have both been extremely helpful. Many thanks, Duncan On Feb 26, 12:09 am, "Chase" <[EMAIL PROTECTED]> wrote: > More like:> goalkeeper = models.ForeignKey(Player, > related_name="goalkeeper_for") > > leftback = models.ForeignKey(Player,

Re: Newbie: Accessor and Definition help

2007-02-25 Thread DuncanM
) etc?? On Feb 25, 10:29 pm, "Honza Král" <[EMAIL PROTECTED]> wrote: > On 2/25/07, DuncanM <[EMAIL PROTECTED]> wrote: > > > > > I have 2 classes: > > > class Player(models.Model): > > team = models.ForeignKey(Team) > > forename = mo

Newbie: Accessor and Definition help

2007-02-25 Thread DuncanM
I have 2 classes: class Player(models.Model): team = models.ForeignKey(Team) forename = models.CharField(maxlength=50) surname = models.CharField(maxlength=50) age = models.PositiveIntegerField() sex = models.CharField(maxlength=1, choices=Gender_Choices) class Admin: pass

Newbie Question: If statement in templates help

2007-02-25 Thread DuncanM
L:http://duncanm.webfactional.com/teams/1/ Exception Type: TemplateSyntaxError Exception Value:'if' statement improperly formatted Exception Location: /home2/duncanm/lib/python2.4/django/template/ defaulttags.py in do_if, line 608 I know this is a very stupid question but from my code a

Trouble with models

2007-02-09 Thread DuncanM
Hi, I know this isn't necessarily a Django specific problem but I am using django to develop my system so here goes. Basically I am making a system for a football team (soccer for you americans) and can't seem to get my head around a way of possibly doing it. I've left out some of the other

Re: Django Hosting

2006-10-23 Thread DuncanM
Just a quick update, I intend to go with webfaction hosting so if there is anyone out there willing to help me every now and then and wants the 10% affilliation then either reply here or email me directly. Many thanks to all the suggestions. DuncanM On Oct 23, 2:48 pm, "Hollywood Cole&quo

Django Hosting

2006-10-19 Thread DuncanM
I've looked through the hosting recommendations on the django site and can't find any uk based django providers, could anyone suggest any? I'm also looking for reliable cheap django hosting (based anywhere) if anyone has some suggestions. Thanks, DuncanM

Populating Menu from db

2006-10-19 Thread DuncanM
tabase also reflect in the menu. Thanks, DuncanM --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from th