Re: Query exclude in and selective sort questions

2009-04-25 Thread Malcolm Tredinnick
On Thu, 2009-04-16 at 18:20 -0700, Thierry wrote: > Let's say I have a list of words in my database: > > ['bbb', 'aaa', 'zzz', 'ddd'] > > How can I retrieve a list of the above excluding the following words > ['aaa', 'zzz'] by using __in? I can do the above with: > >words_list = Words.obje

Re: Java-doc style api docs.

2009-04-25 Thread Malcolm Tredinnick
On Wed, 2009-04-15 at 15:42 -0700, Eddified wrote: > Are there up-to-date java-doc style api docs like this: > http://djangoapi.matee.net/ > anywhere on the official django site? I've looked high and low and > can't find it... No. They don't exist there. Intentionally. If anybody wants that sor

Re: Models.py - retrieve information from other models via ForeignKey field?

2009-04-25 Thread Malcolm Tredinnick
This doesn't seem to have been resolved at all, so a couple of questions that might help things out... On Tue, 2009-04-14 at 19:06 -0700, Emma F wrote: > I feel like there must be something very elementary that I'm missing > here, but I've been all through the documentation and can't figure it >

Re: simple model problem

2009-04-24 Thread Malcolm Tredinnick
On Fri, 2009-04-24 at 13:21 -0700, bshaurette wrote: [...] > My preference would be just to add an 'id' column to the table, but > we're trying to keep db changes to a minimum (changing one means > changing the same table in at least a dozen more - not optimal, but it > is what it is). Without i

Re: UnpickleableError when sessions are saved

2009-04-18 Thread Malcolm Tredinnick
On Mon, 2009-04-13 at 01:39 -0700, Iqbal Abdullah wrote: > Thanks Alex and matehat, > > Concerning this issue of mine, I've decided to remove the images and > save the objects without the ImagingCore in them, which fixed the > whole thing. > > On a different note, other than actively testing dat

Re: Why no index on auth_user username field?

2009-04-18 Thread Malcolm Tredinnick
On Sat, 2009-04-18 at 21:22 -0700, meppum wrote: > I noticed that there is a unique constraint and maybe that infers an > index, but if it doesn't, why isn't an index on this column needed? The unique constraint does provide an index. Otherwise inserts would be very inefficient for the database,

Re: possible filter bug with manytomany fields and slice?

2009-04-16 Thread Malcolm Tredinnick
On Thu, 2009-04-16 at 00:01 -0700, Margie wrote: > Ah - ok, cool, good to know. I am on 1.1 pre-alpha SVN-9814. Hmm .. then maybe there's an actual problem there. The ability to use nested querysets was added in r9701 (with a few bug fixes in subsequent patches). I only said 1.1-beta as a rough

Re: possible filter bug with manytomany fields and slice?

2009-04-15 Thread Malcolm Tredinnick
On Wed, 2009-04-15 at 23:13 -0700, Margie wrote: [...] > # PROBLEM IS HERE > # Find all pdtasks that have an entry in tiles that is in slice 0:4 of > Tile.objects.all() > # I think this should return bar as well, but it returns an empty > list. WHY??? > (Pdb) PdTask.objects.filter(tiles__in=Tile.

Re: Business Logic Architecture Questions on Models & ModelManagers

2009-04-12 Thread Malcolm Tredinnick
On Sun, 2009-04-12 at 20:41 -0700, Sean Neilan wrote: > I'm building a large web application & I'm trying to figure out ways > to organize my business logic (just the queries). I figure I should > either put all my queries inside Model functions or ModelManager > functions. I've searched all over

Re: Send validation error message to the screen

2009-04-12 Thread Malcolm Tredinnick
On Sun, 2009-04-12 at 17:22 -0700, Joshua Partogi wrote: > Thanks Malcolm, > > What I'm looking after is sending my custom validation error message > that is not covered by django. But what does this mean? How is it different from passing any other piece of information to a template via the cont

Re: Mulitple Time Zone support?

2009-04-12 Thread Malcolm Tredinnick
On Sun, 2009-04-12 at 17:15 -0700, ydjango wrote: > What is the best way to provide multiple Time zone support? > > The registered user visiting the website should see all times and > dates as per his/her time zone and not as per time zone in > settings.py? If I were doing this, I'd create a tem

Re: Simple Query?

2009-04-12 Thread Malcolm Tredinnick
On Sun, 2009-04-12 at 14:06 -0700, jrs_66 wrote: [...] > On a broader level, is Django's ORM intended for people who don't know > how to write SQL? It seems that many hoops have to be jumped through > to get basic SQL results... I think that impression is probably only because you're still learn

Re: Does Django use persistent DB connection?

2009-04-12 Thread Malcolm Tredinnick
On Sun, 2009-04-12 at 06:39 -0700, Continuation wrote: > I can't find any info on that in the doc. > > Does that mean DB connections are not reused? If so, why? Seeing how > establishing DB connection is a pretty expensive operation I'd think > it makes sense to reuse them. One connection per re

Re: Send validation error message to the screen

2009-04-12 Thread Malcolm Tredinnick
On Sun, 2009-04-12 at 23:37 +1000, Joshua Partogi wrote: > Dear all, > > I want to send and display validation error message from the view to > the template, how do I do this in Django? I tried searching on the > documents but could not find any topics on error message. Could anyone > give me a h

Re: deletion of "distant" related objects

2009-04-12 Thread Malcolm Tredinnick
On Sun, 2009-04-12 at 00:40 -0700, Margie wrote: [...] > Let's say that my Publisher and Book classes are in one app, and that > app doesn't know anything about the readers. Is there any simple way > to find all related object fields that point to book and clear them > out, without having to know

Re: deletion of "distant" related objects

2009-04-12 Thread Malcolm Tredinnick
On Sat, 2009-04-11 at 23:29 -0700, Margie wrote: > I am having some trouble with the deletion of related objects that are > multiple levels away from the object being deleted. I've read a bunch > of stuff written on deletion of related objects, but nothing on this > particular problem - hoping s

Re: unknown column in field list

2009-04-11 Thread Malcolm Tredinnick
On Sat, 2009-04-11 at 18:56 -0700, nixon66 wrote: > I have a legacy database that I used inspectdb to create the models. > I cleaned up the models, set primary keys, foriegn keys etc. But when > I tried to create a view I get an "unknown column activity.fp_id_id > in field list". I'm not sure wh

Re: Django admin page hangs in django server - where is web server error log?

2009-04-11 Thread Malcolm Tredinnick
On Sat, 2009-04-11 at 17:40 -0700, adelein wrote: > Hi Zain, > > The thing is that I was able to access the main page before I changed > the urls.py file, so I think that means that the port isnt being > blocked. Something to do with the urls.py file is messed up : ( Then go back and try things

Re: Django admin page hangs in django server - where is web server error log?

2009-04-11 Thread Malcolm Tredinnick
On Sat, 2009-04-11 at 17:09 -0700, adelein wrote: > > Hi, > > Sorry, I meant to say urls.py of course. So, given I did put the code > in the right file, the problem still remains. If you're following the tutorial, then you will be running the development server. So all "server log" style output

Re: Admin in frontend

2009-04-11 Thread Malcolm Tredinnick
On Sat, 2009-04-11 at 21:10 -0300, Marcello Parra wrote: > Hello Malcom, > > Thanks for your help... > I think of a frontend as the user part of the site... where I will > provide users pages with proper layout and the admin site, is the one > provided by django admin where I would manage some ta

Re: every time that I load a form page, i have to reload the page to make errors go away

2009-04-11 Thread Malcolm Tredinnick
On Sat, 2009-04-11 at 19:23 -0400, Alex Gaynor wrote: [...] > > > Even if your application is exclusively for your own usage, it's not > uncommon for the pointy haired boss to come in with requests to change > a URL hierarchy, and there's no reason to create more work for > yourself. Wh

Re: every time that I load a form page, i have to reload the page to make errors go away

2009-04-11 Thread Malcolm Tredinnick
On Sat, 2009-04-11 at 17:49 -0500, James Bennett wrote: > On Sat, Apr 11, 2009 at 5:13 PM, codecowboy wrote: > > I've followed some examples from around the Django community and that > > is why I use the reverse() method at all. What is the point of using > > the reverse() method? > > Well, the

Re: how to use email instead of username for user authentication?

2009-04-11 Thread Malcolm Tredinnick
On Sat, 2009-04-11 at 07:52 -0700, pkenjora wrote: > Malcom, Well, I'm not "Malcom" (sic), but I'll reply anyway. >Google, FaceBook, and LinkedIn have been using email authentication > for how long now? With the default constraints you've put on Django a > developer would have to "work arou

Re: Template filter with plural tag

2009-04-11 Thread Malcolm Tredinnick
On Sat, 2009-04-11 at 12:40 -0700, Kless wrote: > I would to pluralize into a translation block [1] but I also want to > apply the 'apnumber' template filter [2] > --- > {% load humanize %} > {% load i18n %} > > {% blocktrans count list|apnumber as number %} > There is {{ number }} object

Re: Admin in frontend

2009-04-11 Thread Malcolm Tredinnick
On Sat, 2009-04-11 at 11:51 -0300, Marcello Parra wrote: > Hello, > > I'm planning a site with django. > It need to have some functionalities that are very similar to Django's > admin (like CRUD in some tables, with validations, etc...). But I > would not like to have two sections (frontend and a

Re: PyTwitter Module

2009-04-11 Thread Malcolm Tredinnick
On Sat, 2009-04-11 at 06:09 -0700, nitr...@gmail.com wrote: > I'm using the pytwitter module written by Niall Sheridan http://www.evil.ie/ [...] There doesn't seem to be anything Django related in this post. Please help us keep things on-topic here -- it's high enough volume already. Regards, Ma

Re: Default mimetype

2009-04-11 Thread Malcolm Tredinnick
On Fri, 2009-04-10 at 23:40 -0700, Roman Timushev wrote: > Hello, > > My application serves content with different mimetypes: 'application/ > xhtml+xml', 'application/xml', 'application/json'. Specifying mimetype > for every view is not DRY. Is it possible to define default mimetype > for url gro

Re: Foreign Key query question

2009-04-11 Thread Malcolm Tredinnick
On Sat, 2009-04-11 at 01:02 -0700, nikita kozlovsky wrote: > On Apr 11, 3:11 am, Malcolm Tredinnick > wrote: > > > > Django's SQL is going exactly what you suspect and not using any outer > > join here. Using a simplified version of the original two models:

Re: adminsite instance and (registered) related objects question

2009-04-10 Thread Malcolm Tredinnick
On Fri, 2009-04-10 at 21:24 -0700, patrickk wrote: > > > On Apr 11, 6:03 am, Malcolm Tredinnick > wrote: > > On Fri, 2009-04-10 at 20:17 -0700, patrickk wrote: > > > anyone? > > > > *sigh* If somebody had an answer, they would have answered already. It

Re: adminsite instance and (registered) related objects question

2009-04-10 Thread Malcolm Tredinnick
On Fri, 2009-04-10 at 20:17 -0700, patrickk wrote: > anyone? *sigh* If somebody had an answer, they would have answered already. It's kind of self-fulfilling prophecy! [...] > > > > is this intentional? the docs doesn´t explain this and my assumption > > is that different adminsite instances are

Re: syncdb adding extra table from models

2009-04-10 Thread Malcolm Tredinnick
On Fri, 2009-04-10 at 20:36 -0700, nixon66 wrote: > The meta option is already there. And the myproject_country table is > still created. I seem to remember there have been some problems where querying the existing tables in the database returned them with different casing of the name to what the

Re: trying to use the aggregate functions

2009-04-10 Thread Malcolm Tredinnick
On Fri, 2009-04-10 at 18:15 -0700, chris wrote: > > > On Apr 10, 6:55 pm, Malcolm Tredinnick > wrote: > > > However there could be, and likely are, many TextChar objects with the > > same edition value, so it would be ambiguous as to which particular > > o

Re: Generic relations and unit tests.

2009-04-10 Thread Malcolm Tredinnick
On Sat, 2009-04-11 at 08:47 +0800, Russell Keith-Magee wrote: > On Sat, Apr 11, 2009 at 5:53 AM, Poromenos wrote: > > > > Hello, > > I created a model that has a ForeignKey to ContentType, but now I > > can't use my test fixtures, since the IDs they point to are random > > every time the test dat

Re: single queryset from multiple tables

2009-04-10 Thread Malcolm Tredinnick
On Fri, 2009-04-10 at 19:44 -0400, Alex Gaynor wrote: > > > On Fri, Apr 10, 2009 at 7:40 PM, Malcolm Tredinnick > wrote: [...] > > Particularly with iterators, storing the (next head item, rest > of > iterator) pair in a heap leads to

Re: Object filtering with a GenericForeignKey field

2009-04-10 Thread Malcolm Tredinnick
On Fri, 2009-04-10 at 16:04 -0700, M Godshall wrote: > I have two models, Comment and Project. Comments are connected to a > Project through a GenericForeignKey, and each Project is assigned to a > particular user. I'd like to retrieve the latest comments for all the > projects that a particular

Re: This can't be that hard

2009-04-10 Thread Malcolm Tredinnick
On Fri, 2009-04-10 at 14:46 -0700, Mr. T wrote: > Sorry, a QuerySet eval question. Yeah, I'm dumb I know. > > My view is creating a query set, XXX.objects.all(). Stale data is > being served up all the time. Read the docs about generic views, when > sets are evaluated, some old posts in this grou

Re: single queryset from multiple tables

2009-04-10 Thread Malcolm Tredinnick
On Fri, 2009-04-10 at 16:44 -0400, Alex Gaynor wrote: > > > On Fri, Apr 10, 2009 at 4:40 PM, veearrsix > wrote: > > This question seems to have been asked a few times, but never > answered > fully. Not quite true. It's been answered fully a lot of times: querys

Re: rendering values from ManyToMany fields

2009-04-10 Thread Malcolm Tredinnick
On Fri, 2009-04-10 at 12:16 -0700, Adam Fraser wrote: [...] > The problem I'm running into is that the value that comes into render > for the ManyToManyField is a list of the id's for the selected stains > and not the stains themselves. I assume I should be getting them > somehow through the djan

Re: Different admin registry behavior with mod_python versus dev server

2009-04-10 Thread Malcolm Tredinnick
On Fri, 2009-04-10 at 12:01 -0700, Joe Sr. wrote: [...] > That's a good idea I will check on, but it wouldn't explain why it > works with the development server and not mod_python. It might well explain that. There's no guarantee about import order and certainly no guarantee that it will be the s

Re: Where is dictfetchall ?

2009-04-10 Thread Malcolm Tredinnick
On Fri, 2009-04-10 at 13:25 -0400, Alex Gaynor wrote: [...] > Take a look at the values() method on a queryset: > http://docs.djangoproject.com/en/dev/ref/models/querysets/#values-fields Since the original poster was explicitly asking about custom SQL situations, this isn't a valid solution. Sure

Re: Where is dictfetchall ?

2009-04-10 Thread Malcolm Tredinnick
On Fri, 2009-04-10 at 10:24 -0700, MS wrote: > Hi Malcolm! > > > > then is there any good (built-in) way > > > to write custom SQL queries wich would return dicts instead of tuples? > > > > You know the order the values will be returned in and you know the names > > of the columns. So you can cr

Re: Foreign Key query question

2009-04-10 Thread Malcolm Tredinnick
On Fri, 2009-04-10 at 05:45 -0700, nikita kozlovsky wrote: > On Mar 9, 3:21 am, Malcolm Tredinnick > wrote: > > Hello, Malcolm. > > > > Again, the correct syntax would be: > > > Message.objects.filter(student__isnull=True) > > Why ORM uses LEFT OUTER

Re: How best to deal with non-abstract model inheritance in the admin

2009-04-10 Thread Malcolm Tredinnick
On Fri, 2009-04-10 at 05:41 -0700, AndyB wrote: > Hi, > > I've got a model called Courses and a model that inherits from it > called SpecialCourses that has some extra fields. > > It seems that any SpecialCourses I add also show up in the changelist > for Courses which will be confusing for cont

Re: Where is dictfetchall ?

2009-04-10 Thread Malcolm Tredinnick
On Fri, 2009-04-10 at 04:50 -0700, MS wrote: [...] > If it's not available any longer Which it isn't. > then is there any good (built-in) way > to write custom SQL queries wich would return dicts instead of tuples? You know the order the values will be returned in and you know the names of the

Re: Strange FileField behaviour

2009-04-10 Thread Malcolm Tredinnick
On Fri, 2009-04-10 at 04:41 -0700, John Baker wrote: > I have a form that validates the size of a file and it works in one > page but not another. This is very strange. The only difference > between the two templates is that the working one has only a single > form (below) and the non-working one

Re: inheritance, abstract base classes and generic foreign keys

2009-04-10 Thread Malcolm Tredinnick
On Fri, 2009-04-10 at 02:34 -0700, herr.klein...@googlemail.com wrote: > Thanks Malcom. > > All right lets see if i could put my real problem simpler. Lets say > you are the tutor of a programming course and you want to check the > programming assignments semi-automatically. > So you would set up

Re: trying to use the aggregate functions

2009-04-10 Thread Malcolm Tredinnick
On Fri, 2009-04-10 at 02:05 -0700, chris wrote: > Hi there, > > Here I am trying to use the aggregate functions available in SVN trunk > (I am not sure if they have been released). The following is a > simplified version of the models involved: > > class Edition(models.Model): > edkey = mod

Re: form error_messages doesnt work

2009-04-09 Thread Malcolm Tredinnick
On Fri, 2009-04-10 at 00:48 -0300, emonk wrote: > I understand your point, but how i do if i dont want to show the %s in > my custom error message? :S I mentioned that in my original reply in this thread: Use CharField or RegexField. Regards, Malcolm --~--~-~--~~~

Re: form error_messages doesnt work

2009-04-09 Thread Malcolm Tredinnick
On Fri, 2009-04-10 at 00:07 -0300, emonk wrote: > I do not understand that these messages are not working as if the > other > Who care if i talk about lenght, what happen if i talk about range of > numbers? I wrote that you need to accept a format parameter in the error messages (the "%s"). Have

Re: form error_messages doesnt work

2009-04-09 Thread Malcolm Tredinnick
On Thu, 2009-04-09 at 23:23 -0300, emonk wrote: > Hi, > I have this form: > class registerForm(forms.Form): > aNumber = forms.IntegerField( > label='Some Integer Field', > max_value=, > > m

Re: Awkward Password Requirements

2009-04-09 Thread Malcolm Tredinnick
On Fri, 2009-04-10 at 00:28 +0100, Daniel Watkins wrote: > Hello all, > > I'm currently working on an implementation of the server-side of an > already-defined protocol. So, no, I can't do things differently. :) > > The protocol performs authentication by passing a token which is > "md5(md5(pas

Re: inheritance, abstract base classes and generic foreign keys

2009-04-09 Thread Malcolm Tredinnick
On Thu, 2009-04-09 at 15:48 -0700, herr.klein...@googlemail.com wrote: > Hi! > > I have cages filled with animals. All animals can move, but they do it > all differently. Some animals even have attributes the others don't. > Now i want all the animals in a cage to move. > > How do i implement th

Re: Positive integer form field with max lenght

2009-04-09 Thread Malcolm Tredinnick
On Thu, 2009-04-09 at 04:27 -0300, emonk wrote: > Hi people. > This is my doubt > > I need make a form field with this restrictions: > > _field content must be only integers numbers and postive. > _filed content must have a max lenght, for example 8 characters. > > I am confused beacuse models.

Re: A long way ...

2009-04-08 Thread Malcolm Tredinnick
On Wed, 2009-04-08 at 12:35 -0700, mettwoch wrote: > Thanks a lot Malcolm! I'll start moving the TurboGears hand-written > admin to the Django admin and keep MySQL. > > I've one more philosophic question: The model in Django should hold > the business rules, right? Not really. Firstly, I'm kind

Re: Help Figuring Out Relationships

2009-04-08 Thread Malcolm Tredinnick
On Wed, 2009-04-08 at 10:37 -0700, PipeManMusic wrote: > I'm working on a project that handles Discography's and I am having > trouble figuring out the relationships. > > Artist: Can belong to more than one Group play more than one Instument/ > Production Role on more than one Album and could var

Re: ForeignKey to a Base Model and Relationships with the Inherited Models

2009-04-08 Thread Malcolm Tredinnick
On Wed, 2009-04-08 at 08:03 -0700, cfiles wrote: > Is it possible to force a base model to have a sub model? Consider the > following model... > > class Account(models.Model): > user= models.ForeignKey('auth.User') > name= models.CharField(max_length=100) > description

Re: registration and profile must save at a time

2009-04-08 Thread Malcolm Tredinnick
On Wed, 2009-04-08 at 05:36 -0700, Praveen wrote: [...] > i am very much familiar with django-registration and django-profile > but it really wiered to display extra fields on Registration Form for > that we will have to customize the from django.contrib.auth.forms. I feel you might be over-think

Re: access dict attribute with space in the key

2009-04-08 Thread Malcolm Tredinnick
On Wed, 2009-04-08 at 04:50 -0700, rslee wrote: > I have dict named "servers". With in it, there is a key called "num > of cpu". In Python, I can access this as servers["num of cpu"]. In > Django, how can I access this dict item. I tried the following but > they do not work: {{servers.num of c

Re: Something is eating memory. How to track it down?

2009-04-08 Thread Malcolm Tredinnick
On Wed, 2009-04-08 at 08:43 +0100, Andy Baker wrote: > Wow! So Python will eat RAM until restarted? That changes the way I am > thinking about this problem. Well, that's not really accurate, as you realise further down. The maximum amount of RAM used will not decrease. However, it won't increase

Re: Django 1.0.x Advantages/Features.

2009-04-08 Thread Malcolm Tredinnick
On Wed, 2009-04-08 at 00:07 -0700, Harish wrote: > Hi Folks, > > I want to know the advantage / features of django 1.0.x over pre 1 > version.. > > Can any one have a list of advantage / features or url which will be > helpfull for me to evaluate... A very significant consideration here is tha

Re: Beginned question: More about polls

2009-04-07 Thread Malcolm Tredinnick
On Tue, 2009-04-07 at 23:25 -0700, zayatzz wrote: [...] > I understand that i have to create poll as one module, question as > second module and answers as 3rd module(or 3rd, 4th and 5th as they > need to be of different kind). But how to handle the problem that > questions (or their answers) have

Re: Many Questions, some of which are theoretical

2009-04-07 Thread Malcolm Tredinnick
On Tue, 2009-04-07 at 23:18 -0700, zayatzz wrote: > Thanks for the lengthy answer.I already started looking into that > session application. Ill read through the other pages also... If i > only had time for all this. Thats the main reason why i asked those > questions - i needed someone to point m

Re: "id may not be NULL" during save in one-to-many relationship

2009-04-07 Thread Malcolm Tredinnick
On Tue, 2009-04-07 at 21:47 -0700, Hostile Fork wrote: [...] > Okay, thanks. Perhaps a good place to document this would be on the > first page of the tutorial Not really, no. At that point in the first tutorial, subtleties like this are not of paramount importance. It's the beginner's tutorial,

Re: Creating new records via models

2009-04-07 Thread Malcolm Tredinnick
On Tue, 2009-04-07 at 20:10 -0700, Iqbal Abdullah wrote: > Hi guys, > > I'm a bit confused on inserting new data into the db via the models, > i.e in the docs > http://docs.djangoproject.com/en/dev/topics/db/queries/#topics-db-queries > a given example to add new data into a table is: > > from

Re: how does django registry work?

2009-04-07 Thread Malcolm Tredinnick
On Tue, 2009-04-07 at 20:06 -0700, Rit wrote: > James Bennett mentioned "django registry" in this talk > http://www.youtube.com/watch?v=A-S0tqpPga4 I'll guess that he actually mentioned django-registration, which is an application he's written and distributed via Google code. A quick search will

Re: "id may not be NULL" during save in one-to-many relationship

2009-04-07 Thread Malcolm Tredinnick
On Tue, 2009-04-07 at 16:15 -0700, Hostile Fork wrote: > Hello djangoists! > > Code has been coming along pretty well in my first django project. > But I hit a snag with a one-to-many relationship in my model. > > When I do something like this: > > f = Foo() > b = Bar(foo=f) > f.sav

Re: model inheritance and column ordering

2009-04-07 Thread Malcolm Tredinnick
On Tue, 2009-04-07 at 19:30 -0700, rvr wrote: > Is there a way to specify a field in an abstract base class, but have > the corresponding column appear last in the table's column list? > > class A(models.Model): > ts = models.DateTimeField(default=datetime.now()) > class Meta: > a

Re: Clarifications for apps and models

2009-04-07 Thread Malcolm Tredinnick
On Tue, 2009-04-07 at 18:29 -0700, Thierry wrote: > I'll be referring to the example in the Django documentation here. I > will extend on the "books" application in the "mysite" project by > creating a new app called "music" so that the structure looks like the > following: > > mysite/ > boo

Re: for loop appending objects

2009-04-07 Thread Malcolm Tredinnick
On Tue, 2009-04-07 at 14:57 -0700, thedja wrote: > Good day to you all, > > Im using > q = Person.objects.filter(pk=query) > > and i have this inside a FOR statement. So every time the loop starts > again q gets rewritten instead of adding the new objects. > > for stuff in box: > for th

Re: A long way ...

2009-04-07 Thread Malcolm Tredinnick
On Tue, 2009-04-07 at 14:31 -0700, mettwoch wrote: > Hi, > > I've been watching Django and other Python frameworks a few years ago > and stopped at version 0.96. Last year I started to look at a web > framework to move an old M$ Access Inventory application to a more > stable and universal archit

Re: Iterating over a field using widget=ChekboxSelectMultiple

2009-04-07 Thread Malcolm Tredinnick
On Tue, 2009-04-07 at 17:28 -0700, Jim wrote: > Hello, > > I have this form. > > class SearchForm(forms.Form): > search=forms.CharField(widget=widgets.SearchWidget) > search_type=forms.MultipleChoiceField > (widget=CheckboxSelectMultiple,choices=[('a','A'),('b','B'),]) > > In the templa

Re: Something is eating memory. How to track it down?

2009-04-07 Thread Malcolm Tredinnick
On Tue, 2009-04-07 at 15:20 -0700, andybak wrote: > I've got no really huge tables - the entire db is under 6meg and the > site isn't even public yet so traffic is minimal. Memory just doesn't > seem to go down. (until the process get's restarted by maxchild or by > me killing it). That's complet

Re: blank=True on Char/TextFields

2009-04-07 Thread Malcolm Tredinnick
On Tue, 2009-04-07 at 10:26 -0700, Magus wrote: > I agree with Lee. There should be a way for a developer to store NULL > into a char field. At the moment null flag has no effect for a > CharField. Generally saying an empty string is not the same a not > defined value = NULL. It's pity that the ac

Re: how to use email instead of username for user authentication?

2009-04-07 Thread Malcolm Tredinnick
On Tue, 2009-04-07 at 10:16 -0700, pkenjora wrote: > Hi, > > Why not remove the '@' filter and allow the specific project > developer the freedom to use email as username? What was the > reasoning behind this? One reason is that usernames can be made to be unique, since you're selecting a new

Re: Admin action not executed when no objects are selected

2009-04-07 Thread Malcolm Tredinnick
On Tue, 2009-04-07 at 06:55 -0700, pault wrote: > I want to run an action from my admin when I press the GO button > without having to select any objects. > > But it seems actions are only triggered when at least one object is > selected. Does anyone know a workaround for this. What you're after

Re: Many Questions, some of which are theoretical

2009-04-07 Thread Malcolm Tredinnick
On Tue, 2009-04-07 at 06:46 -0700, zayatzz wrote: > Hello > > Im mainly thinking bit ahead here, while im still in the beginning of > writing my first real project/application with django. > If someone could answer all or some of those questions and perhaps > provide examples, then i would greatl

Re: Multi app project and inter app communication

2009-04-07 Thread Malcolm Tredinnick
On Tue, 2009-04-07 at 04:36 -0700, kRON wrote: > Hello everyone. I've only recently started developing app with Django > and in Python as well. I have a fair experience in developing web apps > on frameworks in PHP and I'm really trying to make a commitment on > doing my first Django app properly

Re: Partially rendering templates.

2009-04-07 Thread Malcolm Tredinnick
On Tue, 2009-04-07 at 03:04 -0700, Chris Dew wrote: > Here's a newbie question: > > Is there a way of rendering (a single block of?) a Django template, > without it loading in it's parent template(s). > > My purpose is to use a single template to render both a component of a > page as an html sn

Re: Custom Validation in Django 1.0.2 Final

2009-04-07 Thread Malcolm Tredinnick
On Mon, 2009-04-06 at 23:58 -0700, Harish wrote: [...] > If salary is found negative it displays the error message in beginning > of the form(that is after the message 'Please correct the error below. > '). Actually it should display the error message in the 'Salary' > section > > I think, I am m

Re: wsgi.WSGIHandler:how to get a WebOb Request at first place

2009-04-06 Thread Malcolm Tredinnick
On Mon, 2009-04-06 at 23:31 -0700, Coonay wrote: > > > On Apr 7, 12:54 pm, Graham Dumpleton > wrote: > > On Apr 7, 2:33 pm, Coonay wrote: > > > > > i want to get a WebOb Request ASAP when the WSGIHandler is called,such > > > as retrieve the SERVER_NAME and SERVER_PORT meta information from the

Re: Multiple databases/engines

2009-04-06 Thread Malcolm Tredinnick
On Mon, 2009-04-06 at 21:22 -0300, Marcello Parra wrote: > Hello, > > I started to play with Django some weeks ago. I'm very impressed with > it and making some tests with an application I have already running... > > The problem is that I need to connect to two databases using two > different en

Re: Cannot get admin to order rows properly

2009-04-06 Thread Malcolm Tredinnick
On Mon, 2009-04-06 at 13:27 -0400, Karen Tracey wrote: [...] > > Multi-column ordering has been requested before, you might try > searching the list and tracker for details on why it's not being done > now. One of the big reasons this isn't available is that it's quite a challenging UI problem

Re: Django assumes commit will succeed - consumes the exception

2009-04-06 Thread Malcolm Tredinnick
On Mon, 2009-04-06 at 07:05 -0700, Anssi Kaariainen wrote: > I ran to an problem when playing around with Postgresql deferred > constraint triggers. While deferred constraint triggers themselves are > not too important for Django, the consuming of on-commit DB errors > is. > > I will go through t

Re: Can I just put user id in session for authorization purpose?

2009-04-05 Thread Malcolm Tredinnick
On Sun, 2009-04-05 at 06:27 -0700, Zeal wrote: > Django's auth is pretty good, however, I need some row-level > authorziation mechnism, like in which department and function that the > certain user could access, so my needs on authrization are pretty > different than default auth model. Thanks! I

Re: How to get session data from template

2009-04-05 Thread Malcolm Tredinnick
On Sun, 2009-04-05 at 18:03 -0700, Joshua Partogi wrote: > > > On Apr 6, 12:25 am, Antoni Aloy wrote: > > In your render_to_response don't forget to add > > context_instance=RequestContext(request) > > Thanks. So I have to add this everytime I return render_to_response? I > thought I only add

Re: url pattern - allow null

2009-04-03 Thread Malcolm Tredinnick
On Fri, 2009-04-03 at 17:56 -0700, TheIvIaxx wrote: > I have an object that will be viewed, edited, or added. I would like > to give a url for edit/add but default to view if nothing is given. > For example: > > http://www.example.com/page/edit --> Goes to edit page template > http://www.example

Re: Cannot reverse inside urls.py

2009-04-03 Thread Malcolm Tredinnick
On Fri, 2009-04-03 at 21:07 -0400, Alex Gaynor wrote: [...] > A lazy reverse shouldn't be too difficult to implement in your own > code though: > > from django.utils.functional import lazy > reverse_lazy = lazy(reverse, str) This would have to be "unicode", not "str", since reverse() really retu

Re: Search in multiple models

2009-04-03 Thread Malcolm Tredinnick
On Fri, 2009-04-03 at 21:54 +0200, Alex Rades wrote: > Hi, > I'm developing a simple site which has 2 basic models: Article and > StaticPage (not using flatpages since i have some custom fields > attached). > > Now, I need to create a search form which should search among both > articles and stat

Re: Reacting to browser closing the socket

2009-04-03 Thread Malcolm Tredinnick
On Sat, 2009-04-04 at 00:22 +0200, Marcus Weseloh wrote: > Hello again, > > I think I solved my problem (at least for the development server) by > monkey patching django.core.servers.basehttp.ServerHandler. Does > anybody know of any horrible side effects this might have, or can > suggest a more

Re: Cannot reverse inside urls.py

2009-04-03 Thread Malcolm Tredinnick
On Fri, 2009-04-03 at 01:24 -0700, robin wrote: > It seems like you cannot use reverse within urls.py > > url(r'^add/$','items.views.add_item_wizard',name='add_item_wizard'), > > url(r'^add/complete/ > $','django.views.generic.simple.direct_to_template',{ > 'template':'message.html', >

Re: Database error in Django

2009-04-03 Thread Malcolm Tredinnick
On Fri, 2009-04-03 at 04:39 -0700, Praveen wrote: > def queryset(self, request): > qs = super(EventAdmin, self).queryset(request) > if not request.user.is_superuser: > qs = qs.filter(city=request.user.get_profile().res_city) > r

Re: Performance Issue: ForeignKey will touch database again!

2009-04-03 Thread Malcolm Tredinnick
On Fri, 2009-04-03 at 01:14 -0700, Zeal wrote: > Thanks Malcolm, I think I've find the issue. I set time.time() to > test several steps in my program, retrieving data is pretty fast, the > entire function spent 6s to finish the task. However, at the final > stage on template rendering, seems Exp

Re: Can I just put user id in session for authorization purpose?

2009-04-03 Thread Malcolm Tredinnick
On Fri, 2009-04-03 at 01:41 -0700, Zeal wrote: > I'm a newbie, I've been using Django to develop an application. The > entire application need to be based on an authorization mechnism. As > of my current programe, I just put user's id in session when they log > in, and there is a authorization dec

Re: Quick noob question regarding the admin interface ...

2009-04-03 Thread Malcolm Tredinnick
On Fri, 2009-04-03 at 09:35 +0100, Mic Pringle wrote: > Hi, > > I've been googling this for a while but can't seem to find any > relevant information. > > Is it possible to utilise the admin interface without requiring > authorisation ? Is it as simple as not including the authorisation > module

Re: Authorization on data level in django admin

2009-04-02 Thread Malcolm Tredinnick
On Thu, 2009-04-02 at 22:34 -0700, Joshua Partogi wrote: > On Apr 3, 11:23 am, Malcolm Tredinnick > wrote: > > On Fri, 2009-04-03 at 00:26 +1100, Joshua Partogi wrote: > > > Dear all, > > > > > In django admin we can give permission to user to edit, delete or

Re: how to use email instead of username for user authentication?

2009-04-02 Thread Malcolm Tredinnick
On Thu, 2009-04-02 at 19:04 -0700, Timboy wrote: > What's the best way to add users with an auto generating username? ie: > Taub.John, Smith.Tim, Smith.Tim2 You can do it however you like, since the user will never see it. Something as simple as taking the email address, replacing "@" with "AT" a

Re: What is the best way to extend the User Model

2009-04-02 Thread Malcolm Tredinnick
On Thu, 2009-04-02 at 18:29 -0700, Dave Fowler wrote: [...] > Profile.objects.all().select_related() > > But it seems weird to base everything around the object that isn't > used for authentication. Is that what most people do? "Seems weird" isn't a particularly strong technical reason (and is

Re: Authorization on data level in django admin

2009-04-02 Thread Malcolm Tredinnick
On Fri, 2009-04-03 at 00:26 +1100, Joshua Partogi wrote: > Dear all, > > In django admin we can give permission to user to edit, delete or > create certain model. But what I want to do now is a user can only > edit or delete the data that he/she created. > > Is there any way we can do this in dj

Re: Performance Issue: ForeignKey will touch database again!

2009-04-02 Thread Malcolm Tredinnick
On Thu, 2009-04-02 at 00:46 -0700, Zeal wrote: > > > On 4月2日, 下午2时39分, Alex Koshelev wrote: > > On Thu, Apr 2, 2009 at 10:36 AM, Zeal wrote: > > > > > > Documentation knows [1] > > > > [1]:http://docs.djangoproject.com/en/dev/ref/models/querysets/#id4 > > Hi, Alex, > > Really appreciates you

Re: Logging out a user when his account is made inactive

2009-04-02 Thread Malcolm Tredinnick
On Wed, 2009-04-01 at 14:13 -0700, christian.oudard wrote: > I have made a page for admins to set a user account to inactive, but I > noticed that the user's session continues if he is logged in. It > appears that the is_active field is only checked when the user logs > in, not when each request i

<    1   2   3   4   5   6   7   8   9   10   >