Model field validation available in 0.96 but removed in 1.0?

2009-03-19 Thread Crispin Wellington
Hey there. I want to add a custom validator to a model field. In django 0.96 there was the validator_list parameter that could easily do this for me. Now it is no more. Also django.core.validators is gone. How do I add a custom validator to a form field now? I want to ensure that that a FloatFie

Re: Map events in space on a django app

2009-03-19 Thread Andy Mckay
On 19-Mar-09, at 5:29 PM, Alessandro wrote: > I'm looking for some documentation, but it seems not too simple. > it should be very easier if someone shared a sample simple app using > django.contrib.gis You need two fields on a model, longitude and latitude. The rest of it is pure Javascript

Re: Permission model's CharField fields, name and codename, too short

2009-03-19 Thread Malcolm Tredinnick
On Thu, 2009-03-19 at 21:58 -0400, Giovannetti, Mark wrote: > Hi Everyone, > > Has anyone else run across this? I tried to enter it as > a ticket at: > > http://code.djangoproject.com/simpleticket > > but was mistaken for a spammer. ;-) You need to register then, as it says in the big colo

Re: Map events in space on a django app

2009-03-19 Thread Vasil Vangelovski
If you don't need any spatial related queries (although django people uses something like that) you don't really need a spatial database. You can store geographic coordinates in either FloatFields or CharFields. Your question is more related to GoogleMaps API than django. I'm assuming you

Permission model's CharField fields, name and codename, too short

2009-03-19 Thread Giovannetti, Mark
Hi Everyone, Has anyone else run across this? I tried to enter it as a ticket at: http://code.djangoproject.com/simpleticket but was mistaken for a spammer. ;-) Django versions 1.0.x through 1.1 alpha 1, PostgreSQL 8.3.5, Python 2.5.2 django/contrib/auth/models.py I have long model names

Re: Can't import flup.server.fcgi

2009-03-19 Thread coffeepunk
> This has been reported as ticket #10556 earlier today. It will be fixed > in the next few hours, I suspect. So back up a few versions for now or > apply the patch in that ticket manually. Sweet! I've been looking around like crazy, searching on google and djangoproject but without finding any

Re: Map events in space on a django app

2009-03-19 Thread Alessandro
On Fri, Mar 20, 2009 at 12:42 AM, Alex Gaynor wrote: >> I thought geo django is too much complex for what I need. I don't need >> to calculate spatial areas, only to store the gps coordinates of a >> point and publish them in a google map, like django people does. >> I'm looking for some docume

Re: Can't import flup.server.fcgi

2009-03-19 Thread Malcolm Tredinnick
On Thu, 2009-03-19 at 16:55 -0700, coffeepunk wrote: > Heya, > > I'm getting the following error when I try to run the ./manage.py > funfcgi only or with various options, the result is the same. > > Can't import flup.server.fcgi > > The error occur with 1.1 alpha 1 SVN-10091 and not with 1.1 al

Re: Crazy error with utf-8 & apache (please help!)

2009-03-19 Thread Ian Kelly
On Mar 19, 4:55 pm, elm wrote: > I have bee trying to deal with an erratic error for the last 3 day. I > hope you can rescue me!!! > > After experiencing erratic errors that appeared from time to time on a > larger project (i.e. ViewDoesNotExist) I have reduced my project to a > very simple appli

Can't import flup.server.fcgi

2009-03-19 Thread coffeepunk
Heya, I'm getting the following error when I try to run the ./manage.py funfcgi only or with various options, the result is the same. Can't import flup.server.fcgi The error occur with 1.1 alpha 1 SVN-10091 and not with 1.1 alpha 1 SVN-9910 which was the previous version I had installed and now

Re: Using _default_manager in a model causes many idle MySQL connections. (Django 1.0)

2009-03-19 Thread MikeL
I wasn't sure where this stuff was being tracked, but I did find a circular reference in the database wrapper. The DatabaseCreation and DatabaseIntrospection objects being created in the MySQL wrapper where passing references of itself, but there wasn't a per-defined method for removing those refe

Re: Map events in space on a django app

2009-03-19 Thread Alex Gaynor
On Thu, Mar 19, 2009 at 7:41 PM, Alessandro wrote: > > On Thu, Mar 19, 2009 at 9:08 PM, Alex Gaynor > wrote: > > > Geo Django has a lot of tools for working with maps and geographic data, > you might want to look at it: http://geodjango.org/ . > > > > I thought geo django is too much complex for

Re: Map events in space on a django app

2009-03-19 Thread Alessandro
On Thu, Mar 19, 2009 at 9:08 PM, Alex Gaynor wrote: > Geo Django has a lot of tools for working with maps and geographic data, you > might want to look at it: http://geodjango.org/ . > I thought geo django is too much complex for what I need. I don't need to calculate spatial areas, only to st

Re: customizing admin interface: showing descriptive names for objects

2009-03-19 Thread Alex Gaynor
On Thu, Mar 19, 2009 at 7:36 PM, Nate Reed wrote: > On Thu, Mar 19, 2009 at 4:29 PM, Alex Gaynor wrote: > >> >> >> On Thu, Mar 19, 2009 at 7:21 PM, Nate Reed wrote: >> >>> I'm working on an admin interface for my app, and wondering how to >>> customize what gets displayed. >>> >>> Under Home->MyM

Re: customizing admin interface: showing descriptive names for objects

2009-03-19 Thread Nate Reed
On Thu, Mar 19, 2009 at 4:29 PM, Alex Gaynor wrote: > > > On Thu, Mar 19, 2009 at 7:21 PM, Nate Reed wrote: > >> I'm working on an admin interface for my app, and wondering how to >> customize what gets displayed. >> >> Under Home->MyModels->MyModels, MyModel instances are listed as "MyModel >>

Re: customizing admin interface: showing descriptive names for objects

2009-03-19 Thread Alex Gaynor
On Thu, Mar 19, 2009 at 7:21 PM, Nate Reed wrote: > I'm working on an admin interface for my app, and wondering how to > customize what gets displayed. > > Under Home->MyModels->MyModels, MyModel instances are listed as "MyModel > object." When editing another model, the foreign key reference to

Re: form.save_m2m and intermediary models

2009-03-19 Thread Delta20
On Mar 19, 6:50 pm, Malcolm Tredinnick wrote: > The error is telling you exactly what the problem is. You can't do the > automatic assignment to many-to-many relations that use an intermediate > table. The reason being that the whole point of an intermediate table is > that it has *extra* informa

customizing admin interface: showing descriptive names for objects

2009-03-19 Thread Nate Reed
I'm working on an admin interface for my app, and wondering how to customize what gets displayed. Under Home->MyModels->MyModels, MyModel instances are listed as "MyModel object." When editing another model, the foreign key reference to MyModel gets displayed as a list of: MyModel object MyModel

Crazy error with utf-8 & apache (please help!)

2009-03-19 Thread elm
I have bee trying to deal with an erratic error for the last 3 day. I hope you can rescue me!!! After experiencing erratic errors that appeared from time to time on a larger project (i.e. ViewDoesNotExist) I have reduced my project to a very simple application that runs on apache with mod_python

Re: form.save_m2m and intermediary models

2009-03-19 Thread Malcolm Tredinnick
On Thu, 2009-03-19 at 14:21 -0700, Delta20 wrote: > I'm getting the error "Cannot set values on a ManyToManyField which > specifies an intermediary model." when I try to call form.save_m2m() > and I would appreciate any tips as to how to work around this. The error is telling you exactly what the

Re: accessing related fields of model

2009-03-19 Thread Malcolm Tredinnick
On Thu, 2009-03-19 at 13:20 -0700, adrian wrote: > > The doc gives this example for querying an Entry model which has a > foreign key field to a Blog model. > > e = Entry.objects.get(id=2) > e.blog = some_blog > > Fine. Now if I do it in a loop like this: > > e = Entry.objects.all() > for ent

Re: Dynamic app_label

2009-03-19 Thread Malcolm Tredinnick
On Thu, 2009-03-19 at 12:53 -0700, Dan wrote: > Hi all, > > Is there a way to set app_label in the model Meta class dynamically? > I'm trying to break up my models into separate files which now (as I > understand) requires that each model specify it's app explicitly. > However, I'd like to have m

Re: accessing related fields of model

2009-03-19 Thread Daniel Roseman
On Mar 19, 8:20 pm, adrian wrote: > The doc gives this example for querying an Entry model which has a > foreign key field to a Blog model. > > e = Entry.objects.get(id=2) > e.blog = some_blog > > Fine.  Now if I do it in a loop like this: > > e = Entry.objects.all() > for entry in e: >     entry

Re: Signals, sites and instances

2009-03-19 Thread TiNo
You could do this in the save method. If the News_item is newly created, it's id will not be set, so to assure it only happens on creation, you could use this code: if self.id is None: do your stuff... Tino On Thu, Mar 19, 2009 at 6:19 PM, Baxter wrote: > > Talking with Andy more on IRC, i

Re: hashed file name on ImageField

2009-03-19 Thread Chris Van Horne
Seems I found a way around this by overriding the 'save' method on the model which has the ImageField. On Mar 19, 1:11 pm, Chris Van Horne wrote: > Hello, > > I am looking to modify ImageField so that the filename saved to disk > is a hashed (sha1 or md5) digest. I have looked at the documentati

Re: form.save_m2m and intermediary models

2009-03-19 Thread Delta20
I forgot to add: the full error message is: "Cannot set values on a ManyToManyField which specifies an intermediary model. Use SystemTicket's Manager instead." I'm not sure how I'd use the manager in this particular case though. On Mar 19, 5:21 pm, Delta20 wrote: > I'm getting the error "Can

form.save_m2m and intermediary models

2009-03-19 Thread Delta20
I'm getting the error "Cannot set values on a ManyToManyField which specifies an intermediary model." when I try to call form.save_m2m() and I would appreciate any tips as to how to work around this. Here's some code that illustrates what I am doing: --- # Using a basic form in a view function:

Error of Bad file descriptor

2009-03-19 Thread arbi
Hi, I use geopy (a python module) that geocodes addresses. It works on my computer, but badly on internet. I don't know why. I got a "Bad file descriptor" errors sometimes. Here is my traceback : Environment: Request Method: POST Request URL: http://antrive.alwaysdata.net/routes/index/result/

Re: Using _default_manager in a model causes many idle MySQL connections. (Django 1.0)

2009-03-19 Thread Alex Gaynor
On Thu, Mar 19, 2009 at 5:06 PM, MikeL wrote: > > I'm using the code from: > > http://www.eflorenzano.com/blog/post/easy-multi-database-support-django/ > > After repeated use, there can be over a hundred idling connection to > MySQL for both production and development builds. Removing the > Multi

Using _default_manager in a model causes many idle MySQL connections. (Django 1.0)

2009-03-19 Thread MikeL
I'm using the code from: http://www.eflorenzano.com/blog/post/easy-multi-database-support-django/ After repeated use, there can be over a hundred idling connection to MySQL for both production and development builds. Removing the Multiple DB in the model causes the symptoms to stop. I've been t

Re: Django-Tagging not working with Oracle

2009-03-19 Thread Ian Kelly
On Mar 19, 9:21 am, Brandon Taylor wrote: > Hi Everyone, > > I'm using the svn checkout of Django-Tagging and Django-Trunk. Tagging > is working perfectly for me with any other database except, of course, > Oracle, which is what I need it to work in. > > I can't get the TagField() to show up in t

hashed file name on ImageField

2009-03-19 Thread Chris Van Horne
Hello, I am looking to modify ImageField so that the filename saved to disk is a hashed (sha1 or md5) digest. I have looked at the documentation and it seemed to point me towards subclassing django.core.files.storage.Storage but I haven't had any luck--worse, I'm not sure if this is the "correct"

Re: Guys, anyone get working Firebird database backend?

2009-03-19 Thread mariuz
On Mar 17, 5:07 am, brawaga wrote: > Guys, who even got Django-to-Firebirddatabase backend working, or > knows how to, tell me please, how I can retrieve valid one? Maybe, > there is guru who knows a common structure of the backend? In this > case I can write it myself, maybe. I am finally tire

Re: accessing related fields of model

2009-03-19 Thread adrian
I found a serializer that can follow foreign key fields, which solves my problem. http://code.google.com/p/wadofstuff/wiki/DjangoFullSerializers But I would still like to understand if someone cares to answer! I think this should be in the documentation also. On Mar 19, 3:20 pm, adrian wrote

accessing related fields of model

2009-03-19 Thread adrian
The doc gives this example for querying an Entry model which has a foreign key field to a Blog model. e = Entry.objects.get(id=2) e.blog = some_blog Fine. Now if I do it in a loop like this: e = Entry.objects.all() for entry in e: entry.blog = some_blog #do stuff here with Entry and B

Re: Map events in space on a django app

2009-03-19 Thread Alex Gaynor
On Thu, Mar 19, 2009 at 4:07 PM, Alessandro Ronchi < alessandro.ron...@soasi.com> wrote: > I need to make a website that permits users to put warnings of dangerous > points in a city map. > > Users should drag a signal on a street map and put text of the warning, and > then send them to the server

Map events in space on a django app

2009-03-19 Thread Alessandro Ronchi
I need to make a website that permits users to put warnings of dangerous points in a city map. Users should drag a signal on a street map and put text of the warning, and then send them to the server. The site should presents them in a navigable map, like it does http://djangopeople.net/ is ther

Dynamic app_label

2009-03-19 Thread Dan
Hi all, Is there a way to set app_label in the model Meta class dynamically? I'm trying to break up my models into separate files which now (as I understand) requires that each model specify it's app explicitly. However, I'd like to have my __init__.py in my models package handle this for me. Ex

Re: custom validation (clean_) based on image height and width

2009-03-19 Thread Michael A. Repucci
Perfect. Thank you! On Thu, Mar 19, 2009 at 3:36 PM, Alex Gaynor wrote: > > > On Thu, Mar 19, 2009 at 3:31 PM, Michael Repucci wrote: > >> >> I'm struggling with what seems like should be a very straightforward >> task. I have a model with a field named image of type ImageField, and >> I'd like

Re: custom validation (clean_) based on image height and width

2009-03-19 Thread Alex Gaynor
On Thu, Mar 19, 2009 at 3:31 PM, Michael Repucci wrote: > > I'm struggling with what seems like should be a very straightforward > task. I have a model with a field named image of type ImageField, and > I'd like to do custom validation via the model form's clean_image > method based on the height

Re: Django form: Allow user to insert a date in dd-mm-yyyy format and then convert in yyyy-mm-dd

2009-03-19 Thread Adi Sieker
On 18.03.2009, at 20:48, MarcoS wrote: > > Thanks for your replies, Koeb and Ady. > > Ady, if I understood I've to place the code from > > http://code.djangoproject.com/attachment/ticket/3672/ticket%233672--patch-test.diff > > to > > - python/site-packages/django/forms/forms.py and > - python/sit

custom validation (clean_) based on image height and width

2009-03-19 Thread Michael Repucci
I'm struggling with what seems like should be a very straightforward task. I have a model with a field named image of type ImageField, and I'd like to do custom validation via the model form's clean_image method based on the height and width (in pixels) of the image. If I just grab the image obje

Re: admin: search generic relation?

2009-03-19 Thread patrickk
hmmm, what about defining a custom search_method? is that possible? maybe with using a Custom Manager? On 19 Mrz., 19:59, Alex Gaynor wrote: > On Thu, Mar 19, 2009 at 12:37 PM, patrickk wrote: > > > is there any way to search for a "content_object" within the change- > > list? > > > my model:

Re: admin: search generic relation?

2009-03-19 Thread Alex Gaynor
On Thu, Mar 19, 2009 at 12:37 PM, patrickk wrote: > > is there any way to search for a "content_object" within the change- > list? > > my model: > > class Trailer(models.Model): >... >content_type = models.ForeignKey(ContentType) >object_id = models.PositiveIntegerField() >content

Re: update facebook status

2009-03-19 Thread Baxter
On Mar 19, 1:34 pm, "Shantanoo Mahajan (शंतनू महाजन)" wrote: > you may > findhttp://wiki.developers.facebook.com/index.php/PythonPyFacebookTutorial >   useful. thanks. I'm not sure that's what I'm after, though. I don't really want to create a facebook app, just update status on the single pa

Re: Editing base_site.html

2009-03-19 Thread Frank Wiles
On Tue, Mar 17, 2009 at 9:45 AM, TP wrote: > > How would people recommend me to do this? > > By editing the base_site.html file in text editor? > > By creating my own html page called base_site.html and putting it in > the right Dir? The best way is to copy the existing version into your own tem

Re: update facebook status

2009-03-19 Thread Shantanoo Mahajan (शंतनू महाजन)
On 19-Mar-09, at 11:17 PM, bax...@gretschpages.com wrote: > > Now that I've got my twitter integration sorted out, I'm trying to > figure out how to update the facebook status, too. Twitter was > relatively easy. Can someone point me to the how-to on updating > facebook? The catch: it's the sta

update facebook status

2009-03-19 Thread bax...@gretschpages.com
Now that I've got my twitter integration sorted out, I'm trying to figure out how to update the facebook status, too. Twitter was relatively easy. Can someone point me to the how-to on updating facebook? The catch: it's the status on a product page, not a profile. --~--~-~--~~

Re: add https to django

2009-03-19 Thread Vasil Vangelovski
I'd recommend you use all the power of your webserver for this (apache or nginx or whatever). There should be no specific modifications on the django site if you do it right. I think this gui has the fix for what you asked tho: http://hotsyk.com/blog/2008/11/05/https-django-and-wsgi/ On Thu, Mar

How to properly use limit_choices_to on self-joins

2009-03-19 Thread Laran Evans
I have a Company class. A Company has many Clients, each of which is also a Company. The problem I have is that in the auto-generated Admin site, the Clients show up as a multi-select with the Company in the select box. This doesn't make sense, because a company can't select itself as a client. S

Re: model already registered error

2009-03-19 Thread ikalooby
I am guessing that you created an admin.py but still have the admin class registered in the models.py ? In which case remove and restart the dev server. On Mar 18, 7:45 am, nixon66 wrote: > I just redid my models in an application and ran "manage.py > runserver". But when I tried to log into th

add https to django

2009-03-19 Thread djanm...@gmail.com
Dear all, to add 'https' to my application, I followed this steps "http:// www.djangosnippets.org/snippets/240/", and i add {ssl:true} to urls of admin, but when from browser i acess to the http://ip:8000/admin/ i have redirection to https://ip:8000/admin/ and not acess "transfert of data are in

Re: Signals, sites and instances

2009-03-19 Thread Baxter
Talking with Andy more on IRC, it looks like I can't do what I want to do, unless maybe there's some way to pass the request on to the signal. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To p

Re: Need two response statements on same def

2009-03-19 Thread Jesse
Thanks everyone for the suggestions! I will get started on redoing the functions and views. On Mar 19, 9:29 am, Andy Mckay wrote: > On 19-Mar-09, at 8:35 AM, Jesse wrote: > > > My concern is that each view has 87 lines of duplicate code from the > > "GET" data to get the appended list (shown h

admin: search generic relation?

2009-03-19 Thread patrickk
is there any way to search for a "content_object" within the change- list? my model: class Trailer(models.Model): ... content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() content_object = generic.GenericForeignKey() ... now, I´d like to do

Re: Signals, sites and instances

2009-03-19 Thread Baxter
On Mar 19, 11:28 am, Andy Mckay wrote: > Well I would have lots of questions there, some real code might help,   > not sure we have enough info. But lets start with what signal are you   > trying to catch (theres a few different ones)? Thanks Andy. In the model I've got: class News_item(models

Re: Need two response statements on same def

2009-03-19 Thread Andy Mckay
On 19-Mar-09, at 8:35 AM, Jesse wrote: > My concern is that each view has 87 lines of duplicate code from the > "GET" data to get the appended list (shown here as: data retrieved to > create a list .list.append(publications)). Anytime I make a > change in one view I have to remember to make

Re: Signals, sites and instances

2009-03-19 Thread Andy Mckay
On 19-Mar-09, at 7:59 AM, bax...@gretschpages.com wrote: > So what can I do? Is the POST info available to the signal maybe? Well I would have lots of questions there, some real code might help, not sure we have enough info. But lets start with what signal are you trying to catch (theres a f

Selecting a parent in admin for a child model?

2009-03-19 Thread Wyley
Hi all, I have a quick question about editing instances of child models in the admin interface. I have a couple of models which derive from a (non- abstract) parent model, thusly: class Contact(models.Model): first_name = models.CharField(...) last_name = models.CharField(...) # etc

Re: Need two response statements on same def

2009-03-19 Thread Daniel Roseman
On Mar 19, 3:35 pm, Jesse wrote: > My concern is that each view has 87 lines of duplicate code from the > "GET" data to get the appended list (shown here as: data retrieved to > create a list .list.append(publications)).  Anytime I make a > change in one view I have to remember to make the ch

Re: Need two response statements on same def

2009-03-19 Thread Baxter
Pass something in the request, like ?output=csv Then look for it in the view and feed the appopriate version. On Mar 19, 10:35 am, Jesse wrote: > My concern is that each view has 87 lines of duplicate code from the > "GET" data to get the appended list (shown here as: data retrieved to > create

Re: Strategy for extending DB tables with additional columns

2009-03-19 Thread Frank Wiles
On Mon, Mar 16, 2009 at 11:36 AM, Trey wrote: > > Hello everyone, I am hoping someone has some experience in this > already. I have a rough idea of how to do it, but I am hoping to > discover a better way. > > What I have: > A contact manager. A contact has a set of data that makes sense on > any

Re: Need two response statements on same def

2009-03-19 Thread Jesse
My concern is that each view has 87 lines of duplicate code from the "GET" data to get the appended list (shown here as: data retrieved to create a list .list.append(publications)). Anytime I make a change in one view I have to remember to make the change in the other view. Since I'm fairly

Django-Tagging not working with Oracle

2009-03-19 Thread Brandon Taylor
Hi Everyone, I'm using the svn checkout of Django-Tagging and Django-Trunk. Tagging is working perfectly for me with any other database except, of course, Oracle, which is what I need it to work in. I can't get the TagField() to show up in the admin at all without adding a custom form for my Mod

Signals, sites and instances

2009-03-19 Thread bax...@gretschpages.com
Follow up to my earlier question (http://groups.google.com/group/ django-users/browse_thread/thread/8f41540343634178/c05242e6d3b07d62) As I mentioned there, I'm trying to use a snippet to send a twitter update when a news item is created. The news items have a M2M relationship with sites-- news c

Re: Test Client doesn't populate request.META["HTTP_HOST"] ...

2009-03-19 Thread Ramiro Morales
On Thu, Mar 19, 2009 at 11:40 AM, Johan wrote: > >  Given: > from django.test.client import Client c = Client() c.post('/register/',{username=username,password=password}) > > Traceback (most recent call last): > ... > KeyError: 'HTTP_HOST' > > Part of the register view  code contai

Re: Test Client doesn't populate request.META["HTTP_HOST"] ...

2009-03-19 Thread Jacob Kaplan-Moss
On Thu, Mar 19, 2009 at 9:40 AM, Johan wrote: > Am I using the wrong construct? If so how do I get around this > problem? :: >>> c.post('/register/', data, HTTP_HOST='example.com') Jacob --~--~-~--~~~---~--~~ You received this message because you are subscr

Test Client doesn't populate request.META["HTTP_HOST"] ...

2009-03-19 Thread Johan
Hiya, Given: >>> from django.test.client import Client >>> c = Client() >>> c.post('/register/',{username=username,password=password}) Traceback (most recent call last): ... KeyError: 'HTTP_HOST' Part of the register view code contains the following: ... request.META["HTTP_HOST"] ... Th

Pixidou and Django

2009-03-19 Thread Oni
Hi guys. Has anyone used this: http://htmlblog.net/pixidou-an-open-source-ajax-image-editor-php-and-yui-based/ ... with Django? Im trying to get a picture uploaded to a temp store, have that photo edited and then saved in its edited form? So far, customising the admin views seems simple enough,

Re: Value proposition of Rails

2009-03-19 Thread Wes Winham
It's also important to note the architectural differences between Java and your favorite LAMP flavor. LAMP is generally a "shared nothing" situation where scaling out is a matter of just adding more machines with some transparent load balancing (on the non-database side). Java scaling tends toward

Re: How do I 'redirect' in my test code after a 301 response?

2009-03-19 Thread Johan
Thanks ... I'd din't see the follow parameter. It works like a charm.. :) On Mar 19, 3:38 pm, Alex Gaynor wrote: > On Thu, Mar 19, 2009 at 9:22 AM, Johan wrote: > > > Hiya, > > >  I trying to write test code for my views. I am using the following > > approach. > > > >>>from django.test.client i

Re: request object needed in form methods

2009-03-19 Thread Thomas Guettler
>> Why not store the request >> object (in a thread safe way) on module level? ... > The biggest con is encourages bad design practices, the way Python works is > you have a global and local scope, if you want something in your local scope > you pass it to it. > > If you really want to have the r

Re: request object needed in form methods

2009-03-19 Thread Daniel Roseman
On Mar 19, 1:22 pm, Thomas Guettler wrote: > Hi, > > I know that you can pass the request object to form like this: > > class MyForm(forms.Form): >     def __init__(self, request, *args, **kwargs): >         self.request=request >         forms.Form.__init__(self, *args, **kwargs) > > Somehow I a

Re: Unicode issue with Oracle

2009-03-19 Thread João Olavo Baião de Vasconcelos
On 1/27/09, Karen Tracey wrote: > Don't use cx_Oracle 5.0, use a 4.X version. The docs were recently changed > to specify that, after investigation into > http://code.djangoproject.com/ticket/9935 revealed the problem is due to a > bug in cx_Oracle 5.0. Just for the record: this bug doesn't exi

Re: Adding a field to a form during runtime

2009-03-19 Thread Preston Timmons
Hi Marek, I think that your problem is that the make_car_form function returns a form class rather than an instance of that class. Once you have the class you still need to make an instance of it. Something like this might work: form_class = make_car_form(True) carForm = form_class() Preston

Re: Getting logged in username in admin

2009-03-19 Thread Alex Gaynor
On Thu, Mar 19, 2009 at 9:32 AM, Joshua Partogi wrote: > > Dear all, > > How do I get the current logged in user to be used and inserted to a model? > from django.db import models > from django.contrib.auth.models import User > > class News(models.Model): >creator = models.ForeignKey(User) > >

Re: request object needed in form methods

2009-03-19 Thread Alex Gaynor
On Thu, Mar 19, 2009 at 9:22 AM, Thomas Guettler wrote: > > Hi, > > I know that you can pass the request object to form like this: > > class MyForm(forms.Form): >def __init__(self, request, *args, **kwargs): >self.request=request >forms.Form.__init__(self, *args, **kwargs) > >

Re: How do I 'redirect' in my test code after a 301 response?

2009-03-19 Thread Alex Gaynor
On Thu, Mar 19, 2009 at 9:22 AM, Johan wrote: > > Hiya, > > I trying to write test code for my views. I am using the following > approach. > > >>>from django.test.client import Clien > >>>c = Client() > >>>c.get('/courses/system/home').status_code > 301 > > The question is now: How do I 'redire

Newbie to Novice – Using Admin DateTime Picker in your Form

2009-03-19 Thread Paul Nema
I've noticed many people new to Django (and sometimes also new to Python) often post the same/similar questions in various forums. How to I get something to work and/or do you have an example for X. As I've also experienced this problem I've decided to post my little solution. Its not the only way

Getting logged in username in admin

2009-03-19 Thread Joshua Partogi
Dear all, How do I get the current logged in user to be used and inserted to a model? from django.db import models from django.contrib.auth.models import User class News(models.Model): creator = models.ForeignKey(User) I want the creator field to be the current logged in user. Thank you ve

request object needed in form methods

2009-03-19 Thread Thomas Guettler
Hi, I know that you can pass the request object to form like this: class MyForm(forms.Form): def __init__(self, request, *args, **kwargs): self.request=request forms.Form.__init__(self, *args, **kwargs) Somehow I am tired of rewriting this. Why not store the request object (

How do I 'redirect' in my test code after a 301 response?

2009-03-19 Thread Johan
Hiya, I trying to write test code for my views. I am using the following approach. >>>from django.test.client import Clien >>>c = Client() >>>c.get('/courses/system/home').status_code 301 The question is now: How do I 'redirect' in my code? I would expect something along the lines of: >>>

Re: Sort of OT on the django book

2009-03-19 Thread Gour
> "James" == James Bennett writes: James> Well, what's not welcome is being asked the same question over James> and over again when the publication date's listed on the Amazon James> page for anyone and everyone to look at ;) Well, the context of the question was announcement about django's

Re: Sort of OT on the django book

2009-03-19 Thread brad
On Mar 19, 2:03 am, James Bennett wrote: > Well, what's not welcome is being asked the same question over and > over again when the publication date's listed on the Amazon page for > anyone and everyone to look at ;) Which just happens to be June 1, 2009. --~--~-~--~~~

Re: Adding a field to a form during runtime

2009-03-19 Thread Thomas Guettler
Sorry, I can't help you here, since I don't create classes at runtime (*). I think using __init__() is better, and I guess you can solve your problem with it, too. (*) type('ContactForm', (forms.BaseForm, ), { 'base_fields': fields}) Marek W schrieb: > Thanks for your response. Probably the reas

Re: Testing

2009-03-19 Thread Filip Gruszczyński
I see. Thanks a lot. 2009/3/19 Preston Timmons : > > Hi Filip, > The Django test runner looks for tests in two places in an > application--the models.py file and an optional tests.py file. If you > want to run tests for your views you can move your tests into a file > called tests.py in your appl

Re: Value proposition of Rails

2009-03-19 Thread Brian Morton
Given how expensive developer time is relative to current hardware costs (especially on the x86 server platforms), it is almost always more cost effective to throw hardware at the problem than it is to spend countless hours porting apps from one language or framework to another for performance rea

Re: Forms: custom clean for DateField

2009-03-19 Thread johan . uhle
> if (data['firstDate'] >= data['lastDate']): > raise ValidationError("Error") it should read raise forms.ValidationError If you want to have the error not only as a non_field global error, but actually added to the fields where the error occured, you can do the following in

Re: django choises field

2009-03-19 Thread Psihonavt
Briel, I ubderstand what you want to say, i'll try to find another way. thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.co

Re: Value proposition of Rails

2009-03-19 Thread James Bennett
On Thu, Mar 19, 2009 at 2:53 AM, Torsten Bronger wrote: > Okay, C.  Well, most of the library and framework stuff is missing > but I assume that this could be done, given that the financial > benefit is there.  But actually I still don't get your analogy. You asked, basically, "since Java is fas

Re: Value proposition of Rails

2009-03-19 Thread Torsten Bronger
Hallöchen! James Bennett writes: > On Thu, Mar 19, 2009 at 2:35 AM, Torsten Bronger > wrote: > >> I think is *is* a nightmare to maintain. At least, Java and PHP >> play in the same league of maintainability, whereas assembly is >> *far* away from that. > > OK, then, why not write everything i

Re: Value proposition of Rails

2009-03-19 Thread Malcolm Tredinnick
On Thu, 2009-03-19 at 08:17 +0100, Torsten Bronger wrote: > Hallöchen! > > Malcolm Tredinnick writes: > > > [...] > > > > Even PHP: I mean, Flickr, Wikipedia, Yahoo -- these are some > > pretty large sites running on PHP. > > I've always wondered why anybody uses something non-Java for Web > ap

Re: Value proposition of Rails

2009-03-19 Thread James Bennett
On Thu, Mar 19, 2009 at 2:35 AM, Torsten Bronger wrote: > I think is *is* a nightmare to maintain.  At least, Jva and PHP play > in the same league of maintainability, whereas assembly is *far* > away from that. OK, then, why not write everything in C? Hard to get faster than C without doing ass

Re: Value proposition of Rails

2009-03-19 Thread Torsten Bronger
Hallöchen! James Bennett writes: > On Thu, Mar 19, 2009 at 2:17 AM, Torsten Bronger > wrote: > >> I've always wondered why anybody uses something non-Java for Web >> applications. Given that Java is faster than PHP, Python etc., >> this also means that you need less computing power in your ser

Re: Value proposition of Rails

2009-03-19 Thread James Bennett
On Thu, Mar 19, 2009 at 2:17 AM, Torsten Bronger wrote: > I've always wondered why anybody uses something non-Java for Web > applications.  Given that Java is faster than PHP, Python etc., this > also means that you need less computing power in your server farm. > On the long run, this should *al

Re: Value proposition of Rails

2009-03-19 Thread Torsten Bronger
Hallöchen! Malcolm Tredinnick writes: > [...] > > Even PHP: I mean, Flickr, Wikipedia, Yahoo -- these are some > pretty large sites running on PHP. I've always wondered why anybody uses something non-Java for Web applications. Given that Java is faster than PHP, Python etc., this also means th

Re: Sort of OT on the django book

2009-03-19 Thread James Bennett
On Thu, Mar 19, 2009 at 1:55 AM, Gour wrote: > Don't ask this question. I asked him on #django (several times), and > found out that such sort of inquiry is not very welcome ;) Well, what's not welcome is being asked the same question over and over again when the publication date's listed on the