MultiValueDictKeyError on Image Uploading

2010-08-24 Thread nitin shrimali
Hello Guys, I am using a file uploading control in my form. On specifying some content in that it is working fine but on leaving it blank it is throwing an error saying that:-- Exception Type: MultiValueDictKeyError Exception Value: Key 'image' not found in Exception Location:

Re: method on the User model?

2010-08-24 Thread Sam Lai
You need to look at SQL aggregates. See here - http://docs.djangoproject.com/en/dev/topics/db/aggregation/ On 25 August 2010 14:44, Joel Klabo wrote: > I am trying to find a way to get a list of users ranked by the most > "drinks". The drink model has a User field so I am

method on the User model?

2010-08-24 Thread Joel Klabo
I am trying to find a way to get a list of users ranked by the most "drinks". The drink model has a User field so I am doing this to get the info, based on the Drink model: http://dpaste.com/hold/233600/ But, this seems like craziness. Can't I just search the

Re: Using variables / strings to call objects (such as in making database call)?

2010-08-24 Thread Karen Tracey
On Tue, Aug 24, 2010 at 3:24 PM, Rick wrote: > Thanks.. I have heard why this might not be a good idea, I think, but > if I don't use something like this then I have to just rewrite the > same code many times, I guess I could just write a macro to generate > the code for

Re: manage.py syncdb not working

2010-08-24 Thread !!CONDORIOUS!!
I am constantly updating the database model. I have tried South but still feel like the simplest most intuitive way to update a update an existing project's database is to manually create the fields using phpMyAdmin. Two steps 1. Add/Update field model.py 2. Add/Update in database to match

RE: manage.py syncdb not working

2010-08-24 Thread Sells, Fred
During development phase, I actually drop and recreate my database, then run syncdb etc to make sure I've got a clean start. Probably not practical once I get into production. From: django-users@googlegroups.com [mailto:django-us...@googlegroups.com] On Behalf Of Nick Arnett Sent: Tuesday,

Help with Geodjango+Postgres to find a Point, variance in decimal places

2010-08-24 Thread Sam Walters
Hi fellow Django developers I have Lat/Lng points stored in my db: class Airfield(models.Model): point = models.PointField(srid=4326) I noticed when i query on my development server with postgresql i DONT have to have the EXACT number of decimal places to find that point. (what i want)

Re: virtualenv and standalone scripts

2010-08-24 Thread Shawn Milochik
I have my .bashrc set to source the virtualenv, and I source .bashrc in any shell scripts that need to run via cron. That works out well for me, and was even seamless when I upgraded our server to Python 2.7 last weekend -- I didn't have to change a thing in any script, and just one line in

Re: virtualenv and standalone scripts

2010-08-24 Thread Sam Lai
On 24 August 2010 06:54, Oivvio Polite wrote: > Following advice on this list I've moved to virtualenv+pip to manage my > django stack, which so far is working out nicely. > > But what should I do about standalone scripts? Say I have a project > called mysite. If I'm in a

Re: app engine and the non-rel stuff going on lately

2010-08-24 Thread Russell Keith-Magee
On Wed, Aug 25, 2010 at 3:57 AM, Waldemar Kornewald wrote: > On Aug 24, 9:30 pm, mack the finger wrote: >> I'm considering starting a project, and am leaning towards using >> google app engine instead of the traditional LAMP stack. The problem >> is that

Django + GAE, Changing Auth from userid/password to email/password

2010-08-24 Thread nobosh
Hello, I just got my first app up: http://hellman470.appspot.com/ I'm now trying to learn how to change the authentication model to support email/password, eliminating userids. I'm guessing this is a pretty common request? Does anyone know of any tutorials on how to accomplish this with

PgWest 2010 CFP (2nd Call)

2010-08-24 Thread Joshua D. Drake
Following on the smashing success of PostgreSQL Conference East, PostgreSQL Conference West, The PostgreSQL Conference for Decision Makers, End Users and Developers, is being held at the St. Francis, Drake Hotel in San Francisco from November 2nd through 4th 2010. Please join us in making this the

Re: DJANGO + Google App Engine, Getting Started Tutorial

2010-08-24 Thread nobosh
Thanks for pointing that out. On Aug 23, 4:30 am, Steve Holden wrote: > On 8/23/2010 7:29 AM, Russell Keith-Magee wrote:> On Mon, Aug 23, 2010 at > 1:01 PM,nobosh wrote: > >> I'm very interested in finding a up-to-date tutorial that shows steps > >> for

Strange problem accessing JS for admin

2010-08-24 Thread Nick
I have a model set up to use collapsable inlines but for some reason the path to my js files is acting very strange. I can find the core.js at http://mysite.com/media/js/core.js but when i try to reach any other js http://mysite.com/media/js/inline.min.js I get a server error

Displaying uploaded image

2010-08-24 Thread vishy
I have media/customermedia folder where images are uploaded for customer model. To display this image,the customer has image_url method which concatenates 'media_root' plus 'image'(which has value like customermedia/name.gif).But,for some reason the image is not getting displayed in img src tag.

Caching JSON in Django

2010-08-24 Thread buddhasystem
Hello, I'm trying to use native caching in Django as per http://docs.djangoproject.com/en/dev/topics/cache/ I followed the setup procedure to the tee (it's not hard, of course). What I observe is that my app caches only views that deliver HTML. Since my application is heavily AJAX, that's not

fcgi vs. manage.py runserver and URI handling

2010-08-24 Thread David Koblas
I've got a production and a dev instance of my system, what I'm seeing is the following. For the URL: /tags/Cell%20Tower and the urls.py rule of: url(r'^tags/(?P.*)', 'tags', name='tags'), In the lighttpd proxying to a port on ./manage.py runserver I get tag = Cell Tower

Re: Custom clean() method

2010-08-24 Thread Joel Klabo
Thank you, question answered. On Aug 24, 11:45 am, Shawn Milochik wrote: > Your version automatically gets called during the cleaning process > (assuming it's named properly). You don't need to call it explicitly. > The default cleaning of the field will happen automatically.

Re: Loop over a form's choices (radio button) and render it

2010-08-24 Thread pravasi
If you have a function as below in the SelectForm class you can get a iterable renderer for the radio button field.I am not very sure about whether you have a initial value or value in your situation. def get_selectfield_renderer(self): field = self.fields['selectfield']

Re: app engine and the non-rel stuff going on lately

2010-08-24 Thread Waldemar Kornewald
On Aug 24, 9:30 pm, mack the finger wrote: > I'm considering starting a project, and am leaning towards using > google app engine instead of the traditional LAMP stack. The problem > is that with app engine, you can't use django models, or anything else > that depends on django

Re: Connecting a django-registration signal to a function

2010-08-24 Thread Alex
Hi Kai, I have done this very similarly(after a lot of wrong ideas). I now have it working using 'connect' instead of 'send' def user_profile(sender, user, request, **kwargs): profile = UserProfile(user= user) profile.save() from registration.signals import user_activated

Re: Notification of Model Changes

2010-08-24 Thread Shawn Milochik
On Tue, Aug 24, 2010 at 3:33 PM, Almost George wrote: > > When overriding __init__, what does that function definition need to > look like to make sure everything else works as usual? > Nothing special, as long as you call the __init__ of super. Example:

Re: Notification of Model Changes

2010-08-24 Thread Almost George
On Aug 24, 2:15 pm, Shawn Milochik wrote: > If you override __init__() and store the value of that field in a > temporary value, such as self.old_status, then the instance will have > both self.status and self.old_status for comparison later. > > I hope this fits your

app engine and the non-rel stuff going on lately

2010-08-24 Thread mack the finger
I'm considering starting a project, and am leaning towards using google app engine instead of the traditional LAMP stack. The problem is that with app engine, you can't use django models, or anything else that depends on django models, which means no modelforms, no admin, no authentication, no

Re: Using variables / strings to call objects (such as in making database call)?

2010-08-24 Thread Rick
Thanks.. I have heard why this might not be a good idea, I think, but if I don't use something like this then I have to just rewrite the same code many times, I guess I could just write a macro to generate the code for different modelnames, maybe thats the best approach On Aug 24, 8:55 am,

Re: Using variables / strings to call objects (such as in making database call)?

2010-08-24 Thread Rick
why is this not a good idea? On Aug 24, 8:55 am, Рогалевич (Ковалевич) wrote: > Don't think it is good idea to do so. > > In this case dict_variables['modelname'].objects.filter(status_listurl='u') > you call method objects on string. but string doesn't have such method.

Re: Notification of Model Changes

2010-08-24 Thread Shawn Milochik
If you override __init__() and store the value of that field in a temporary value, such as self.old_status, then the instance will have both self.status and self.old_status for comparison later. I hope this fits your use-case. Shawn -- You received this message because you are subscribed to

Notification of Model Changes

2010-08-24 Thread Almost George
This is probably a very old question, but I wasn't able to find an obvious answer - sorry if I overlooked anything. I have a model with a "status" field (using Choices) that defaults to "pending" and has other options like "closed", "active", etc. I would like to implement email notifications of

Re: Custom clean() method

2010-08-24 Thread Shawn Milochik
Your version automatically gets called during the cleaning process (assuming it's named properly). You don't need to call it explicitly. The default cleaning of the field will happen automatically. All you have to do is get the value from cleaned_data and make sure you return the value in your

Custom clean() method

2010-08-24 Thread Joel Klabo
When you write a custom clean method for a form, does is get called by is_valid? Or does it call the standard version? Do I need to explicitly call it? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: How to troubleshoot path and permission problems?

2010-08-24 Thread Timothy Makobu
This thread might help http://forum.webfaction.com/viewtopic.php?id=3171 On Tue, Aug 24, 2010 at 8:35 PM, vishy wrote: > I gave the permissions.But,still get this error > OSError Exception Value:[Errno 13] Permission denied: django > > On Aug 23, 11:02 pm, Antoni

Re: How to troubleshoot path and permission problems?

2010-08-24 Thread vishy
I gave the permissions.But,still get this error OSError Exception Value:[Errno 13] Permission denied: django On Aug 23, 11:02 pm, Antoni Aloy wrote: > 2010/8/23 vishy : > > > Hi, > > > I am having issues with production server.Everything is

readonly form field

2010-08-24 Thread Rodrigo Lombardo
Hi, I'm new to Django and I'm learning a lot reading the docs and some books. I'm trying to generate a form with some inactive fields and let the user change only some fields. The way I found to do this is described here:

Django admin not working with mod_python

2010-08-24 Thread Shamail Tayyab
Hi, I am facing an issue where I cannot get the admin interface working properly when running mod_python. Although when running it using development server, its works fine. Problem: Admin interface is missing the static contents, like css, the interface comes though. Related info: OS:

Why not remove csrfmiddlewaretoken in CsrfViewMiddleware from request.POST?

2010-08-24 Thread mucisland
I have various views which break on the additional csrfmiddlewaretoken in request.POST when using the recommendet CSRF protection with CsrfViewMiddleware and {% csrf_token %}. Why don't we just remove the csrfmiddlewaretoken in CsrfViewMiddleware before the request hits the views? patch on

Why not remove csrfmiddlewaretoken from request.POST?

2010-08-24 Thread mucisland
I have various views which break on the additional csrfmiddlewaretoken in request.POST when using the recommendet CSRF protection with CsrfViewMiddleware and {% csrf_token %}. Why don't we just remove the csrfmiddlewaretoken before the request hits the views? patch on middleware/csrf.py 1.2.1

Re: can't adapt type 'Decimal'

2010-08-24 Thread Gabriel Farrell
(I tried to post the below in a comment at poupou's site (http:// www.defitek.com/blog/2010/06/29/cant-adapt-type-decimal-error-with-django-apache-postgresql-psycopg2/), but kept getting errors.) Just ran into the same problem. In my mod_wsgi config I had: WSGIDaemonProcess site1

Re: virtualenv and standalone scripts

2010-08-24 Thread shacker
On Aug 23, 1:54 pm, Oivvio Polite wrote: > Following advice on this list I've moved to virtualenv+pip to manage my > django stack, which so far is working out nicely. > > But what should I do about standalone scripts? Say I have a project You need to load up the current project

Re: Using variables / strings to call objects (such as in making database call)?

2010-08-24 Thread Ковалевич
Don't think it is good idea to do so. In this case dict_variables['modelname'].objects.filter(status_listurl='u') you call method objects on string. but string doesn't have such method. you should use smth like modelclass = globals()['modelname'] for example: >>> import os >>> o=globals()['os']

Re: manage.py syncdb not working

2010-08-24 Thread Sithembewena Lloyd Dube
Thanks Nick - this echoes a thought that occured to me i.e. "create new table, copy data". The issue with constraints is what kept me from trying this out (remembered previous jobs updating SQL Server schemas - not fun with live data). Regards, Lloyd On Tue, Aug 24, 2010 at 4:56 PM, Nick Arnett

Re: manage.py syncdb not working

2010-08-24 Thread Nick Arnett
On Tue, Aug 24, 2010 at 7:43 AM, Sithembewena Lloyd Dube wrote: > Thanks Reinout. I have been seeing a lot of discussions regarding South > lately - time to dive in and find out what it is and what it means for me. > > I was under the impression that Django would add a field to

Re: manage.py syncdb not working

2010-08-24 Thread Sithembewena Lloyd Dube
Thanks Reinout. I have been seeing a lot of discussions regarding South lately - time to dive in and find out what it is and what it means for me. I was under the impression that Django would add a field to my table. So, is syncdb only good during initial database setup? Many thanks, Lloyd

Re: Connecting a django-registration signal to a function

2010-08-24 Thread Kai Timmer
On 23 Aug., 16:51, Kai Timmer wrote: > Whats the problem here? Really? Is no one able to point me in the right direction here? Or is the question just to stupid? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: manage.py syncdb not working

2010-08-24 Thread Reinout van Rees
On 08/24/2010 04:17 PM, Sithembewena Lloyd Dube wrote: Hi all, I have been working on some models and tried to run the manage.py syncdb command. It says there are no fixtures found even after I just added a field to a model. No fixtures found: it means to tell you that it didn't find any

Re: manage.py syncdb not working

2010-08-24 Thread Renne Rocha
Hello, It is correct. Syncdb will not alter existing tables: http://docs.djangoproject.com/en/1.2/ref/django-admin/#syncdb The reason is that if you've changed you model with some kind of constrains (unique fields, etc), Django will not try to guess how to mantain the correctness of

manage.py syncdb not working

2010-08-24 Thread Sithembewena Lloyd Dube
Hi all, I have been working on some models and tried to run the manage.py syncdb command. It says there are no fixtures found even after I just added a field to a model. A solution has been to drop the table in MySQL before running syncdb. This doesn't seem feasible all the time. What could I be

Re: static files + index.html dynamic usign django

2010-08-24 Thread Javier Guerra Giraldez
On Tue, Aug 24, 2010 at 7:33 AM, Piotr Kilczuk wrote: > P.S. Don't think about URLs as directories. +1 -- Javier -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Documentation problems: Django at a glance

2010-08-24 Thread Rodney Topor
OK, it seems I misunderstood the purpose of this page. I still think some of the code is misleading, but I accept that the examples is intended to be indicative rather than descriptive, and that it would indeed take much more space to describe how to get this example working. I'm sorry to have

Re: Finding current view url in template?

2010-08-24 Thread Alec Shaner
You could set a context variable, e.g., listing_operation = 'Edit' or 'Create'. Or you could use different templates, each inheriting a common template and only doing minor tweaks. On Tue, Aug 24, 2010 at 9:04 AM, reduxdj wrote: > I have some decisions i need to make

Finding current view url in template?

2010-08-24 Thread reduxdj
I have some decisions i need to make in my template based on the view that has been rendered in the browser. For instance: I need to know if the user is on gather.view.create_listing or gather.view.edit_listing? How can I do this in django, it alludes me. Thanks, Patrick -- You received this

Re: Object ID is not assigned after calling save() on a new object

2010-08-24 Thread Dan
Hi, On 24 Aug., 14:10, Karen Tracey wrote: > If you want automatic assignment, you need to make > it an AutoField with primary_key=True. thanks a lot, that fixed it! Regards, Daniel -- You received this message because you are subscribed to the Google Groups "Django

Re: flatpages and menu

2010-08-24 Thread Alec Shaner
You could use a context processor to read the flatpage table to build the menu. If you want more control over the menu then create a Menu model and store the flatpage links there and again build the menu in a context processor. You would probably want to use some level of caching if you don't want

Re: static files + index.html dynamic usign django

2010-08-24 Thread Piotr Kilczuk
Hi, > Is it possible to mix static and dynamic content in the same directory > using django? Yes :) At least as far as I understand your goal. Basic urlconf stuff - matter of order. P.S. Don't think about URLs as directories. Regards, Piotr -- You received this message because you are

Re: Object ID is not assigned after calling save() on a new object

2010-08-24 Thread Karen Tracey
On Tue, Aug 24, 2010 at 5:55 AM, Dan wrote: > I have some troubles with my Django model: whenever I create a new > object the ID (primary key) is not being assigned to it after calling > obj.save(). > > I am on RHEL with Python 2.4.3 and Django 1.2.1 (with MySQL

Re: Object ID is not assigned after calling save() on a new object

2010-08-24 Thread Rohan Jain
Django assigns an id field to models automatically, so you dont need to define it seperately. And even if you define it you have to assign auto_increment = true so that it is automatically filled. On Aug 24, 2:55 pm, Dan wrote: > Hi, > > I have some troubles with my

Re: Is this a bug or is adding a ForeignKey relations at runtime not supported?

2010-08-24 Thread Olek
On 24 Sie, 13:13, Olek wrote: > print 'It seems that forcing cache on SomeObject._meta to reload fixes > the problem." Please note that this line should end with >'<, not >"<. Sorry. Other than that code works. :) -- You received this message because you are subscribed to

GenericRelation OneToOne

2010-08-24 Thread schneck
Hi there, I'm using GenericRelations for binding a model to several others. One of them is a model where the generic model must have a 1:1 relation to r. As far as I understand, GenericRelations are always ManyToMany, right? Is there any other way to achieve it? Thanks, Stefan -- You received

Is this a bug or is adding a ForeignKey relations at runtime not supported?

2010-08-24 Thread Olek
Hi, Could you please look at this situation where I try to deal with adding ForeignKey relation at runtime and using it in a annotate construct? Is this code illustrates a bug in Django or am I trying to do something illegal here? I'm using Django 1.1. --- --- localhost:~$ django-admin.py

Object ID is not assigned after calling save() on a new object

2010-08-24 Thread Dan
Hi, I have some troubles with my Django model: whenever I create a new object the ID (primary key) is not being assigned to it after calling obj.save(). I am on RHEL with Python 2.4.3 and Django 1.2.1 (with MySQL backend). I've uploaded a code snippet which clearly shows the problem:

static files + index.html dynamic usign django

2010-08-24 Thread malo29
Hi, I'm wondering how to solve this problem: I have a directory containing static files to serve using django (during development), but I want the index.html file in that directory to be created using a django view. Is it possible to mix static and dynamic content in the same directory using

Re: Documentation problems: Django at a glance

2010-08-24 Thread Rick
I agree with Bruno.. I'm a new user to Django, just started a week ago, coming from using just Python (for about a month) and had been using PHP frameworks before that).. I understood the purpose of the tutorial as just a basic intro, I think that its generally implied that once you get the basic

Using variables / strings to call objects (such as in making database call)?

2010-08-24 Thread Rick
I'm using Django as my framework but am doing things beyond regular web development as I have some a lot of "components" outside of any of the django apps that I am often interacting with and, in some of these, I want to be able to make calls to the database for a model but want to be able to pass

How to right align choice/input fields on django admin page

2010-08-24 Thread BlueSky
Hello, I have some long field names such as "The Primary Account Number" defined in my model. When I tried to add a new record on admin page, the field name is overlapped by the text input box (so Number is overwritten by the input box). Is there a way to right align the text input or choice

Re: virtualenv and standalone scripts

2010-08-24 Thread Mathieu Leduc-Hamel
And what about using "console_scripts" entry in your setup.py script ? http://www.google.com/search?q=console_scripts On Mon, Aug 23, 2010 at 11:11 PM, Oivvio Polite wrote: > On Mon, Aug 23, 2010 at 10:54:21PM +0200, Oivvio

Re: stream (large) files from the back-end via Django to the user?

2010-08-24 Thread Markus
On Tue, Aug 24, 2010 at 2:16 AM, Eric Chamberlain wrote: > > Yes. The problem is that currently our CDN is based on Hadoop which serves > us really well for internal purpose. We can't make it accessible from the > outside because at the moment Hadoop is missing some crucial security

Re: stream (large) files from the back-end via Django to the user?

2010-08-24 Thread Markus
On Tue, Aug 24, 2010 at 1:28 AM, Steve Holden wrote: > Consider using Apache or Nginx to deliver this content much as you would > deliver static content from disk. You don't want Django-users in that loop > if you are interested in maximum throughput. > > But the question is

Django models to SOAP

2010-08-24 Thread Alessandro Ronchi
I need to expose my models to a soap view. Is there any way to avoid rewriting a second time my model like that: http://djangosnippets.org/snippets/1283/ and get a magic conversion of my models? A CharField to string, an IntegerField to Integer, a Datetime to Datetime and so on... --

Re: 'QuerySet' object has no attribute 'get_payload'

2010-08-24 Thread bruno desthuilliers
On 23 août, 21:25, Cole743 wrote: > "AttributeError at _ > > 'QuerySet' object has no attribute 'get_payload' > > Request Method:         POST > Request URL:     > Exception Type:         AttributeError > Exception Value: > > 'QuerySet' object

Re: Documentation problems: Django at a glance

2010-08-24 Thread bruno desthuilliers
On 24 août, 09:06, Rodney Topor wrote: > The "Django at a glance" aka "Overview" page > athttp://docs.djangoproject.com/en/dev/intro/overview/is intended to > introduce new users to models, queries (using the API), URLs, views, > templates and so on.  In short, it's a

Re: What is best practice for pluggable modules in app

2010-08-24 Thread Jani Tiainen
> Lets say I have shipping app called Shipping which is used for ups and > fedex. > I want just using settings.py to enable/disable them. > > The structure could be: > project > shipping > modules > ups > fedex > >

ANN: LFC 1.0

2010-08-24 Thread Kai Diefenbach
Hi guys, today we released LFC 1.0. This is the first final release of LFC. LFC is a CMS based on Python, Django and jQuery. You can find the installer here: http://pypi.python.org/pypi/django-lfc/1.0. The installation is described here:

What is best practice for pluggable modules in app

2010-08-24 Thread Alsond
Lets say I have shipping app called Shipping which is used for ups and fedex. I want just using settings.py to enable/disable them. The structure could be: project shipping modules ups fedex And by putting in

Re: Errors when using aggregates

2010-08-24 Thread wally
Problem solved - thanks Russ, appreciate the help. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to

Re: What's the best way to custom the add page (in django admin site)

2010-08-24 Thread Sam Lai
On 23 August 2010 22:38, Yangmin Li wrote: > sorry for the previous incomplete message. > Here is what I want to ask, thanks in advanced. > I have a model called request, after registered in admin backend, user can > add new request object in admin pages. > I want to modify

Re: Errors when using aggregates

2010-08-24 Thread Russell Keith-Magee
On Tue, Aug 24, 2010 at 2:29 PM, wally wrote: > I'm getting some strange errors when trying to use the aggregate > functions. My model looks like... > > class test(models.Model): >     a = models.IntegerField() > > After creating a few records, I try the following: >

Documentation problems: Django at a glance

2010-08-24 Thread Rodney Topor
The "Django at a glance" aka "Overview" page at http://docs.djangoproject.com/en/dev/intro/overview/ is intended to introduce new users to models, queries (using the API), URLs, views, templates and so on. In short, it's a simpler version of the tutorial. But it lacks much information, so it

flatpages and menu

2010-08-24 Thread OliverMarchand
Dear all, I am thinking of creating a website that displays "mostly" database content, but for special content I am using flatpages. Now somehow I must put a link to the flatpages somewhere, most likely in a menu. If I put the menu in my base template, then there is no way to insert this link by

Errors when using aggregates

2010-08-24 Thread wally
I'm getting some strange errors when trying to use the aggregate functions. My model looks like... class test(models.Model): a = models.IntegerField() After creating a few records, I try the following: >>> test.objects.all().aggregate(sum('a')) Traceback (most recent call last): File "",