Re: I18n when using standalone templates

2008-12-22 Thread Iwan
Malcolm, On Dec 23, 2:00 am, Malcolm Tredinnick wrote: > You can do it this way: > >         from django.utils import translation > >         translation.activate(locale) > > where "locale" is a variable containing the name of the locale you wish > to activate. You

Re: Is there a bug in http://docs.djangoproject.com/en/dev/topics/db/models/ ?

2008-12-22 Thread Shuge Lee
I got another idea for it now. Thank for your reminder. :-) On Dec 15, 2:00 pm, Malcolm Tredinnick wrote: > On Sun, 2008-12-14 at 21:32 -0800, lee wrote: > > [...] > > > It seems that official docs hasn't give a reference to howto define > > 'ON DELETE CASCADE ON

Re: Table inheritance and polymorphic admin forms

2008-12-22 Thread Malcolm Tredinnick
On Mon, 2008-12-22 at 22:17 -0800, George Sakkis wrote: [...] > 1. With explicit concrete inline admin classes, the interface shows > one section per class ("Book reviews", "Movie reviews", etc.). This > might be a feature under some circumstances (you get a "group by > review type" for free),

Re: Post tutorial help needed - generic.create_update.create_object

2008-12-22 Thread Greg Schwimer
OK, that makes sense then. Thank you! On Mon, Dec 22, 2008 at 5:11 PM, Malcolm Tredinnick < malc...@pointy-stick.com> wrote: > > On Mon, 2008-12-22 at 15:32 -0700, Greg Schwimer wrote: > [...] > > > > > I suspect I've now moved on to a problem in a new area. The thing I > > don't quite get is

Re: Table inheritance and polymorphic admin forms

2008-12-22 Thread George Sakkis
On Dec 22, 7:04 pm, Malcolm Tredinnick wrote: > On Mon, 2008-12-22 at 09:42 -0800, George Sakkis wrote: > > [...] > > > > > Unfortunately it doesn't work for what I tried. What I am trying to do > > is have the Child classes as InlineModelAdmin in some other class that

Re: DJango +Appy Framework+ generate pdf and odt file

2008-12-22 Thread Malcolm Tredinnick
On Mon, 2008-12-22 at 21:01 -0800, jai_python wrote: > No one here to solve my problem :( Please show some simple patience. It's been less than 24 hours since you originally posted a question that has zero Django content in it to a Django-specific mailing list. You *might* get lucky and find

Re: DJango +Appy Framework+ generate pdf and odt file

2008-12-22 Thread jai_python
No one here to solve my problem :( --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send

Re: S3Storage.py and Thumbnails using PIL (IOError / cannot identify image file)

2008-12-22 Thread Merrick
I am always amazed by the support here, thank you. After seeing Brian's code I switched resize_image() to be a model method and then I switched from saving the form to saving the profile profile = request.user.get_profile() profile.save_picture(pform.cleaned_data['picture'].read()) instead of

Re: where are the code that handle image file upload in Django admin page?

2008-12-22 Thread Chuck22
Anyone can help on this? I get stuck with image file upload. On Dec 21, 11:33 pm, Chuck22 wrote: > I have three ImageField in my form and model, I want to know how to > upload the three image files in the form processing code. I found > Django Admin page handles the image file

Re: MultiValueDictKeyError when accessing POST items

2008-12-22 Thread Malcolm Tredinnick
On Mon, 2008-12-22 at 19:03 -0800, DragonSlayre wrote: > I've created my own form: > > > Login: > Username: > > Password: > > > > > I am mappying /accounts/login/ to a view of mine, which is then > calling: > > if request.method == 'POST': > username =

MultiValueDictKeyError when accessing POST items

2008-12-22 Thread DragonSlayre
I've created my own form: Login: Username: Password: I am mappying /accounts/login/ to a view of mine, which is then calling: if request.method == 'POST': username = request.POST['login_username'] I have no idea why I'm getting the error - "Key 'login_username' not

Re: dynamic mod wsgi

2008-12-22 Thread Graham Dumpleton
Have some further questions about what you want to do. Do you want a separate daemon process for each distinct Django site, or are you happy with one really fat process which contains each Django site in a separate sub interpreter of that process? How much memory does each Django site instance

Re: RSS...my parameters are not correct

2008-12-22 Thread Mike Ramirez
On Tuesday 11 December 2007 12:33:23 pm Greg wrote: > Hello, > I'm trying to get my RSS feed items to link to the right url, however > I'm having trouble. I was orginally having my blogs appear in my RSS > feed. When I clicked on one of them I would get the error: > > ' Invalid feed parameters.

Re: Integrity error with get_or_create()

2008-12-22 Thread Casey Deccio
I've looked into this further, and it looks like it's actually an issue with PostgreSQL, not django. The field I'm querying is of type inet, and I'm inputting an IPv6 address. However, it appears that in PostgreSQL (running version 8.3.5) IPv6 addresses only match a query when the string being

Re: Newbie Help with Models and Views

2008-12-22 Thread Mike A
Paul, Thanks for the help. I switched to the get method, and the data prints correctly now. Thanks! -Mike On Dec 22, 5:44 pm, "Wayper, Paul" wrote: > > .filter returns a list of the items that match the query.  So > > you're trying to stringify a list.  That's

Integrity error with get_or_create()

2008-12-22 Thread Casey Deccio
Hi, I'm running django-1.0 in a multi-threaded application (PostgreSQL backend), and I'm getting an IntegrityError occasionally when I run a model.objects.get_or_create(). I can see in the get_or_create() method of db/models/query.py that it excepts an Integrity error, and then rolls back the

ACL module

2008-12-22 Thread giolekva
Hi. I'm interested if there is some 3rd party ACL(http://en.wikipedia.org/ wiki/Access_control_list) module for django. If there is can u advice me some of them or give some useful links? Thanks. --~--~-~--~~~---~--~~ You received this message because you are

Re: Post tutorial help needed - generic.create_update.create_object

2008-12-22 Thread Malcolm Tredinnick
On Mon, 2008-12-22 at 15:32 -0700, Greg Schwimer wrote: [...] > > I suspect I've now moved on to a problem in a new area. The thing I > don't quite get is why adding auto_now_add to the pub_date field in > the model broke this. Any ideas? Because auto_now_add fields are not editable. They

Re: accessing to a field value in the template

2008-12-22 Thread Malcolm Tredinnick
On Mon, 2008-12-22 at 17:20 -0600, GaRaGeD Style wrote: > > That particular value comes from one of three sources. In order of > > highest priority to lowest, they are: > > > >(1) Data submitted to the form (for redisplaying submitted data > >for errors). > >(2) Initial

Re: Table inheritance and polymorphic admin forms

2008-12-22 Thread Malcolm Tredinnick
On Mon, 2008-12-22 at 09:42 -0800, George Sakkis wrote: [...] > Unfortunately it doesn't work for what I tried. What I am trying to do > is have the Child classes as InlineModelAdmin in some other class that > references them. Here's a sample: > > # === models.py === > class

Re: I18n when using standalone templates

2008-12-22 Thread Malcolm Tredinnick
On Mon, 2008-12-22 at 05:06 -0800, Iwan wrote: > Hi there, > > We're using Django templates on their own. Usually invoked like this > (eg): > > - > t = django.template.Template(templateSource) > c = django.template.Context({}) > > print

Re: accessing to a field value in the template

2008-12-22 Thread GaRaGeD Style
> That particular value comes from one of three sources. In order of > highest priority to lowest, they are: > >(1) Data submitted to the form (for redisplaying submitted data >for errors). >(2) Initial data provided to the form class >(3) Initial data provided to

Re: Django models

2008-12-22 Thread kev
Alright thanks a lot. On Dec 22, 3:06 pm, bruno desthuilliers wrote: > On 22 déc, 17:10, kev wrote: > > > > > Hello, > > Im reading a django book and it adds friends to user authentication > > system by making: > > > (was .96) > > > class

RE: Newbie Help with Models and Views

2008-12-22 Thread Wayper, Paul
> .filter returns a list of the items that match the query. So > you're trying to stringify a list. That's where the '[' and > ']' are coming from. I should have mentioned that the get method (e.g. Post.objects.get(id = 1)) will return a single object, or raise a DoesNotExist error. You may

Re: Post tutorial help needed - generic.create_update.create_object

2008-12-22 Thread Greg Schwimer
OK, that definitely fixed it, but it created another problem. Here's how it looks now: *pub_date = models.DateTimeField('date published', auto_now_add=True)* Exactly as you'd suggested. However, I'm now getting the following error on all pages I hit: *ImproperlyConfigured at /polls/new/

RE: Newbie Help with Models and Views

2008-12-22 Thread Wayper, Paul
> From: Mike Albert > Subject: Newbie Help with Models and Views > > I have a couple test rows of data in my database. From the > interactive shell (manage.py shell), I can return data correctly with > Post.objects.filter(id=1). You'll notice that that data is coming back as ['row 1']. It's

Re: dynamic mod wsgi

2008-12-22 Thread Graham Dumpleton
On Dec 22, 9:44 pm, Ben Eliott wrote: > Hi Graham, > I've finally managed to get back to the wildcard subdomains & mod_wsgi   > today. Unfortunately the discussion thread you mentioned has   > disappeared and after a few hours i still seem to be doing a good job   >

Re: problem with adding foreign key to table

2008-12-22 Thread Daniel Roseman
On Dec 22, 9:14 pm, Ana wrote: > Hello, > > I migrated my MySQL tables to Postgres.  Generally, the migration was > fine with one exception.  I have a table researchproj that included > two foreign keys (institution_id and contact_id).  I received the > following error: > >

Newbie Help with Models and Views

2008-12-22 Thread Mike Albert
Hello, Just getting started learning django, and I'm having trouble with a view. Here is the model I've created: from django.db import models class Post (models.Model): text = models.CharField(max_length=30) def __str__(self): return self.text I have a couple test rows

problem with adding foreign key to table

2008-12-22 Thread Ana
Hello, I migrated my MySQL tables to Postgres. Generally, the migration was fine with one exception. I have a table researchproj that included two foreign keys (institution_id and contact_id). I received the following error: Caught an exception while rendering: ('ascii', u'Jorge Gir\xf3n',

Re: S3Storage.py and Thumbnails using PIL (IOError / cannot identify image file)

2008-12-22 Thread brianmac44
With my code, what are you using as "content"? I'm using: form.cleaned_data['source'].read() So my code looks something like this: PHOTO_MEDIUM_SIZE = 400,400 source_image = form.cleaned_data['source'].read() resized_image = resize_photo(source_image,PHOTO_MEDIUM_SIZE))

Re: Django date filter

2008-12-22 Thread Daniel Roseman
On Dec 22, 12:30 pm, Aldo wrote: > Hi folks, > > Simple enough problem but cant find the functionality - if it exists. > > this_week = datetime.date.today() - timedelta(7) > Cars.objects.filter(created_date>this_week) > > I basically want to find all cars that were created

Re: Django models

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

Re: How to set the from a ModelChoiceField?

2008-12-22 Thread krylatij
class MyForm(...): def __init__(self, *args, **kwargs): super(MyForm, self).__init__(*args, **kwargs) self.fields['myfield'].choices = City.objects.values_list('id', name_field) --~--~-~--~~~---~--~~ You received this message because you are

Re: Complete layout (template) switching.

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

Re: non-fields being inherited by ModelForm

2008-12-22 Thread Daniel Roseman
On Dec 22, 4:43 pm, nbv4 wrote: > I have a model which is defines kind of like this: > > MyModel(models.Model) >     field1 = models.BooleanField() >     field2 = models.BooleanField() >     field_num = "1" > > And then I have a form thats pretty much this: > >

Session and request.FILES

2008-12-22 Thread krylatij
I'm writing custom session based wizard (data between step is stored in sessions). One of the steps is uploading files (not the last). The problem is that i save models only after last step. So the question is how to deal with files? As i understand there is no way to store files in session

Re: S3Storage.py and Thumbnails using PIL (IOError / cannot identify image file)

2008-12-22 Thread Merrick
I got the same result with brianmac44's code. I also verified that the my resize_image() works when opening the file from the local filesystem - so I am somehow not passing the file in a manner that Image.open likes. On Dec 22, 4:45 am, brianmac44 wrote: > I had the same

Re: login_required redirects always to LOGIN_REDIRECT_URL?

2008-12-22 Thread Matias
Hello, You can add a hidden input named "next" where you put the value of next in the GET variable. Like this Or you can change the action variable of the form to include the current GET variables. like this If your view that handles GET and POST aren't the same you must

Re: Is this a bug in FormWizard?

2008-12-22 Thread Rajesh Dhawan
> > Your analysis is correct. It's the self.extra_context.update(*) call > in the FormWizard that simply updates the class level copy of that > variable. > > If you instead override "parse_params" as suggested by the comments in > FormWizard, you won't have this problem. To be clearer, in

Re: reverse foreign key lookup in extra()

2008-12-22 Thread Fereshteh
Thanks a lot Malcolm for your explanatory information. I think I get the concept now :) On Dec 20, 9:36 pm, Malcolm Tredinnick wrote: > On Fri, 2008-12-19 at 11:10 -0800, Fereshteh wrote: > > Hi, > > I am trying to add a filtering functionality to my web application. I

Re: Is this a bug in FormWizard?

2008-12-22 Thread Rajesh Dhawan
On Dec 19, 2:27 pm, 朱穆穆 wrote: > self.extra_context is a reference of FormWizard.extra_context. > It was empty when the class define, but may not empty when > instantiate. > > class TestWizard(forms.FormWizard): > pass > > tw1 = TestWizard() > tw1(request,

Re: Django models

2008-12-22 Thread kev
I see what you are saying but there are few drawbacks: 1) 2 queries instead of one. 2) When you combine into friends_all or something, you need to keep track of which was friend vs which is user. I was thinking more on the lines of this: Each User has a UserProfile which i defined. In

Re: How to set the from a ModelChoiceField?

2008-12-22 Thread Ben Eliott
I suspect that bots aren't going to follow form submits like this so it doesn't matter. But if you have these GET queries coded into any html elements, thereby becoming part of the sitemap, then it probably will matter. This is a bit of a common sense punt, i'm not an SEO expert, so

Forms and ManyToMany relationship with intermediary model

2008-12-22 Thread Bernard
Hey there, I've been searching this group for a working example of a complex form using a ManyToMany relationship with an intermediary model. I've read this documentation to know a bit more about the ManyToMany relationship:

Re: Table inheritance and polymorphic admin forms

2008-12-22 Thread George Sakkis
On Dec 21, 10:02 pm, Malcolm Tredinnick wrote: > On Sun, 2008-12-21 at 18:50 -0800, George Sakkis wrote: > > Hi all, > > > I have a situation which I think would best be modeled as (single) > > inheritance, involving product reviews for various kinds of products. > >

Re: Django models

2008-12-22 Thread Jason Sidabras
The way I was thinking of doing it was to have two foreignkeys named friend1 and friend2 then when you do your list you could run (something like) friends = Friendship.objects.get(friend1__exact=user) and friends2 = Friendship.objects.get(friend2__exact=user) Then you have a complete instance

non-fields being inherited by ModelForm

2008-12-22 Thread nbv4
I have a model which is defines kind of like this: MyModel(models.Model) field1 = models.BooleanField() field2 = models.BooleanField() field_num = "1" And then I have a form thats pretty much this: MyModelForm(models.ModelForm) class meta model = MyModel I want to be

Django models

2008-12-22 Thread kev
Hello, Im reading a django book and it adds friends to user authentication system by making: (was .96) class Friendship(models.Model): from_friend = models.ForeignKey( User, related_name='friend_set' ) to_friend = models.ForeignKey( User, related_name='to_friend_set' ) def

Re: Problem with url tag

2008-12-22 Thread patrick91
This is really boring :( I've restarted the server, and it doens't work again :/ also I've noticed that no urls in reparations.urls can't be called with the template tag url... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Installing django admin on apache/ mod_python

2008-12-22 Thread paultanner
Checked two more things: - to mke sure that mod_python could compile anything it wanted to I chown'd the python distribution to apache (the user). This had and effect - various pyc files created - however, the admin app still doesn't run. - put in a symbolic link so the django distribution is

Re: TextMate Django Bundle

2008-12-22 Thread David Reynolds
On 17 Dec 2008, at 23:00, felix wrote: > and thanks to whoever made this ! very useful. The maintainer is PBX / Paul Bissex -- David Reynolds da...@reynoldsfamily.org.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

login_required redirects always to LOGIN_REDIRECT_URL?

2008-12-22 Thread Jarek Zgoda
I'm seeing strange behaviour of login_required decorator: any view decorated with it first sends to login page, then to url defined in LOGIN_REDIRECT_URL. The url to decorated view is supplied in next parameter (/login/?next=/path/to/view/) but is never executed. Looking at login view code I see

Re: Sites

2008-12-22 Thread Karen Tracey
On Mon, Dec 22, 2008 at 3:43 AM, todd wrote: > I'm using the latest django release 1.0.2 and following the tutorial. > I noticed I do not have 'Sites' in my admin site. Am I missing > something to get the 'Sites' appear? > Probably you do not have

Re: Advanced Permissions and States

2008-12-22 Thread Paul van der Linden
makka...@gmail.com wrote: >> I'm working on a big project at my work myself. >> We came to this problem last week (we did something to check it, but it >> was unmanagable). >> We wanted to move the check to the models. This is a little bit >> difficult because you basicly doesn't have the user

How to set the from a ModelChoiceField?

2008-12-22 Thread mb0...@googlemail.com
Hello, I have a ModelChoiceField getting filled up by a database queryset. Works fine this far. In my template the entries of the select-field look all like this: Afghanistan I know that that the value between the two option tags (Afghanistan) can be set by changing the model's

Complete layout (template) switching.

2008-12-22 Thread Kura
Hey guys, I'm currently working on a content management system built on the Django framework, currently the whole cms works on a section- >page(s) basis which is working well, we've run in to some issues with our designs in that the blocks for content on some pages are in different locations and

Re: "Building you first Django app, Part 1" example not working

2008-12-22 Thread leveille
You're 14. You recognize that you're having a problem and you post to the Django group for help. You're not stupid at all. I would say you're very intelligent! On Dec 21, 2:43 pm, Chris wrote: > Oh shit, that's awesome! Thanks! I thought it had already created the > DB

I18n when using standalone templates

2008-12-22 Thread Iwan
Hi there, We're using Django templates on their own. Usually invoked like this (eg): - t = django.template.Template(templateSource) c = django.template.Context({}) print t.render(c) - When

Re: Advanced Permissions and States

2008-12-22 Thread makkalot
On Monday 22 December 2008 12:18:13 pm Paul van der Linden wrote: > Hi, Hi thanks for the reply > I'm working on a big project at my work myself. > We came to this problem last week (we did something to check it, but it > was unmanagable). > We wanted to move the check to the models. This is a

Re: S3Storage.py and Thumbnails using PIL (IOError / cannot identify image file)

2008-12-22 Thread brianmac44
I had the same problem two weeks ago. This is what I wrote: def resize_photo(self,content,size): img = Image.open(ContentFile(content)) img.thumbnail(size, Image.ANTIALIAS) io = StringIO.StringIO() img.save(io, 'PNG') return ContentFile(io.getvalue()) Hope this helps.

How to access SplitDateTime field elements in template

2008-12-22 Thread rtmie
I have a form with a SplitDateTimeField and cannot figure out how to access the individual date and time elements in it from my template: class Dummy1(models.Model): name = models.CharField(max_length = 100) created = models.DateTimeField(default = datetime.datetime.now()) class

Django date filter

2008-12-22 Thread Aldo
Hi folks, Simple enough problem but cant find the functionality - if it exists. this_week = datetime.date.today() - timedelta(7) Cars.objects.filter(created_date>this_week) I basically want to find all cars that were created in the last 7 days. I have seen there are things for the month and

DJango +Appy Framework+ generate pdf and odt file

2008-12-22 Thread jai_python
Dear all, I am using POD APPY framework (http://appyframework.org/) for generating reports in pdf and odt files. i am able to get reports in odt file using development server. when i tried with pdf reports, i got an error ERROR

Subprocess module in Python CGI

2008-12-22 Thread Anurag
Hello, I have started using python recently and would like to call a short python script via browser using a CGI script, but initially I am trying to call the same python script directly through python command line. The script intends to perform a few command line in a pipe and I have written

Re: dynamic mod wsgi

2008-12-22 Thread Ben Eliott
Hi Graham, I've finally managed to get back to the wildcard subdomains & mod_wsgi today. Unfortunately the discussion thread you mentioned has disappeared and after a few hours i still seem to be doing a good job of getting nowhere. Although you mentioned using mod_rewrite to get hold of

Re: Advanced Permissions and States

2008-12-22 Thread Paul van der Linden
Hi, I'm working on a big project at my work myself. We came to this problem last week (we did something to check it, but it was unmanagable). We wanted to move the check to the models. This is a little bit difficult because you basicly doesn't have the user object at in the __init__ function of

Re: Problem with url tag

2008-12-22 Thread patrick91
What a strangeness! I edit the template removing the extend tag, and it worked, next I readded the extend and it still worked :O this is really strange :/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django

Model with CharField primary key, force_update=True to prevent saving other object

2008-12-22 Thread Jeff Kowalczyk
I'm working with a model using a CharField primary key, and want to ask whether it is appropriate to use force_update=True in a save() override on the model. I need to prevent other objects from being created/updated if save() is called with a changed pk value. class Widget(models.Model):

Re: S3Storage.py and Thumbnails using PIL (IOError / cannot identify image file)

2008-12-22 Thread Merrick
Thank you I tried that and I still get the same error. I spent a little more time looking at PIL / Image.py and cleaning up the code. From what I can tell the Image.open method is having trouble with what I am passing to it. def resize_image(file, size=(50, 50)): from PIL import Image

Re: Problem with url tag

2008-12-22 Thread patrick91
On 22 Dic, 09:24, Malcolm Tredinnick wrote: > Okay, nothing unexpected there. If I use the same lines with a dummy > view file, things certainly seem to work. > > The confusing thing here is that the url template tag is a relatively > simple wrapper around reverse(), so

Sites

2008-12-22 Thread todd
Hi, I'm using the latest django release 1.0.2 and following the tutorial. I noticed I do not have 'Sites' in my admin site. Am I missing something to get the 'Sites' appear? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: PDF to Text Coverter

2008-12-22 Thread Antoni Aloy
Check this: http://code.activestate.com/recipes/511465/ http://pybrary.net/pyPdf/ Best regards, 2008/12/21 Harish : > > Hi Friends... > > I know this is a not a right place to ask this question. > but it is related to Python. I thought it to ask. > > Is there any

doc/user manual management

2008-12-22 Thread Ramdas S
Hi, We are developing an Intranet product hosted on Django. It is a product which is currently installed at couple of clients and goes through monthy updates. We are developing a user manual which will be in revision almost every week. We might have a few more installations this year for the same

Re: Problem with url tag

2008-12-22 Thread Malcolm Tredinnick
On Sun, 2008-12-21 at 23:58 -0800, patrick91 wrote: > On 22 Dic, 02:17, Malcolm Tredinnick wrote: > > Certainly a bit unexpected. Can you paste the relevant lines from your > > URL Conf file, please? > > > > Regards, > > Malcolm > > Sure :) > here it is: >