Re: Model Forms

2009-08-27 Thread Siddharth Godbole
Yup It worked! I saved the form with excluded foreign key with commit=False. Then set the proper instance to foreign key and then saved. It worked just fine. Thanks for the help :) On Thu, Aug 27, 2009 at 10:47 PM, Shawn Milochik wrote: > > There are different options,

Re: QuerySet without result_cache?

2009-08-27 Thread Alex Gaynor
On Thu, Aug 27, 2009 at 5:56 PM, Sam Tregar wrote: > On Thu, Aug 27, 2009 at 5:47 PM, Alex Gaynor wrote: >> >> Instead of iterating over the QuerySet itself, use >> QuerySet.iterator(), this will avoid populating the result cache. > > Thanks, works great! 

Re: Django test suite does not discover test method "test_string_regex"

2009-08-27 Thread Karen Tracey
On Thu, Aug 27, 2009 at 2:21 PM, Gregor Müllegger wrote: > > Hi, > > i have an issue with the standard test runner of django. If i try to > run the testsuite of an app everything gets executed in the right > fashion. While all executed tests pass without errors, the test

Re: invalid template tag

2009-08-27 Thread Javier Guerra
On Thu, Aug 27, 2009 at 2:03 PM, nixon66 wrote: > register.filter(uscurrency) should be register.filter ('uscurrency', uscurrency) -- Javier --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Table with search results and returning to previous page.

2009-08-27 Thread Viacheslav Chumushuk
Hello. I have project design question. Imaging that we have page with simple search form at the top and search results at the bottom of the same page. And every row of result table has a link to another page (edit/view this founded item). After user clicking this link he goes to another page (for

Django test suite does not discover test method "test_string_regex"

2009-08-27 Thread Gregor Müllegger
Hi, i have an issue with the standard test runner of django. If i try to run the testsuite of an app everything gets executed in the right fashion. While all executed tests pass without errors, the test method "test_string_regex" is not evaluated! If i rename the method to any athor name like

Integrating external tools into Django

2009-08-27 Thread Jenny
Hello ppl, may somebody help me? I need to integrate widgets like iCalender or a chat into Django. How do I do it correctly? Thx! Jenny --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post

django-tinymce problem on server

2009-08-27 Thread Sonal Breed
Hi all, I have django-tinymce spellchecker working perfectly on my local machine which is Ububtu. But as soon as, I deploy it on a web host (CentOS), it gives me problems. Specifically, when I click the specllchecker button, following errors are logged: Traceback (most recent call last): File

Re: QuerySet without result_cache?

2009-08-27 Thread Sam Tregar
On Thu, Aug 27, 2009 at 5:47 PM, Alex Gaynor wrote: > > Instead of iterating over the QuerySet itself, use > QuerySet.iterator(), this will avoid populating the result cache. > Thanks, works great! This would make a good addition to the manual section that describes how

Re: Dynaically fields to a formwizard form

2009-08-27 Thread dingue fever
Thanks. I will check out your suggestions. On Aug 26, 6:07 am, Peter Bengtsson wrote: > You can add and modify fields on a form in the form's __init__ > function. > > class MyForm(forms.Form): >     country = forms.ChoiceField() >     def __init__(self, *args, **kwargs): >    

Re: Model Forms

2009-08-27 Thread Shawn Milochik
There are different options, depending on whether the instance of B is a required part of A's model. 1. You can add an "exclude" section to your ModelForm of A. Validate BForm, validate AForm, then take the resulting instance of A and set it's 'b' attribute to the resulting instance of

Re: invalid template tag

2009-08-27 Thread nixon66
Still getting the same errors. On Aug 27, 7:10 pm, Javier Guerra wrote: > On Thu, Aug 27, 2009 at 2:03 PM, nixon66 wrote: > > register.filter(uscurrency) > > should be > > register.filter ('uscurrency', uscurrency) > > -- > Javier

Re: invalid template tag

2009-08-27 Thread nixon66
The file is mytag.py and the directory is now called templatetags On Aug 27, 4:42 pm, Daniel Roseman wrote: > On Aug 27, 8:03 pm, nixon66 wrote: > > > I've just created a template tag as described in the documents, but > > keep getting errors. > > >

Re: Many-to-many column admin interface

2009-08-27 Thread Sven Richter
I found this thread: http://stackoverflow.com/questions/660260/django-admin-form-for-many-to-many-relationship on Stackoverflow, but when i try the suggested TabularInline thing i get the error: has no ForeignKey to Greetings Sven On Thu, Aug 27, 2009 at 5:03 PM, Thomas Guettler

Re: invalid template tag

2009-08-27 Thread nixon66
Made the changes and still getting the same error. On Aug 27, 3:11 pm, Javier Guerra wrote: > i only see a couple of minimal typos, could be your problem: > > > In an installed app I created a directory called Templatetags. I > > should be 'templatetags', no capitalization.

Re: QuerySet without result_cache?

2009-08-27 Thread Alex Gaynor
On Thu, Aug 27, 2009 at 5:34 PM, Sam Tregar wrote: > Hey all.  So, I figured out how to run my QuerySet through MySQLdb's > SSCursor!  Woo! > > Bad news: it's still using a ton of memory.  As far as I can tell it's being > used by QuerySet's internal _result_cache which is

Re: Django scalability with files

2009-08-27 Thread Rafael Ferreira
The queue idea is a good one, and you can use Gearman to do that really easily. Another, even simpler, way to handle this is to use some kind of shared NFS mount for the storage. All things being equal, scaling a filer or SAN will be much easier than scaling your DB, specially if - like most

QuerySet without result_cache?

2009-08-27 Thread Sam Tregar
Hey all. So, I figured out how to run my QuerySet through MySQLdb's SSCursor! Woo! Bad news: it's still using a ton of memory. As far as I can tell it's being used by QuerySet's internal _result_cache which is holding all the rows retrieved by the query. Is there any way to turn this cache

Re: pyfacebook, No module named facebook.djangofb...

2009-08-27 Thread Mike Ramirez
On Thursday 27 August 2009 08:36:25 am garagefan wrote: > i've taken the project directly from github and attempted to run > python setup.py install and get the same error: > > running install > error: invalid Python installation: unable to open /usr/lib/python2.5/ > config/Makefile (No such file

Re: show user and date in change_list

2009-08-27 Thread Alex Gaynor
On Thu, Aug 27, 2009 at 12:18 PM, Sandra Django wrote: > Hi, I want display in change_list view, user who added an object and date. I > did that: > - models.py --- >> >> class One(models.Model): >>     .. >> def user(self): >>    

show user and date in change_list

2009-08-27 Thread Sandra Django
Hi, I want display in change_list view, user who added an object and date. I did that: - models.py --- > > class One(models.Model): > .. > def user(self): > return self.user.username > > def date(self): > return self.date > --

Re: invalid template tag

2009-08-27 Thread Daniel Roseman
On Aug 27, 8:03 pm, nixon66 wrote: > I've just created a template tag as described in the documents, but > keep getting errors. > > In an installed app I created a directory called Templatetags. I > created a blank __init__.py file and a file called mytag. Is the file

Related ownership for items that dont' exist yet?

2009-08-27 Thread Streamweaver
Sorry if I'm getting a little far out here. I have two models, a parent and a child with a FK relationship (See the code below for example) and I have a method in each called is_owner. For the child it checks to see if a user passed is the objects owner OR if that user passes the parents

Re: invalid template tag

2009-08-27 Thread Javier Guerra
i only see a couple of minimal typos, could be your problem: > In an installed app I created a directory called Templatetags. I should be 'templatetags', no capitalization. > created a blank __init__.py file and a file called mytag. Mytag has a > function > > from django import template > >

Re: How to check which form was submitted?

2009-08-27 Thread Maksymus007
On Thu, Aug 27, 2009 at 5:00 PM, Thomas Guettler wrote: > > > > Maksymus007 schrieb: >> On Thu, Aug 27, 2009 at 1:22 PM, David Zhou wrote: >>> On Thu, Aug 27, 2009 at 7:09 AM, Maksymus007 wrote: I've got two different form on the

invalid template tag

2009-08-27 Thread nixon66
I've just created a template tag as described in the documents, but keep getting errors. In an installed app I created a directory called Templatetags. I created a blank __init__.py file and a file called mytag. Mytag has a function from django import template register template.Library() def

What do you use for a shopping cart (in an existing app?)

2009-08-27 Thread ristretto.rb
Hello, I would like to add shopping cart features to a current web application. Has anyone solved this type of problem? What did you do? Roll your own features (add to cart, view cart, payment, etc)? Use Satchmo? Use something else? Thanks Gene

How to control which DB connection and cursor a queryset will use

2009-08-27 Thread Sam Tregar
I'm trying to get a queryset to issue its query over a different DB connection, using a different cursor class. Does anyone know if that's possible and if so how it might be done? In psuedo-code: # setup a new db connection: db = db_connect(cursorclass=AlternateCursor) # setup a generic

Re: pyfacebook, No module named facebook.djangofb...

2009-08-27 Thread garagefan
doh, forgot that i never installed python-devel, der... everything works now, nothing to see here... no novice server users here >_> On Aug 27, 11:36 am, garagefan wrote: > i've taken the project directly from github and attempted to run > python setup.py install and get

Re: Many-to-many column admin interface

2009-08-27 Thread Thomas Guettler
Hi, I had the same question some time ago and found no answer, but maybe you try harder. Sven Richter schrieb: > Hi, > > i have a new problem with my many-to-many field. > > I have two models A and B. > A(models.model): > b = models.ManyToManyField('app.B') > > Now when i edit A in the

Re: Django scalability with files

2009-08-27 Thread David De La Harpe Golden
Lewis Taylor wrote: > Is there a better solution django offers, and why are > blobs not supported. ideally i would have the image stored in DB and > that way there would never be sync issues. > FWIW (which given you're concerned about scaling mightn't be all that much), it's fairly

Re: Generating slugs

2009-08-27 Thread Michael
On Thu, Aug 27, 2009 at 11:02 AM, RubenK wrote: > > Thanks for the help! It worked! How would I go about hiding the field? > I think you would have to go all the way and put the form on the model admin, which really isn't difficult. Follow this:

Re: How to check which form was submitted?

2009-08-27 Thread Thomas Guettler
Maksymus007 schrieb: > On Thu, Aug 27, 2009 at 1:22 PM, David Zhou wrote: >> On Thu, Aug 27, 2009 at 7:09 AM, Maksymus007 wrote: >>> I've got two different form on the same page, under the same URL. >>> When I send one of them, the second one gets

Re: pyfacebook, No module named facebook.djangofb...

2009-08-27 Thread garagefan
i've taken the project directly from github and attempted to run python setup.py install and get the same error: running install error: invalid Python installation: unable to open /usr/lib/python2.5/ config/Makefile (No such file or directory) i assume then, i need to install Makefile? I've

Re: Generating slugs

2009-08-27 Thread RubenK
Thanks for the help! It worked! How would I go about hiding the field? On Aug 27, 4:28 pm, Michael wrote: > On Thu, Aug 27, 2009 at 9:55 AM, RubenK wrote: > > > I've setup my 'prepopulate_fields' so that it should automatically > > enter a slug in the

Re: Problem building data structure for Archive page

2009-08-27 Thread Gijs Nijholt
That's exactly what I needed. Thanks a lot. -- Gijs On Aug 27, 4:31 pm, David Zhou wrote: > On Thu, Aug 27, 2009 at 10:10 AM, gnijholt wrote: > > Or is there a better way to generate a full archive page (per year, > > per month)? > > You'll need to

Re: Model Theory 101 - Video Sharing App

2009-08-27 Thread Bill Freeman
Look at django-oembed. A CharField will serve for every (supported) provider. On Wed, Aug 26, 2009 at 8:17 PM, thornomad wrote: > > Hi - need some suggestions. > > I am trying to put together an app that allows users to submit links > to videos at popular video sharing

Re: Generating slugs

2009-08-27 Thread Daniel Roseman
On Aug 27, 2:55 pm, RubenK wrote: > I've setup my 'prepopulate_fields' so that it should automatically > enter a slug in the admin site, however when I click the 'add' link > it gives me the following error: > > "Key 'slug' not found in Form" > > I've triple checked all my

Re: Problem building data structure for Archive page

2009-08-27 Thread David Zhou
On Thu, Aug 27, 2009 at 10:10 AM, gnijholt wrote: > Or is there a better way to generate a full archive page (per year, > per month)? You'll need to test this, but you should be able to do that with {% ifchanged %}: #view: posts = Posts.objects.order_by('-pub_date')

Re: Generating slugs

2009-08-27 Thread Michael
On Thu, Aug 27, 2009 at 9:55 AM, RubenK wrote: > > I've setup my 'prepopulate_fields' so that it should automatically > enter a slug in the admin site, however when I click the 'add' link > it gives me the following error: > > "Key 'slug' not found in Form" > > I've triple

Generating slugs

2009-08-27 Thread RubenK
I've setup my 'prepopulate_fields' so that it should automatically enter a slug in the admin site, however when I click the 'add' link it gives me the following error: "Key 'slug' not found in Form" I've triple checked all my models and database tables and everything seems to be in order so I'm

Problem building data structure for Archive page

2009-08-27 Thread gnijholt
Hello Django-users, Actually it's more of a basic Python problem than a Django problem. I'll try to be brief: In the view, I'm looping through my posts as such: --- def archive(request): years = Post.objects.dates('pub_date', 'year') for year in years: print year.year

Re: template tag response None. but why?

2009-08-27 Thread Bill Freeman
I don't know what else is wrong but: On Wed, Aug 26, 2009 at 8:15 PM, MIL wrote: >bits = token.contents.split() should probably be: bits = token.split_contents() and render must return a string whether or not there is an ObjectDoesNotExist exception, so,

Re: get an object's model name

2009-08-27 Thread MIL
Thanks, both of you :o) I tried using it directly in my template like {{object.__class__.__name__}} But that didnt work. So I did it by adding this to my models: def get_model_name(self): return self.__class__.__name__ And it works Thanks again :o) On 27 Aug.,

Re: How to check which form was submitted?

2009-08-27 Thread Michael
On Thu, Aug 27, 2009 at 7:58 AM, Maksymus007 wrote: > > On Thu, Aug 27, 2009 at 1:41 PM, David Zhou wrote: > > > > On Thu, Aug 27, 2009 at 7:33 AM, Maksymus007 > wrote: > >> > >> On Thu, Aug 27, 2009 at 1:22 PM, David

Re: How to check which form was submitted?

2009-08-27 Thread Maksymus007
On Thu, Aug 27, 2009 at 1:41 PM, David Zhou wrote: > > On Thu, Aug 27, 2009 at 7:33 AM, Maksymus007 wrote: >> >> On Thu, Aug 27, 2009 at 1:22 PM, David Zhou wrote: >>> Post the part of your view that handles your forms. >> >> Nothing

Re: redirect in django

2009-08-27 Thread ankit rai
thanks i got the solution On Thu, Aug 27, 2009 at 4:28 PM, Matthias Kestenholz < matthias.kestenh...@gmail.com> wrote: > > On Thu, Aug 27, 2009 at 12:38 PM, ankit rai wrote: > > Nobody knows the answer to this question i think so > > > > Did you really expect an answer

Re: How to check which form was submitted?

2009-08-27 Thread David Zhou
On Thu, Aug 27, 2009 at 7:33 AM, Maksymus007 wrote: > > On Thu, Aug 27, 2009 at 1:22 PM, David Zhou wrote: >> Post the part of your view that handles your forms. > > Nothing special > >    if request.method == 'POST': >        form =

Re: How to check which form was submitted?

2009-08-27 Thread Maksymus007
On Thu, Aug 27, 2009 at 1:22 PM, David Zhou wrote: > > On Thu, Aug 27, 2009 at 7:09 AM, Maksymus007 wrote: >> >> I've got two different form on the same page, under the same URL. >> When I send one of them, the second one gets validated too. >> I set

Re: redirect in django

2009-08-27 Thread David Zhou
On Thu, Aug 27, 2009 at 6:58 AM, Matthias Kestenholz wrote: > >> On Thu, Aug 27, 2009 at 2:59 PM, ankit wrote: >>> >>> I am new to django.I having to app in my admin.Know I want to know >>> that how can i redirect user to one app listpage if

Re: get an object's model name

2009-08-27 Thread David Zhou
On Thu, Aug 27, 2009 at 7:08 AM, Léon Dignòn wrote: > from django.contrib.auth.models import User u = User.objects.get(id=1) u > print u > leon type(u) > Alternatively: >>> u.__class__.__name__ 'User' -- dz

Re: How to check which form was submitted?

2009-08-27 Thread David Zhou
On Thu, Aug 27, 2009 at 7:09 AM, Maksymus007 wrote: > > I've got two different form on the same page, under the same URL. > When I send one of them, the second one gets validated too. > I set prefixes but no change. > > Is there any way to distinguish between two forms,

Re: get an object's model name

2009-08-27 Thread Léon Dignòn
Hello, simply use type() >>> from django.contrib.auth.models import User >>> u = User.objects.get(id=1) >>> u >>> print u leon >>> type(u) -ld On Aug 27, 11:59 am, MIL wrote: > Hello :o) > > I would like to know how to get the model name of an object. > > sort of like

How to check which form was submitted?

2009-08-27 Thread Maksymus007
I've got two different form on the same page, under the same URL. When I send one of them, the second one gets validated too. I set prefixes but no change. Is there any way to distinguish between two forms, choosing one that have been submited?

Re: redirect in django

2009-08-27 Thread Matthias Kestenholz
On Thu, Aug 27, 2009 at 12:38 PM, ankit rai wrote: > Nobody knows the answer to this question i think so > Did you really expect an answer within an hour of sending the email to the list? A little bit of patience would really be in order here. If you need answers _fast_,

Re: redirect in django

2009-08-27 Thread ankit rai
Nobody knows the answer to this question i think so On Thu, Aug 27, 2009 at 2:59 PM, ankit wrote: > > Hello, > > > I am new to django.I having to app in my admin.Know I want to know > that how can i redirect user to one app listpage if clicks save on > second app.say from

Re: Django scalability with files

2009-08-27 Thread David Zhou
On Thu, Aug 27, 2009 at 6:13 AM, Lewis Taylor wrote: > > I have an imagefield that i want to create a thumbnail for on approval > of the image. The problem is (setup is 2 django instances, load > balancer and DB) if the image is stored on one machine it's not the >

Model Forms

2009-08-27 Thread Sid
I have 2 models say A and B, B has A has a foreign key reference to A. There is a model form created for mode B called as BForm. Now If i create instance of BForm and display it in a page, foreign key field appears as a drop down choice box in the form. Instead of this if i set instance of B to

Django scalability with files

2009-08-27 Thread Lewis Taylor
Question: I have an imagefield that i want to create a thumbnail for on approval of the image. The problem is (setup is 2 django instances, load balancer and DB) if the image is stored on one machine it's not the cleanest solution to have to get the image from the other server and process it. Is

get an object's model name

2009-08-27 Thread MIL
Hello :o) I would like to know how to get the model name of an object. sort of like object.get_model_name or something like that Is there a way to that. I tried altering my model something like this, but it doesnt work: def get_model_name(self): return '%s'%(class)

redirect in django

2009-08-27 Thread ankit
Hello, I am new to django.I having to app in my admin.Know I want to know that how can i redirect user to one app listpage if clicks save on second app.say from app2 to app1 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Many-to-many column admin interface

2009-08-27 Thread Sven Richter
Hi, i have a new problem with my many-to-many field. I have two models A and B. A(models.model): b = models.ManyToManyField('app.B') Now when i edit A in the admin interface everything is ok, i can select all B instances A belongs to. What i need now is to be able to do the same thing from

Filter

2009-08-27 Thread Güngör Basa
Hi.I have a problem with my filter. I want to filter date and time but filter is not working.I am sending my models.py from django.db import models from datetime import datetime from datetime import date from datetime import time class Randevu(models.Model): def __unicode__(self):

Re: Forms for views

2009-08-27 Thread gentlestone
Thanks, it looks like a good very light example, how to build such a framework. What is good I am thinking in a good way, just no adequate framework exists yet. On 26. Aug, 18:14 h., Daniel Roseman wrote: > On Aug 26, 4:14 pm, gentlestone wrote: >

Re: print PDF on windows

2009-08-27 Thread mettwoch
Apache is running under a system account. A quick test of running Apache under my user account enabled printing indeed. I'll follow your suggestion and create a dedicated user with restricted rights to run Apache under. Thanks so much for your help Marc On Aug 27, 2:42 am, Sam Lai

Re: Django + Godaddy

2009-08-27 Thread Nanopino
I just got off the phone with godaddy for the last time. I've canceled my hosting with them as they are reluctant to install python-sqlite2. Something as simple as database libraries that can be yum installed and they wouldn't budge. They really wanted me to switch to VPS with them. It took me 2

Re: unicode problem?

2009-08-27 Thread andreas schmid
take a look at that discussion: http://groups.google.com/group/django-users/browse_thread/thread/1de89cdee99b1086 lerner wrote: > def output(request): > response = HttpResponse(mimetype='text/csv') > response['Content-Disposition'] = 'attachment; filename=%s' % > 'address.csv' > t =