Re: customised generic view

2006-03-27 Thread yml
Limodou, This is what I did and the result is that it hapens in the: manipulator.save() So I am going to the same thing in this function in order to see which satement is causing trouble. --~--~-~--~~~---~--~~ You received this message because you are subscribe

Re: customised generic view

2006-03-27 Thread yml
Limodou, This is what I did and the result is that it hapens in the: manipulator.save() So I am going to the same thing in this function in order to see which satement is causing trouble. --~--~-~--~~~---~--~~ You received this message because you are subscribe

Re: What is Caching my DB

2006-03-27 Thread Michael Twomey
On 3/28/06, Siah <[EMAIL PROTECTED]> wrote: > > I don't think that's it. My django site is very generic. It has to be > some sort of configuration I am missing. > > Any other ideas? > That sounds like the caching middleware is in effect. The settings relating to this look something like this: M

Re: customised generic view

2006-03-27 Thread limodou
On 3/28/06, yml <[EMAIL PROTECTED]> wrote: > > Hello Limodou, > > ok I read the soucre of the formfield in order to fix the radio_admin > buton I replace the SelectField by a RadioSelectField the form is now > properly displayed with radio button. > > I agree with you that the error message seems

display_inline=True?

2006-03-27 Thread pbx
When viewing one object in the admin (say, a Landlord) I'd like to be able to display a list of related objects (say, Properties). The edit_inline feature is overkill, because the Properties don't need to be edited in place -- and they have too many fields to fit comfortably inline anyway. Basica

Re: customised generic view

2006-03-27 Thread yml
Hello Limodou, ok I read the soucre of the formfield in order to fix the radio_admin buton I replace the SelectField by a RadioSelectField the form is now properly displayed with radio button. I agree with you that the error message seems to direct us to a pb of template but there the line which

Re: ImageField nightmares

2006-03-27 Thread sparkydeville
Hi, and thanks - I switched my "image caption" field to be the "core" field and this was the change that worked. Also, any idea why the ImageField widget doesn't show the image, just the path to the image file, and a link that goes nowhere... --~--~-~--~~~---~--~

Re: Overthinking urls.py?

2006-03-27 Thread Ivan Sagalaev
Adrian Holovaty wrote: >The convention is to put the URL-creation logic in your models, in a >get_absolute_url() method. > Thank you Adrian and others for this info! All this time I was honestly thinking that hard-coded urls in templates are some kind of evil that need to be dealt with in futur

Re: follow relationship

2006-03-27 Thread Ivan Sagalaev
Todd O'Bryan wrote: >The tutorial explains how to get objects based on field values, but I >need to get a subset of the objects in a OneToMany relationship based >on one of their values. Here's an example: > >BRANCH_KINDS = ((0, 'Main'), (1, 'Auxiliary'), (2, 'Dead'),) > >class Trunk(meta.Mod

Re: choices

2006-03-27 Thread Max Battcher
Todd O'Bryan wrote: > I'm an almost complete Python newbie, and I found dictionaries, but > is there an automatic way to deal with lists of pairs that have been > used for choices settings in the admin view, cause they're tuples of > tuples, right? > > I have > > KINDS = ((0, 'foo'), (1, '

Re: Overthinking urls.py?

2006-03-27 Thread Julio Nobrega
I like the URLs at the model. Think in terms of URI (Uniform Resource Identifiers). The .get_absolute_url() tells how the model can be found. It's part of the "rules that give access" to data. On 3/27/06, Glenn Tenney <[EMAIL PROTECTED]> wrote: > Models are, in part, an abstraction of the data.

Re: Source available for django sites?

2006-03-27 Thread Kenneth Gonsalves
On Monday 27 Mar 2006 9:49 pm, shredwheat wrote: > I was reading through the source for djangoproject.com and > learned a lot about how Django really works. Are there any other > sites with the source available? try hugo-'s or iholsman's sites - many of the sites mentioned in the wiki have sourc

Re: Overthinking urls.py?

2006-03-27 Thread Glenn Tenney
On Mon, Mar 27, 2006 at 04:21:09PM -0600, Adrian Holovaty wrote: > The convention is to put the URL-creation logic in your models, in a > get_absolute_url() method. Here's a quick example: > ... > You're right to imply that this goes against the DRY principle, > because you have to define URLs in

Re: Overthinking urls.py?

2006-03-27 Thread limodou
On 3/28/06, Doug Van Horn <[EMAIL PROTECTED]> wrote: > > Disclaimer: I'm new to Python and Django, but I've been coding Java > since '98. > > In thinking about the url definitions in urls.py, it occurs to me that > a major rewrite of the url patterns could prove to be a pain. For > example, I hav

magic removal : problem when subclassing User

2006-03-27 Thread arthur debert
I am subclassing User in magic-removal, and ran into this gotcha. My model: class Account(User): tel = models.CharField(maxlength = 14, blank=True) book = models.ManyToManyField(Book, blank=True) in a view I when I try this: acc = Account.objects.get(username=test_username) prin

follow relationship

2006-03-27 Thread Todd O'Bryan
The tutorial explains how to get objects based on field values, but I need to get a subset of the objects in a OneToMany relationship based on one of their values. Here's an example: BRANCH_KINDS = ((0, 'Main'), (1, 'Auxiliary'), (2, 'Dead'),) class Trunk(meta.Model): name = meta.Cha

Re: customised generic view

2006-03-27 Thread limodou
On 3/28/06, yml <[EMAIL PROTECTED]> wrote: > > Hello, > > As discussed above I spend mos of my evening learning about > manipulator. I was pretty happy since it seems much more difficult than > it is. > This is what I thaught when I did the couple of examples I found on > the web. > > So what I d

choices

2006-03-27 Thread Todd O'Bryan
I'm an almost complete Python newbie, and I found dictionaries, but is there an automatic way to deal with lists of pairs that have been used for choices settings in the admin view, cause they're tuples of tuples, right? I have KINDS = ((0, 'foo'), (1, 'bar')) class Thing(meta.Model):

Re: numeric formatting

2006-03-27 Thread jtm
Quick and nasty: from django.core import template register = template.Library() @register.filter(name='commas') def commas(value): return "".join(commafy(value)) def commafy(s): pieces = s.split(".") l = len(pieces[0]) for i in range(0,l): if (l -

Re: Overthinking urls.py?

2006-03-27 Thread ToddG
Perhaps for a rainy day (very future release): http://routes.groovie.org/ --~--~-~--~~~---~--~~ 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 u

Re: What is Caching my DB

2006-03-27 Thread Siah
I don't think that's it. My django site is very generic. It has to be some sort of configuration I am missing. Any other ideas? Thanks, Sia --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. T

Re: Overthinking urls.py?

2006-03-27 Thread Adrian Holovaty
On 3/27/06, Doug Van Horn <[EMAIL PROTECTED]> wrote: > In thinking about the url definitions in urls.py, it occurs to me that > a major rewrite of the url patterns could prove to be a pain. For > example, I have an app where the urls are deployed under /foo/, and I > have a URL defined as '^bar/\

Re: What is Caching my DB

2006-03-27 Thread Javier Nievas
Read about autocommit. Siah wrote: > I just launched my django site for a client. My problem is something > is caching my db data in a bizzar way. Here are some of the behaviours > > I get: > > - I login, and every other page it makes me login again for a 5 minutes > > or so and then it remem

Re: Overthinking urls.py?

2006-03-27 Thread Eric Walstad
On Monday 27 March 2006 13:23, Doug Van Horn wrote: > When drawing a link to that view in HTML from another app I would > 'hard code' that URL as, say, 'href="/foo/bar/99"'. > > Now say I come along and change my foo application, such that the > URL is newly defined as, '^quux/\d+/bar/$'.  Everywh

Re: customised generic view

2006-03-27 Thread yml
Hello, As discussed above I spend mos of my evening learning about manipulator. I was pretty happy since it seems much more difficult than it is. This is what I thaught when I did the couple of examples I found on the web. So what I did is generate the custom manipulator using the script that I

Re: Overthinking urls.py?

2006-03-27 Thread Max Battcher
> Anyway, am I overthinking this whole thing? Yes. The major pattern in Django is that your model objects should have a: def get_absolute_url(self): return "/bar/%s/" % (self.id) Then when you change the URL scheme you can either update your model objects, or in cases where there are multi

Re: Overthinking urls.py?

2006-03-27 Thread Julio Nobrega
What about mod_rewrite? And urls.py (afaik) can serve two different paths to the same view. On 3/27/06, Doug Van Horn <[EMAIL PROTECTED]> wrote: > > When drawing a link to that view in HTML from another app I would 'hard > code' that URL as, say, 'href="/foo/bar/99"'. -- Julio Nobrega - http:

Overthinking urls.py?

2006-03-27 Thread Doug Van Horn
Disclaimer: I'm new to Python and Django, but I've been coding Java since '98. In thinking about the url definitions in urls.py, it occurs to me that a major rewrite of the url patterns could prove to be a pain. For example, I have an app where the urls are deployed under /foo/, and I have a URL

Re: Recursive(?) ManyToMany model

2006-03-27 Thread Glenn Tenney
On Mon, Mar 27, 2006 at 12:37:54PM -0800, wam wrote: > Well, it was my understanding that since I have the potential of having > many 'inspired by' documents linked to a particular document, and that > any particular document could have inspired many other other documents, > then that means I'm lo

Re: Recursive(?) ManyToMany model

2006-03-27 Thread wam
Malcolm Tredinnick wrote: > Hi William, > I may be missing something, but it sounds like you want a one-to-many > (a.k.a. ForeignKey) relationship here. The 'one' side is the "self" > document in each case with links to 'many' other documents. I don't > believe a ManyToMany relationship is necessa

What is Caching my DB

2006-03-27 Thread Siah
I just launched my django site for a client. My problem is something is caching my db data in a bizzar way. Here are some of the behaviours I get: - I login, and every other page it makes me login again for a 5 minutes or so and then it remembers that I am logged in. - I add a record, it refl

Re: RSS Feeds - what am I doing wrong?

2006-03-27 Thread Adrian Holovaty
On 3/27/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > When's the book due? > How about a chapter "migrating to Django from J2EE -- Becoming more > productive by unlearning" or something along those lines? I'd be happy > to proof-read it. Hehe...Well, I've never used J2EE (or any Java at all,

Re: Source available for django sites?

2006-03-27 Thread Don Arbow
shredwheat wrote: > > I was reading through the source for djangoproject.com and learned a > lot about how Django really works. Are there any other sites with the > source available? > If you go to the code page you'll find some links to other sites which use Django. The biggest one available

Re: Custom annotations on error emails

2006-03-27 Thread Adrian Holovaty
On 3/27/06, Ned Batchelder <[EMAIL PROTECTED]> wrote: > I'd like to add some custom annotations on the traceback emails that get > sent when an exception occurs and DEBUG = False. For example, we are > using our own user representation, and would like to include the user > identity in the traceba

Source available for django sites?

2006-03-27 Thread shredwheat
I was reading through the source for djangoproject.com and learned a lot about how Django really works. Are there any other sites with the source available? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django us

Re: limit_choices_to

2006-03-27 Thread [EMAIL PROTECTED]
tonemcd wrote: > I think that this http://lukeplant.me.uk/blog.php?id=1107301634 might > be helpful. I've just used the first bit of Luke's wheeze- storing the user.id and stuffing it in the model's save method. I had to put 'null-True' in the model to get the user.id bit of this to work. Otherwi

Re: trying to get my first app up.

2006-03-27 Thread sergio_101
yes, i have the correct files in the correct places.. i just can't figure out why it doesn't work.. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-u

Re: limit_choices_to

2006-03-27 Thread tonemcd
Well Luke (the author) might have a better idea than me, but I'll have a go ;) Put it anywhere in your applications folder structure, Luke chose cciw/middleware because his app is called 'cciw' - but it doesn't matter because in his model file, he has the following... .. ... import cciw.middlewa

Re: limit_choices_to

2006-03-27 Thread yml
Hello tonemcd, Thank you for the link it look interesting. However I am not understanding where I should add those lines: # cciw/middleware/threadlocals.py import threading _thread_locals = threading.local() def get_current_user(): try: return _thread_locals.user except Attribut

Re: customised generic view

2006-03-27 Thread limodou
On 3/27/06, yml <[EMAIL PROTECTED]> wrote: > > Hello Limodou, > > Thank you this is what I start to understand. The pb is that so far I > have never try that and it looks pretty difficult. This impression > might be becous I have never done it. > This is time to learn... :-) > So I will try to im

Re: customised generic view

2006-03-27 Thread Michael Radziej
yml schrieb: > This look very interesting so what I will do is to install magic > removal branch this evening and try your recipe. But: be prepared that if you use this on existing code, you might have to change quite a lot. See http://code.djangoproject.com/wiki/RemovingTheMagic --and, it is

Re: numeric formatting

2006-03-27 Thread Nebojša Đorđević
Rock wrote: > Is there a template filter for turning a large integer into a human > readable number? > > 1234567 --> 1,234,567 > 12345 --> 12,345 > > I don't think that python built-in formatting can do this. (Am I > wrong?) > > Assuming there isn't already a simple filter that will do this,

Re: customised generic view

2006-03-27 Thread yml
Hello Limodou, Thank you this is what I start to understand. The pb is that so far I have never try that and it looks pretty difficult. This impression might be becous I have never done it. This is time to learn... :-) So I will try to implement my first manipulator this evening. My objective is

Re: customised generic view

2006-03-27 Thread yml
Hi, I understand your point but for some reason in that case I need a one to many relationship. cu --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-u

Re: customised generic view

2006-03-27 Thread yml
Hello Michael, This look very interesting so what I will do is to install magic removal branch this evening and try your recipe. I have a couple of question before doing that, I want to make sure that I have a good understanding of what I should do. Could you confirm that "Person" in your code

Re: Highlighting Search Results

2006-03-27 Thread Julio Nobrega
I am doing it with template filters. There's a "highlight" function that I use like this: {{ var|highlight:keyword }} Where "keyword" is the search term. The function adds a around the word. On 3/27/06, bradford <[EMAIL PROTECTED]> wrote: > > A question came up in #django and I was wonderi

Custom annotations on error emails

2006-03-27 Thread Ned Batchelder
I'd like to add some custom annotations on the traceback emails that get sent when an exception occurs and DEBUG = False. For example, we are using our own user representation, and would like to include the user identity in the traceback. I can hack into the code that generates these emails,

Re: Get current user ID in _pre_save() function

2006-03-27 Thread bruno desthuilliers
Gacha wrote: > I created a simple model "articles" and I added field: > author= meta.ForeignKey(User,editable=False) > > When I add new artcicle I want to assign to this field the current user > ID, but so far no luck :( > > I tryed: > def _pre_save(self): > from django.models.auth.u

Re: Form field

2006-03-27 Thread Michael Radziej
At least in magic removal, take a look at the "follow" parameter for the automatically generated manipulators and the generic views. See my recent posting about "customised generic views" for details. I think this is what you really want. Michael --~--~-~--~~~---~-

Re: RSS Feeds - what am I doing wrong?

2006-03-27 Thread [EMAIL PROTECTED]
Adrian - thanks a lot! That worked. Forest - meet trees. Trees - meet forest. :-) I *knew* the problem was staring me in the face all along. I was actually making a wrong assumption in what I could do with a ManyToManyField, and so my oh-so-clever query for the newest entries in a given blog was

Re: customised generic view

2006-03-27 Thread Michael Radziej
yml schrieb: > Hello, > > what I am trying to do since this morning is to allow my logged in user > to create Members. As you will see below Member is related to the User > class by a foreignkey. > so far I create User, Member using generic view. What I would like to > do is to remove the user fi