Re: Templates and Views - what counts as "logic"?

2006-10-30 Thread sorrison
I had this proble too. Heres how i solved it. First i had a model method: def get_wordcount(self): return len(self.content.split()) (content is a TextField) Then in my template i used it like this: {{ object.content|truncatewords:60 }} {% load base_utils %} {%

Re: how to set some global constant in my Django project?

2006-10-30 Thread pength
thanks Terry. I posted 3 days ago, just couldn't see it in the list until now. ;( On Oct 31, 1:29 am, "Terry" <[EMAIL PROTECTED]> wrote: > pength wrote: > > I think it's a common way in C or C++ project to do like this, just > > don't know how to do it in Django. I have tried to put > >

Re: More 0.91 -> 0.95: ProgrammingError models_foo.blah

2006-10-30 Thread ZebZiggle
Sorry, got it. I had to remove the /models directory and rename mydarksecret.py to models.py. I thought I could just change the import, but apparently not. Once I moved the files, it all worked ... like magic ;-) Cheers, Sandy --~--~-~--~~~---~--~~ You received

More 0.91 -> 0.95: ProgrammingError models_foo.blah

2006-10-30 Thread ZebZiggle
Hey all! I've got most of the heavy lifting completed in moving from 0.91 -> 0.95. But now I get the following: ERROR: relation "models_game" does not exist SELECT

Re: X-View headers

2006-10-30 Thread Jeremy Dunck
It has to be a HEAD request. On 10/30/06, Rob Hudson <[EMAIL PROTECTED]> wrote: > > I found the bookmarklets in the admin doc pages and thought this would > be a useful thing for our teams to use. As a quick test I used curl -i > URL to see if the headers are set and they aren't. I told curl

Re: "first_name" -> "First Name"

2006-10-30 Thread Don Arbow
On Oct 29, 2006, at 8:49 PM, Rares Vernica wrote: > > Where is the django function that does the "first_name" -> "First > Name" > transformation? (The function is used by the Admin interface.) It's in the result_headers method in django/contrib/admin/ templatetags/admin_list.py. If you have

X-View headers

2006-10-30 Thread Rob Hudson
I found the bookmarklets in the admin doc pages and thought this would be a useful thing for our teams to use. As a quick test I used curl -i URL to see if the headers are set and they aren't. I told curl to use my current Firefox cookies (-b flag) and they still weren't there. So I set up the

Re: Sharing models between apps

2006-10-30 Thread Vortexmind
Thanks for your responses, I think Guillermo got the point, that's what I was asking! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: DateTime error

2006-10-30 Thread Aidas Bendoraitis
It is possible, that the clock on the server is set differently than the clock on your local machine. Have you checked that? Good luck! Aidas Bendoraitis aka Archatas On 10/26/06, 张沈鹏 <[EMAIL PROTECTED]> wrote: > > I set > > TIME_ZONE = 'CCT' > (in China) > > and > use > uploadBeginFrom =

Re: Generating a choices set from data

2006-10-30 Thread Jorge Gajon
On 10/27/06, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > > On 10/26/06, Ice9 <[EMAIL PROTECTED]> wrote: > > > > Hi, I'm kinda new to django, and I ran into a problem > > I'm making a cutom form, and one of the field I want it to be > > SelectField. the problem is I dont want to hard code the

Re: How does one pass a variable to a Custom Model Manager for use in an inclusion tag?

2006-10-30 Thread RajeshD
Hi Merric, Your working solution (the one without a custom manager) is simpler and straightforward. Just wondering if you see a particular advantage in trying to use a custom manager to accomplish this. -Rajesh --~--~-~--~~~---~--~~ You received this message

Re: AJAX

2006-10-30 Thread James Bennett
On 10/30/06, angel <[EMAIL PROTECTED]> wrote: > I know there are various topics on this subject, but my concrete > question is: How mature is the ajax support in Django at the moment ? > If i download django now , what kind of ajax support can it offer, in > terms of helpers , etc , and how

DateTimeField - Value Error - 'Year is out of Range'

2006-10-30 Thread Merric Mercer
I'm am having a problem with the DateTimeField when I save the data through the related class. Example class Transaction: user = ForeignKey(UserProfile,edit_inline=models.TABULAR,num_extra_on_change=0) DateTimeField(auto_now_add=True, blank=True) When I add data to Transaction, through the

Re: DateTimeField - Value Error - 'Year is out of Range'

2006-10-30 Thread Aidas Bendoraitis
I have recently had the same problem, but I solved it adding null=True to the DateTimeField. Good luck! Aidas Bendoraitis aka Archatas On 10/30/06, Merric Mercer <[EMAIL PROTECTED]> wrote: > > I'm am having a problem with the DateTimeField when I save the data > through the related class. > >

captcha problem

2006-10-30 Thread Grigory Fateyev
Hello! I want to use captcha protection for any app, and I do: ### urls.py (r'^captcha/', include('anastas.apps.captcha.urls')), ### anastas.apps.articles.urls.py (r'^create/$', 'anastas.apps.captcha.views.verify', dict(forward_to='anastas.apps.a rticles.views.create_article')), ###

Re: How does one pass a variable to a Custom Model Manager for use in an inclusion tag?

2006-10-30 Thread MerMer
Or, list here some of the calculations you are trying to work > out so you can get more feedback on this. > I have a table which shows Points owned by particular users. These have an attribute of "type". I need to display back to the user how many of each type of points they own. For instance,

Re: Combining apps?

2006-10-30 Thread ringemup
Oh, cool - thank you for the links, I'll be bookmarking those! --~--~-~--~~~---~--~~ 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

Re: Combining apps?

2006-10-30 Thread ringemup
Custom template tags... I knew I was missing something. Thanks! --~--~-~--~~~---~--~~ 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

Re: Sharing models between apps

2006-10-30 Thread Waylan Limberg
On 10/30/06, Vortexmind <[EMAIL PROTECTED]> wrote: > > Hi > I'm new to django and I've finished the tutorial. I want now to develop > an application of mine, but before starting I have a question. In the > tutorial (the polls app) we define a model (Pool, Choice) inside an app > (polls app). > >

Re: DateTimeField - Value Error - 'Year is out of Range'

2006-10-30 Thread MerMer
Cheers Aidas, that's wokred for me too. MerMer --~--~-~--~~~---~--~~ 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 this

Re: How does one pass a variable to a Custom Model Manager for use in an inclusion tag?

2006-10-30 Thread RajeshD
> 1. I need to enhance the underlying solution. I need to do some more > in depth table wide caculations, working out averages etc, but based on > a user-id. The documentation suggests that the table wide code would > best be placed in a model manager. Here's a thought: class

Job's

2006-10-30 Thread Freddy Zuarich
Greetings, I write to them so that programmers of python with 3 years of experience ask for themselves, in addition working with Django and postgresql… Contracts by development. Send the CV to the direction [EMAIL PROTECTED]Saludos, les escribo por que se solicitan programadores de python con 3

Re: How does one pass a variable to a Custom Model Manager for use in an inclusion tag?

2006-10-30 Thread MerMer
Rajesh, I wanted to see if I could do it for two reasons. 1. I need to enhance the underlying solution. I need to do some more in depth table wide caculations, working out averages etc, but based on a user-id. The documentation suggests that the table wide code would best be placed in a

Re: Just when I think I've got Karma working

2006-10-30 Thread Guillermo Fernandez Castellanos
Hi, Just guessing, but if I understood well the error you get, that's normal. The KarmaScoreManager is not the amount of karma of a coment (or in your case an object). It keeps in the database the karma score that a given user gave to a specific comment (or object). As there is a single score

How does one pass a variable to a Custom Model Manager for use in an inclusion tag?

2006-10-30 Thread Merric Mercer
Is it possible to pass a variable to a Customer Model Manager? I want to pass a variable to the Customer Manager and then use this Manager within an inclusion Tag. Example below. class UserPoint(models.Manager): def get_query_set(self): return

CommaSeparatedIntegerField problem with two digit values

2006-10-30 Thread xgdlm
Hello all, I would like to have a Multiple Select box, render the chosen fields of a CommaSeparatedIntegerField. The CommaSeparatedIntegerField stores the ability of a user to move to a given area : -- Mobility =

Re: Combining apps?

2006-10-30 Thread Guillermo Fernandez Castellanos
You can find the actual code here. For the template tag: http://svn.guindilla.eu:8000/guindilla/trunk/guindilla/polls/templatetags/guindilla_polls.py Fo the html: http://svn.guindilla.eu:8000/www_guindilla_eu/templates/guindilla/polls/open_polls.html And for how to use it:

Just when I think I've got Karma working

2006-10-30 Thread [EMAIL PROTECTED]
With help from Malcolm, Guillermo and others, I thought I had this karma thing working. Apparently I do not. I'm attempting to build my own karma system that will let me allow voting on anything, not just comments. The problem is, any votes after the first don't appear to do anything. The

how to set some global constant in my Django project?

2006-10-30 Thread pength
first, I have searched in this group as "settings". "global constant"...etc, but i don't think I have got what I need. ;( well, I want to define some global constant, like: MAX_UNIT_FOR_ONE_USER = 100 then I want to use this constant in all the applications of my whole project, in my

Combining apps?

2006-10-30 Thread ringemup
Okay, say I've got the Django tutorial poll app, and a blog app I've just whipped up, as separate "apps" in the same Django "site". If I wanted to display a poll / results in the blog sidebar, is there a straightforward way to do that, or would I have to combine the two into a single app?

Re: "first_name" -> "First Name"

2006-10-30 Thread Adrian Holovaty
On 10/29/06, Rares Vernica <[EMAIL PROTECTED]> wrote: > Where is the django function that does the "first_name" -> "First Name" > transformation? (The function is used by the Admin interface.) It's quite simple: name = name.replace('_', ' ') If you want to use initial caps as well, just

Re: AJAX

2006-10-30 Thread [EMAIL PROTECTED]
Personally, I hope that Django keeps the toolkit-independent philosphy. No matter which one was picked I'd probably have some issues with it, and one of the things that drew me to Django in the first place was the ability to do things how I wanted to meet MY needs. That might be toolkit A, it

Re: Problem with order_with_respect_to

2006-10-30 Thread Tim Shaffer
I'm guessing you're using MySQL? I believe order_with_respect_to has been broken for a while now when used with MySQL. I haven't been able to get it working since I can remember. There is a ticket regarding this issue... http://code.djangoproject.com/ticket/1760

Problem with order_with_respect_to

2006-10-30 Thread Daniel Austria
Hi, i have a problem with the order_with_respect_to field in the Meta-Class. Editing the Model in the Admin interface (Saving new levels) i get the exception: You can't specify target table 'heracles_level' for update in FROM clause If i remove the order_with_respect_to field, it works fine.

Re: Combining apps?

2006-10-30 Thread RajeshD
The easiest way, for your example case, would be to make sure that the poll app makes the poll/results available in the form of custom template tags. Then just embed these custom tags in your blog template's sidebar and you are done. --~--~-~--~~~---~--~~ You

Re: admin returning 404 when user is clicked

2006-10-30 Thread Frankie Robertson
On 30/10/06, Bryan Murdock <[EMAIL PROTECTED]> wrote: > > I have a blog application, and when I click on a user in the admin, so > it tries to go to: > > http://myblog.example.com/admin/auth/user/1/ > > I get a 404. I have no idea what's going on. I have another checkout > of this project using

Re: "first_name" -> "First Name"

2006-10-30 Thread Frankie Robertson
On 30/10/06, Rares Vernica <[EMAIL PROTECTED]> wrote: > > Actually I mean this transformation: > "first_name" -> "First name". > I don't know where it is and if it is actually an indivdual function that can be performed on strings (it may be). The admin code is a bit messy anyway. I would

Re: AJAX

2006-10-30 Thread Waylan Limberg
On 10/30/06, angel <[EMAIL PROTECTED]> wrote: > > Hi all, > > I know there are various topics on this subject, but my concrete > question is: How mature is the ajax support in Django at the moment ? > If i download django now , what kind of ajax support can it offer, in > terms of helpers , etc ,

Re: Sharing models between apps

2006-10-30 Thread Guillermo Fernandez Castellanos
Cheers, The nice thing is, you can import your models to any application. For instance, you have app1/gallery with models.py inside that defines Photo and Gallery, and you have app2/photorating with models.py inside. You need for your Rating model in app2 to use the Photo model of app1. No

Sharing models between apps

2006-10-30 Thread Vortexmind
Hi I'm new to django and I've finished the tutorial. I want now to develop an application of mine, but before starting I have a question. In the tutorial (the polls app) we define a model (Pool, Choice) inside an app (polls app). But what I can do if I must share a model between multiple apps?

Re: how to set some global constant in my Django project?

2006-10-30 Thread Terry
pength wrote: > I think it's a common way in C or C++ project to do like this, just > don't know how to do it in Django. I have tried to put > "MAX_UNIT_FOR_ONE_USER = 100" in the settings.py, and used it in > views, but got an error as "global name MAX_UNIT_FOR_ONE_USER not > defined",

Re: "first_name" -> "First Name"

2006-10-30 Thread Aidas Bendoraitis
There is a function get_verbose_name in the file django/db/models/options.py, which does the conversion. If you need just to change the verbose_name, don't forget that there are meta attributes verbose_name and verbose_name_plural for that reason. Good luck! Aidas Bendoraitis [aka Archatas]

Re: How to auto create a from Model just the Admin do?

2006-10-30 Thread Cheng Zhang
On Oct 27, 2006, at 9:57 PM, 张沈鹏 wrote: > as title, > if I has a class like this > > class Media(models.Model): >fileByte = models.IntegerField('文件大小(单位:字节)') >fileName = models.CharField('文件名',maxlength='255') >class Admin: pass zsp007: Because English is the default language of