Re: login_required for imported apps

2008-10-21 Thread bruno desthuilliers
On 20 oct, 01:33, "James Bennett" <[EMAIL PROTECTED]> wrote: > On Sun, Oct 19, 2008 at 2:10 PM, bruno desthuilliers > > <[EMAIL PROTECTED]> wrote: > > Indeed. But , OTHO, having to copy/paste a whole urls.py just to a add > > a simple decora

Re: login_required for imported apps

2008-10-21 Thread bruno desthuilliers
On 21 oct, 16:40, Heather <[EMAIL PROTECTED]> wrote: > I completely agree. Even the middleware solution doesn't seem quite > right as it will check each page/request. Well, that's the whole concept of middlewares, isn't it ?-) > I've been thinking about > this a lot and I wonder if maybe the on

Re: template tags with variables as arguments

2008-10-22 Thread bruno desthuilliers
n 22 oct, 12:14, ramya <[EMAIL PROTECTED]> wrote: > I am probably turning blind.. but I am still not able to figure out > why string "value" is being passed instead of value "value" http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#passing-template-variables-to-the-tag class Forma

Re: Query

2008-10-22 Thread bruno desthuilliers
On 22 oct, 14:11, Anurag <[EMAIL PROTECTED]> wrote: > Hello Gerard, > > Thank you so much for your suggestion. I have tried working in the > direction suggested by you. > The next step of difficulty that I find is that there are lot of > materials available on the internet in this regard but I cou

Re: login_required for imported apps

2008-10-23 Thread bruno desthuilliers
On 22 oct, 23:46, Heather <[EMAIL PROTECTED]> wrote: > That was a really good post - thanks :) I know you don't *have* to > use anything from the app you include or even *have* to include > everything in an app you write. But I think that I just have this > idea in my head that I can't let go of

Re: Foreign Key Problem

2008-10-23 Thread bruno desthuilliers
On 23 oct, 19:53, cwurld <[EMAIL PROTECTED]> wrote: > Hi, (snip) > > When I run syncdb, the table is created (I can see it with MySQL > Admin), but I get the following error: > > > C:\Documents and

Re: Python Script bugs.

2008-10-23 Thread bruno desthuilliers
On 23 oct, 19:48, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hello everyone, > I would like to know what isn't good in my script. A couple things here and there. But there's also something wrong with your whole post: there's nothing Django-related in it. Python-related questions belongs to

Re: from mysite.polls.models import Poll, Choice

2008-10-23 Thread bruno desthuilliers
On 23 oct, 11:14, tak <[EMAIL PROTECTED]> wrote: > Hi, > > I am following the tutorial. One part I get confusion is the import > statement including the project name. I am referring the last example > of 1st tutorial. It's indeed a pretty bad idea to refer to the project name in import statements

Re: from mysite.polls.models import Poll, Choice

2008-10-23 Thread bruno desthuilliers
On 23 oct, 21:30, "James Bennett" <[EMAIL PROTECTED]> wrote: > On Thu, Oct 23, 2008 at 1:47 PM, bruno desthuilliers > > <[EMAIL PROTECTED]> wrote: > > It's indeed a pretty bad idea to refer to the project name in import > > statements (as w

Re: Getting a NameError: global name 'Lesson' is not defined

2008-10-28 Thread bruno desthuilliers
On 28 oct, 08:54, Daniel Strasser <[EMAIL PROTECTED]> wrote: > Hi Daniel > > > This is why it's a bad idea to do from x import *. You should always > > import the things you need explicitly, then you can tell what's going > > wrong. Try doing > > from schoolutil.lesson.models import Lesson > > and

Re: Getting a NameError: global name 'Lesson' is not defined

2008-10-28 Thread bruno desthuilliers
On 28 oct, 14:05, Daniel Strasser <[EMAIL PROTECTED]> wrote: > > You have a circular reference between students.models and > > lessons.models. The first want to import the second, which want to > > import the first, etc... This just can't work. > > Thank you very much. I played around but I don't

Re: How to get value of query string in template

2008-10-28 Thread bruno desthuilliers
On 28 oct, 17:47, "yuanyun.ken" <[EMAIL PROTECTED]> wrote: > Hi,I am a newbie to Django, and will use it in my latest project right > away. > now I encounter a little problem. > > How can I get value of query string in > template?http://localhost/mysite/login/?next=/mysite/product/ > My aim is t

Re: mod_python calls an older script?

2008-10-30 Thread bruno desthuilliers
On 30 oct, 13:14, Alessandro <[EMAIL PROTECTED]> wrote: > I'm getting weird errors about a script that I've changed recently (a > template_tag). > It's strange because it refers to a line that I've deleted, so I think > it comes from some cache, but I cannot find nothing. Did you restart Apache ?

Re: inspect a model's field's option's values

2008-10-30 Thread bruno desthuilliers
On 30 oct, 14:26, Mark Wolgemuth <[EMAIL PROTECTED]> wrote: > It seems like I'm missing something, but here's what I'm trying to do: > > In creating a Form object, I'm setting size limit validation > (max_length). I'd like to recover the value for that from the > corresponding Model's Field's ma

Re: How to get site's root path in Django

2008-10-30 Thread bruno desthuilliers
On 28 oct, 07:38, "yuanyun.ken" <[EMAIL PROTECTED]> wrote: > Steve, Thanks for your expeditious reply. > because our apache server includes other apps, I can not deploy my app > to the root of the server. This won't fix http://code.djangoproject.com/ticket/8906, but there's at least one possibl

Re: Multiple types of output (HTML, JS), same view.

2008-10-30 Thread bruno desthuilliers
On 30 oct, 20:22, Joe Murphy <[EMAIL PROTECTED]> wrote: > Hi, > > So I've got a bunch of views that I need to output in three forms: > HTML with the site wrapper (header, footer etc.), HTML without the > site wrapper, and JS. The templates are really, really similar. > > I'm thinking of using a

Re: Django's decoupling apps but template should couple them together, right?

2008-11-03 Thread bruno desthuilliers
On 3 nov, 03:56, Steve Holden <[EMAIL PROTECTED]> wrote: (snip) > You might also want to look into ContextManager objects, which are a way > of providing information to all pages. I assume you meant 'Context processors' ?-) --~--~-~--~~~---~--~~ You received th

Re: Beginner on Django and web developing

2008-11-03 Thread bruno desthuilliers
On 3 nov, 17:38, "Airton Arantes" <[EMAIL PROTECTED]> wrote: > Hello folks, I have aready used python only in desktop. About 1 a week > ago I installed the Django 1.0 on Fedora 9. I wonder about the > djangobook, its version is 0.96 or 1.0? > > I don't know nothing about web programming but I'm st

Re: access request.user in class Meta

2008-11-03 Thread bruno desthuilliers
On 1 nov, 23:57, Merrick <[EMAIL PROTECTED]> wrote: > I am trying to dynamically generate a form, the fields will vary if > the user is logged in. Here is where I am so far > > forms.py > == > class LinkForm(ModelForm): > > def __init__(self, *args, **kw): > self.request = kw.pop('

Re: Beginner on Django and web developing

2008-11-04 Thread bruno desthuilliers
On 4 nov, 03:02, "DULMANDAKH Sukhbaatar" <[EMAIL PROTECTED]> wrote: > > Hello folks, I have aready used python only in desktop. About 1 a week > > ago I installed the Django 1.0 on Fedora 9. I wonder about the > > djangobook, its version is 0.96 or 1.0? > > book's version is 1.0, but written for

Re: Design question : best way to show 1 .. N different categoried items

2008-11-05 Thread bruno desthuilliers
On 4 nov, 23:54, John M <[EMAIL PROTECTED]> wrote: > i have a model for status reports:http://dpaste.com/88760/ > > The report has 1-N bullet Points, each bullet Point has a category. > > What I want to figure out, whats my best way to display this in a > template, given that the category list is

Re: setting value of a ModelForm field through Javascript

2008-11-06 Thread bruno desthuilliers
On 6 nov, 13:38, limas <[EMAIL PROTECTED]> wrote: > hello > > please help me... > can i set the value of a ModelForm field ,ie a text box, using > javascript. This is totally unrelated to Django and ModelForms. javascript runs on the browser, *after* the whole page containing the form has be

Re: setting value of a ModelForm field through Javascript

2008-11-08 Thread Bruno Desthuilliers
limas a écrit : Limas, please answer on the group, not privately >> This is totally unrelated to Django and ModelForms. javascript runs on >> the browser, *after* the whole page containing the form has been sent >> by the server. IOW, at this stage, all you have is a plain old HTML >> form. >

Re: Recursive function

2008-11-12 Thread bruno desthuilliers
On 12 nov, 14:25, gontran <[EMAIL PROTECTED]> wrote: > On 12 nov, 13:22, Steve Holden <[EMAIL PROTECTED]> wrote: > > > gontran wrote: (snip - about using templates instead of building html in python code) > > > -> I'm using this function in a custom tag to build a menu > > > And is there a rule t

Re: Recursive function

2008-11-12 Thread bruno desthuilliers
On 12 nov, 14:56, gontran <[EMAIL PROTECTED]> wrote: > Could you be more explicite because I don't understand everything and I thought it was explicit enough. A custom tag is usually made of a parser function and a rendering node (cf relevant part of django's documentation), so I gave you a snipp

Re: Recursive function

2008-11-12 Thread bruno desthuilliers
On 12 nov, 09:22, gontran <[EMAIL PROTECTED]> wrote: > Hello, > > I've got a problem with a recursive function: > in my model, I have a class named myClass: each object in my class has > an id, a parentId, and a name. > I want to make a list of all my objects that looks like this: > > object1

Re: Categorisation

2008-11-12 Thread bruno desthuilliers
On 11 nov, 21:41, coderb <[EMAIL PROTECTED]> wrote: > Hi All, > > I'm having trouble getting my head around how to set up my data entry > and queries, so that a listing/detail entry is categorised properly. > > firstly, my models look like this: > > class Category(models.Model): > name

Re: Turning key=value1&key=value2&key=value3 into a list

2008-11-12 Thread bruno desthuilliers
On 12 nov, 21:44, Peter Bengtsson <[EMAIL PROTECTED]> wrote: > If I publishhttp://someurl/myview?foo=1&foo=2&foo=3 > > How do I turn this into foo = ['1','2','3']? foo = request.GET.getlist('foo') http://docs.djangoproject.com/en/dev/ref/request-response/#querydict-objects --~--~-~--~-

Re: Trouble extending User

2008-11-12 Thread bruno desthuilliers
On 12 nov, 22:05, joshuajenkins <[EMAIL PROTECTED]> wrote: > So I'm doing basically what Chapter 12 references in the djangobook on > how to add a profile to Users. > > All is well in terms of adding users and pulling out the profile with > get_profile() on single users, but when I'm trying to p

Re: Dynamic Paths for File Uploads

2008-11-13 Thread bruno desthuilliers
On 13 nov, 01:52, Tim <[EMAIL PROTECTED]> wrote: > Just to add some more information - I have been messing around with > making the upload_to a callable, but I still have the same problem in > that I need to build the path based on information that only exists > during runtime (that is, a call t

Re: Basic concept for templatetag using node and parser

2008-11-13 Thread bruno desthuilliers
On 13 nov, 11:13, sugi <[EMAIL PROTECTED]> wrote: > Hi > > Can any one explain template tag with sample example. No problem : http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#writing-custom-template-tags To make a long story short: the parser function is called at "compilation" t

Re: Basic concept for templatetag using node and parser

2008-11-13 Thread bruno desthuilliers
On 13 nov, 12:33, "suganthi saravanan" <[EMAIL PROTECTED]> wrote: > Thanks bruno...but i have already read the documentation for the Custom > template tag. > > I need simple example for more clarification There's already one, and you can find quite a few others in third-part dhango apps, or even

Re: Improvement: documentation example for extra Manager methods

2008-11-13 Thread bruno desthuilliers
On 13 nov, 14:53, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, > > I am building a custom Manager for adding extra methods that return > filtered querysets. > I believe this is a common case for custom Managers. Yes, indeed. > Digging into the documentation [1], the only example emphasis

Re: Basic concept for templatetag using node and parser

2008-11-14 Thread bruno desthuilliers
On 14 nov, 12:29, "suganthi saravanan" <[EMAIL PROTECTED]> wrote: > Here i have customized the class ??? > in the templatetags folder and i have > render too. ??? > Using the function also i have called the parser function and > return the node object... > > I have created the template also

Re: Beginner desperately seeking Django experts.

2008-11-16 Thread bruno desthuilliers
On 15 nov, 07:54, Innergy <[EMAIL PROTECTED]> wrote: > Thanks for reading my question. I may not be asking all the right > questions. > > I am looking for a fast way to build a ecommerce site with many of the > qualities of threadless.com. I was told Django is an excellent > language Django i

Re: How to access the request object in a decorator

2008-11-17 Thread bruno desthuilliers
On 17 nov, 10:02, TH <[EMAIL PROTECTED]> wrote: > Hello, > > I wanted to redirect a logged in user if he access certain page. For > example i do not want the user to access registration page if he is > logged in. > > A simple way to do this is: > > def register(request): > if request.user.is_a

Re: Items tree in Django

2008-11-17 Thread bruno desthuilliers
On 17 nov, 11:46, Fabio Natali <[EMAIL PROTECTED]> wrote: > Hi everybody out there! :-) > > I have to cope with a few hundreds item tree/hierarchy in my Django > project. Specifically, I'll have 500 hundreds leaves in a 3-levels > tree with a dozen branches. > > I won't need much writing over this

Re: Python and/or django book

2008-11-17 Thread bruno desthuilliers
On 17 nov, 20:53, prem1er <[EMAIL PROTECTED]> wrote: > Just trying to figure out what the best book to purchase for a > newcomer to Django and python. Depends on your background... But if you have prior experience with 1/ another (preferably but not necessarily object oriented) language and 2/ s

Re: Passing values to template

2008-11-17 Thread bruno desthuilliers
On 17 nov, 16:45, Alex Jonsson <[EMAIL PROTECTED]> wrote: > Hey guys, > > I have a news application that I would like some help with. > > My view generates a list with objects mixed with dictionaries with two > objects. (snip) > Or is there a better way of doing this other > than mixing objects

Re: Can't access the development server

2008-11-17 Thread bruno desthuilliers
On 17 nov, 14:14, Ben <[EMAIL PROTECTED]> wrote: > Hi, > > I'm completely new to python and Django, although fairly familiar with > programming and web servers in general. > > I'm struggling to get Django up and running, at the moment, and I'd be > really grateful if someone could help. > > I'm fo

Re: Default custom settings

2008-11-18 Thread bruno desthuilliers
On 18 nov, 03:29, mdnesvold <[EMAIL PROTECTED]> wrote: > I'm writing an application that adds several app-specific settings. As > I'm developing, I'm just adding them to the end of my settings.py > file: > > MY_APP_FOO = 'foo' > MY_APP_BAR = ( >'bar', >'bam', >'baz', > ) > # and so on

Re: Multiple types of output (HTML, JS), same view.

2008-11-18 Thread bruno desthuilliers
On 18 nov, 21:29, "David Zhou" <[EMAIL PROTECTED]> wrote: > On Thu, Oct 30, 2008 at 4:08 PM, bruno desthuilliers > > <[EMAIL PROTECTED]> wrote: > > rendering, based on request informations. The points I'm yet really > > happy with are: > >

Re: Default custom settings

2008-11-18 Thread bruno desthuilliers
On 18 nov, 16:43, mdnesvold <[EMAIL PROTECTED]> wrote: > On Nov 18, 2:15 am, bruno desthuilliers > > <[EMAIL PROTECTED]> wrote: > > What I usually do is to provide default values in the relevant app's > > module(s), ie: > > > # myapp.models.py >

Re: Custom template tag problem: "No module named models"

2008-11-18 Thread bruno desthuilliers
On 15 oct, 09:19, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Wed, 2008-10-15 at 01:08 -0700, bruno desthuilliers wrote: > > [...] > > > FWIW, I just don't understand why each an every example in the > > Django's manual insists on using this projec

Re: Passing values to template

2008-11-18 Thread bruno desthuilliers
On 18 nov, 19:54, Ross Dakin <[EMAIL PROTECTED]> wrote: > > Others already gave you practical answers, so this will be mostly a > > more general ('conceptual' ?) advice: don't mix heterogenous data > > (objects, whatever) in a list. If you have a compelling reason (ie : > > ordering) to have het

Re: dynamic method calling

2008-11-24 Thread bruno desthuilliers
On 22 nov, 14:05, Ivan Sagalaev <[EMAIL PROTECTED]> wrote: > Chris wrote: > > try: > > push = getattr(self, 'get_%s_content' % self.name) > > except AttributeError: > > raise "Method does not exist" > > if callable(push): > > push(**argv) > > There are a couple of problems with this co

Re: dynamic method calling

2008-11-24 Thread bruno desthuilliers
On 22 nov, 13:07, "Steve McConville" <[EMAIL PROTECTED]> wrote: > > On Sat, Nov 22, 2008 at 2:38 AM, Chris <[EMAIL PROTECTED]> wrote: > >> Hello everyone, > >> I have a quick python question. Is they a better way of calling a > >> method dynamically then what I have below? Is there a more elegant

Re: dynamic method calling

2008-11-24 Thread bruno desthuilliers
On 22 nov, 02:38, Chris <[EMAIL PROTECTED]> wrote: > Hello everyone, > I have a quick python question. Is they a better way of calling a > method dynamically then what I have below? Is there a more elegant > approach? Thanks in advance. > try: > push = getattr(self, 'get_%s_content' % self.n

Re: Injecting stuff to an existing list?

2008-11-25 Thread bruno desthuilliers
On 25 nov, 10:04, "David Zhou" <[EMAIL PROTECTED]> wrote: > On Tue, Nov 25, 2008 at 3:55 AM, sajal <[EMAIL PROTECTED]> wrote: > > Now Id like to show age of the people along with their names. > > > I have a function which can calculate age callable via calculateAge > > (p.date_of_birth) but how d

Re: Injecting stuff to an existing list?

2008-11-25 Thread bruno desthuilliers
On 25 nov, 10:17, sajal <[EMAIL PROTECTED]> wrote: > David/Daniel, > > Thanks a lot for the prompt responses, ill use the method as specified > by Daniel. > > I had use methods earlier for get_absolute_url and stuff, but didnt > realize i could use methods to do anything I wanted... Well... Thi

Re: Copy data from 1 model to another

2008-11-26 Thread bruno desthuilliers
On 26 nov, 06:24, issya <[EMAIL PROTECTED]> wrote: > It looks like I partly answered my own question. I just do something > like the below to get the field names of the empty model B and I will > iterate through the fields until 1 matches and then assign the > information. > > This only prints out

Re: can't pass a parameter to my named url using {% url %} tag in template

2008-11-27 Thread bruno desthuilliers
On 27 nov, 14:19, dash86no <[EMAIL PROTECTED]> wrote: (snip) > However, when I do : > > delete > > I get the error: > > Caught an exception while rendering: Reverse for 'sam_project.delete- > quote-page,' with arguments '('',)' and keyword arguments '{}' not > found. > > If anyone has any hints th

Re: Overriding contrib.auth User save()

2008-11-27 Thread bruno desthuilliers
On 27 nov, 17:11, Paddy Joy <[EMAIL PROTECTED]> wrote: > Thanks for the tips, signals would work except I need access to the > raw password when users are created. > > On further inspection it seems I would need to override the > UserManager, On even further inspection, you may in fact want to

Re: Ordering bookeditions by their rating

2008-11-28 Thread bruno desthuilliers
On 28 nov, 11:07, coan <[EMAIL PROTECTED]> wrote: > I have book editions in my database. Users can rate editions. If they > want, they can also add them to their book collection. > Here is a simplified overview of the models: > > class Edition(models.Model): > title = models.models.CharField(ma

Re: Overriding contrib.auth User save()

2008-11-28 Thread bruno desthuilliers
On 28 nov, 09:45, Paddy Joy <[EMAIL PROTECTED]> wrote: > Thanks however I'm guessing: > > > > > admin.site.unregister(User) > > admin.site.register(User, NewModelForm) > > will only work in the admin site? Yes. > Not actually using the admin site at > the moment but would nice to have something

Re: Displaying items of a linked object in a template

2008-12-01 Thread bruno desthuilliers
On 1 déc, 14:20, Daniel Roseman <[EMAIL PROTECTED]> wrote: > On Dec 1, 12:15 pm, Marco <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > > I have this in my models.py : > > > class Device(models.Model): > > name = models.CharField(max_length=30) > > > class DeviceProperty(models.Model): > >

Re: Model similar to a spreadsheet

2008-12-02 Thread bruno desthuilliers
On 1 déc, 20:10, Stefan <[EMAIL PROTECTED]> wrote: > Hello, > > I'm new to Django and have some problems on how to create the models. > > What I want to do is something similar to a spreadsheet, but with more > than one data field per intersection. > > Basically like this: (http://dpaste.com/hold/

Re: Configuring Paths for FileField ?

2008-12-02 Thread bruno desthuilliers
On 2 déc, 08:58, Eric <[EMAIL PROTECTED]> wrote: > Hi! > > I'm new at Django, but I've been having relatively good luck. I've > recently hit a big of a wall using FileField. I have set up the paths > correctly enough that I can upload files to /my_site/uploads/photos, > but when I view the mo

Re: Why run two web-servers on the same host?

2008-12-02 Thread bruno desthuilliers
On 2 déc, 17:46, walterbyrd <[EMAIL PROTECTED]> wrote: > All the python frameworks seem to do this: one web-server for > development, another for production. There may be a good reason for > this, but I don't see it. Err... Not breaking whatever on the production server, perhaps ? FWIW, this is n

Re: about tutorial

2008-12-03 Thread bruno desthuilliers
On 3 déc, 13:22, Alan <[EMAIL PROTECTED]> wrote: > Hi, so I did the tutorial and did a simple modification in order to > get 'polls' views and 'admin' view too but I am failing. > > It's that: > > for mysite/urls.py: > from django.conf.urls.defaults import * > from django.contrib import admin > ad

Re: unable to open database file

2008-12-04 Thread bruno desthuilliers
On 4 déc, 09:49, gaz <[EMAIL PROTECTED]> wrote: > Hi I am trying to run Django Questionaire (http://djangoquest.aperte- > it.com/) on Apache with mod_python using SQlite on Windows 2003. > > When I try to log in I get the unable to open database file error. I > saw a number of posts mention that t

Re: Using managers for related object access

2008-12-04 Thread bruno desthuilliers
On 4 déc, 21:39, "Luke Graybill" <[EMAIL PROTECTED]> wrote: > I am attempting to use a custom manager for related object access, as > documented > here, > but it does not appear to be working properly. Upon accessing the

Re: Ruby on Rails vs Django

2008-12-05 Thread bruno desthuilliers
On 5 déc, 13:06, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi All, > > I'm new to the django world and I was just wondering how Django > compears with Ruby on Rails ? Mostly just like Python compares with (with ??? to ???) Ruby IMHO. Quite close overall, and yet very different philosophie

Re: Ruby on Rails vs Django

2008-12-05 Thread bruno desthuilliers
On 5 déc, 15:31, Masklinn <[EMAIL PROTECTED]> wrote: > On 5 Dec 2008, at 14:30 , bruno desthuilliers wrote:> On 5 déc, 13:06, > "[EMAIL PROTECTED]" > > <[EMAIL PROTECTED]> wrote: > >> Hi All, > > >> I'm new to the django world

Re: Ruby on Rails vs Django

2008-12-05 Thread bruno desthuilliers
On 5 déc, 16:16, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Metaphorically that Python/Djangois for a conservative engineer > mindset, ??? care to elaborate on this ??? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Ruby on Rails vs Django

2008-12-06 Thread bruno desthuilliers
On 5 déc, 23:57, yejun <[EMAIL PROTECTED]> wrote: > On Dec 5, 2:43 pm, bruno desthuilliers <[EMAIL PROTECTED]> > wrote: > > > On 5 déc, 16:16, "[EMAIL PROTECTED]" > > > <[EMAIL PROTECTED]> wrote: > > > Metaphorically that Python/Djang

Re: Ruby on Rails vs Django

2008-12-06 Thread bruno desthuilliers
On 6 déc, 10:55, "Guillermo C." <[EMAIL PROTECTED]> wrote: > Hi. > > - Scaffolding: I prefer it over django admin in many situations. I > mean, when you're doing something complex you'll need to drop out the > django admin and write your own code, so it's cool to have the basic > CRUD code and d

Re: fields in object.values()

2008-12-08 Thread bruno desthuilliers
On 8 déc, 08:53, Sotiris Kazakis <[EMAIL PROTECTED]> wrote: > Hello, > > Thank you for your answer. > > I try : tbData = tableName.objects.values(*strFld.split(",")) > > but that error appears : > > File "/var/lib/python-support/python2.4/django/db/models/sql/query.py", > line 1503, in add_fi

Re: fields in object.values()

2008-12-08 Thread bruno desthuilliers
On 7 déc, 21:48, "sotiris.kazakis" <[EMAIL PROTECTED]> wrote: > hello, > > I search a lot about the use of object.values() but don't get what I > want. > > I want to put dynamically (with a string ?) Better to use a sequence of strings IMHO. > the fields that I want to > get from a model. i.e.:

Re: Help needed debugging a weird MySQL error!

2008-12-08 Thread bruno desthuilliers
On 8 déc, 14:28, taleinat <[EMAIL PROTECTED]> wrote: > I have a Django application, and I wrote an external script which > reads and writes to the Django database. I've started getting the > following exception consistently: > > Exception _mysql_exceptions.ProgrammingError: (2014, "Commands out

Re: unique_together question

2008-12-09 Thread bruno desthuilliers
On 9 déc, 13:20, Alex Jonsson <[EMAIL PROTECTED]> wrote: > Hey everyone, > > My model looks like the following: > > http://dpaste.com/97293/ > > An album has a release date for every format, and one format can only > have one release date per album. Hopefully you get what I'm trying to > achieve h

Re: Using random.random() while running on server

2008-12-09 Thread bruno desthuilliers
On 9 déc, 11:32, Chris <[EMAIL PROTECTED]> wrote: > Hello, > when django is running on a server, I want to make a call to: > random.random(). When I make a call to this again, I can't. I think > this related to a similar issue datetime.datetime.now() where you > leave off the () to get a current

Re: Using random.random() while running on server

2008-12-10 Thread bruno desthuilliers
g this > > operator results in getting a reference to the function (or whatever > > callable). > > bruno desthuilliers - Yes I understand that! Ok, this was not obvious (to me at least) from reading your post. Sorry. > I _very_ strongly suggest !-) > that you read up on

Re: referencing the current instance inside limit_choices_to

2008-12-10 Thread bruno desthuilliers
On 10 déc, 19:25, fiedzia <[EMAIL PROTECTED]> wrote: > On Dec 10, 1:56 am, GuyBowden <[EMAIL PROTECTED]> wrote: > > > I'd like to set the limit_choices_to value of a ForeignKey field based > > on another selection in the current instance. > (snip) > > other thing to look at is that what is passed

Re: get_profile() and save()

2008-12-10 Thread bruno desthuilliers
On 10 déc, 11:18, [EMAIL PROTECTED] wrote: > Hi, > > I've got a ManyToMany-Field in my user-get_profile model. Now I've got these > lines of code: > > 1. up = user.get_profile() > 2. up.groups.add(bla) > 3. up.groups.save() > 4. up.save() > > Is it necessary to call up.groups.save() (line 3) No.

Re: A custom field that populates other models

2008-12-10 Thread bruno desthuilliers
On 10 déc, 10:50, pielgrzym <[EMAIL PROTECTED]> wrote: > Hi there, > > I followed some examples in the documentation regarding contenttype > and I wanted to write my own simple, generig tagging app. I know there > is tagging application but it's troublesome when you try to pass tag > names in GET

Re: A custom field that populates other models

2008-12-11 Thread bruno desthuilliers
On 11 déc, 01:11, pielgrzym <[EMAIL PROTECTED]> wrote: (snip) > The problem with saving is that when I try to save a post instance I > recieve: > > AttributeError: 'TagField' object has no attribute '_meta' > (link to full error report:http://wklej.org/hash/098a9cbd7a/) > > I'm not sure if passi

Re: A custom field that populates other models

2008-12-11 Thread bruno desthuilliers
On 11 déc, 16:30, pielgrzym wrote: > Thanks for your suggestions! Now I made the tagging work without any > inside changes due to proper url escaping :) Fine !-) > Unfortunately tagging > crashes multilingual app on postgresql database (I posted an issue > here:http://code.google.com/p/django

Re: django template script variable usage and declaration

2008-12-12 Thread bruno desthuilliers
On 12 déc, 11:57, Daniel Roseman wrote: > On Dec 12, 7:04 am, "Haroon idrees" wrote: > > > > > Hello > > I am new to python world . any one can help to guide how we > > declare variables in python template script and use in if else block > > and vary it > > > for example > > //need to decla

Re: Multiple sites - same code, different templates

2008-12-12 Thread bruno desthuilliers
On 12 déc, 13:33, "Ramdas S" wrote: > just a suggestion > > if it is just the templates you can write a loop inside in settings.py > based on site_id > (snip) > Pardon me if I didn't understand your question. Nope. The OP is talking of using different templates for the same site. --~--~---

Re: Multiple sites - same code, different templates

2008-12-12 Thread bruno desthuilliers
On 12 déc, 13:14, will0 wrote: > Hi all > > I can't figure out how to change TEMPLATE_DIRS according to the URL > used. > > My purpose is to view two versions of the same site, e.g. mysite/v1/ > and mysite/v2/, but keep the same codebase. This is just for > development so people in several countr

Re: Multiple sites - same code, different templates

2008-12-13 Thread bruno desthuilliers
On 13 déc, 14:41, barbara shaurette wrote: > This might be overkill, but you could use middleware and parse for the > version number in request.path: > > from django.conf import settings > from django.http import HttpResponseRedirect > > from mysite import settings as local_settings > > class Det

Re: django template script variable usage and declaration

2008-12-14 Thread bruno desthuilliers
On 14 déc, 10:53, "Haroon idrees" wrote: > I try cycle tage but it also give some error can please tell me what > is write Syntax of cycle tag It's in the documentation. Just follow the link I gave in my previous post. --~--~-~--~~~---~--~~ You received this me

Re: django query database

2008-12-14 Thread bruno desthuilliers
On 14 déc, 00:46, "Alfredo Alessandrini" wrote: > Hi, > > It's possible call a query with max or min value?: > > like this: > > game_list = game.objects.filter(Q(max_rating > player.rating) & > Q(min_rating < player.rating)) Sorry but your question is not clear. Are 'min_rating' and 'max_rating'

Re: django template script variable usage and declaration

2008-12-14 Thread bruno desthuilliers
On 14 déc, 18:06, "Haroon idrees" wrote: > after follow the documentation i face the following error > File "C:\Program > Files\Google\google_appengine\lib\django\django\template\__init__.py", > line 273, in parse > compiled_result = compile_func(self, token) > File "C:\Program > Files\Goo

Re: Reusing a python model

2008-12-14 Thread bruno desthuilliers
On 14 déc, 17:58, "JULIO Cayo" wrote: > Thanks Alex for your fast reply! Maybe I don't understand you, but if > i have a model (70 classes) in "base python" i don't want to re-write > entire model in django style. You don't have use Django's models.Model class to use Django. But obviously you ne

Re: django query database

2008-12-14 Thread bruno desthuilliers
On 14 déc, 19:03, "Alfredo Alessandrini" wrote: > > Sorry but your question is not clear. Are 'min_rating' and > > 'max_rating' fields of the game object ? If yes: > > Yes > > It's better: > > game_list = game.objects.filter(Q(max_rating__gt = player.rating) & > Q(min_rating__lt = player.rating))

Re: Custom ACL

2008-12-14 Thread bruno desthuilliers
On 14 déc, 15:26, Yanik wrote: > Hello, > > I need to build a custom ACL for the app I'm working on, Django's > isn't specific enough (I need to give permissions based on IDs, > statuses, etc.). > > I'd also like to attach it to the user, so that I could lookup in a > way something like User.acl.

Re: Custom ACL

2008-12-14 Thread bruno desthuilliers
On 14 déc, 22:49, bruno desthuilliers wrote: (snip) > Else, you can always monkeypatch the User model. You may then want to > use the descriptor protocol (http://docs.python.org/reference/ > datamodel.html#descriptors) More here on descriptors: http://users.rcn.com/python

Re: Sort Table Headers after data has been rendered via a POST request

2008-12-16 Thread bruno desthuilliers
On 16 déc, 01:15, SnappyDjangoUser wrote: > I wanted to run this by the group one more time does anyone know > how to handle sorting results by table header URL after a POST > request? > > I have used the SortHeaders class for GET requests and it works > great. I am hoping to find a way to e

Re: List a model fields

2008-12-16 Thread bruno desthuilliers
On 16 déc, 10:26, JF Simon wrote: > thanks dude. > > any idea to split the dict on the _ char ? > recursive function ? Probably not the most elegant solution, but it should do the trick: def add_to_context(self, context, field): current = context parts = field.name.split('

Re: List a model fields

2008-12-16 Thread bruno desthuilliers
On 16 déc, 07:53, JF Simon wrote: > Hello, i'm new with python (and french so my english may seem very > poor, sorry about that). > I would like to list a model's fields and return a dict, here is the > example : > > I have a model class with : > > meta_title : CharField(...) > meta_description :

Re: Model Inheritance with external apps

2008-12-16 Thread bruno desthuilliers
On 16 déc, 19:07, Lyubomir Petrov wrote: > I'm just starting a project that is using django-profile. There are > some fields like "country" that i want to remove. > As in django-profiles I use my own class that extends the base class > (BaseProfile), so i can add some common information fields. >

Re: Using authenticated users id in models

2008-12-17 Thread bruno desthuilliers
On 17 déc, 17:08, abidibo wrote: > Hi all, > I'm a beginenr with Django and Python And possibly with web programming AFAICT - but we won't hold it against you !-) > and I'e have a problem I didn't > reached to solved myself, here is the question: > I'd like to have a DB table like POST, that co

Re: nested template problem

2008-12-18 Thread bruno desthuilliers
On 18 déc, 18:31, marco ghidinelli wrote: > hello. > > Does django template engine supports nested dictionary? Yes, indeed. > i'm trying to display a nested array with no luck. > > that's my tries: > > --- python manage.py shell --- > from django.template import

Re: Security in AJAX POSTing

2008-12-18 Thread bruno desthuilliers
On 18 déc, 23:20, Taylor wrote: > I'm working on a game in Django where the majority of the interaction > comes through clicks that run JavaScript methods that use jQuery's > $.post() to post data to a url. To protect against cheaters and bots, > I must ensure that every post is made by a logged

Re: output of XML serializer

2008-12-19 Thread bruno desthuilliers
On 19 déc, 00:13, "Mr. T" wrote: > response = serializers.serialize('xml', MySet.objects.all()) > return HttpResponse(response , mimetype='text/xml;') > > The output has each member of "MySet" with an tag, and then > within the object, a bunch of tags with each field. Looks like a sensible s

Re: template inheritance miff

2008-12-20 Thread bruno desthuilliers
On 20 déc, 18:48, "Milan Andric" wrote: > Hello, > > I have two templates in this example, > page_base.htmlhttp://dpaste.com/101058/and intro.html > http://dpaste.com/101059/. > intro.html inherits from page_base.html, but the content_head block > does not get inherited. what am i doing wr

Re: Complete layout (template) switching.

2008-12-22 Thread bruno desthuilliers
On 22 déc, 13:34, Kura wrote: > Hey guys, I'm currently working on a content management system built > on the Django framework, currently the whole cms works on a section->page(s) > basis which is working well, we've run in to some issues with > > our designs in that the blocks for content on so

Re: Django models

2008-12-22 Thread bruno desthuilliers
On 22 déc, 17:10, kev wrote: > Hello, > Im reading a django book and it adds friends to user authentication > system by making: > > (was .96) > > class Friendship(models.Model): > from_friend = models.ForeignKey( > User, related_name='friend_set' > ) > to_friend = models.ForeignKey( >

  1   2   3   4   5   6   7   8   9   10   >