Re: Using request.GET and having issues

2011-04-16 Thread Shawn Milochik
This doesn't appear to be a Django question. Your 'results' variable is being populated by checking the length of an nltk.text.ConcordanceIndex() instance. I'm not familiar with the nltk module, but I'm assuming you are at least a little, since you're using it. It appears that its length isn't usef

Unexplainable delay when binding request.POST to form

2011-04-16 Thread Toni Milovan
Hi, I'm getting 20-30 seconds delay when trying to bind request.POST data to form. - CompanyFormset = modelformset_factory(Company, form=EditCompanyForm, extra=0) if request.method == 'POST': formset = CompanyFormset(request.POST, request.FILES) if for

Re: Using request.GET and having issues

2011-04-16 Thread Karen Tracey
2011/4/16 Karen McNeil > I have the following view set up: > > def concord(request): >searchterm = request.GET['q'] >... more stuff ... >return render_to_response('concord.html', locals()) > > With URL "http://mysite.com/concord/?q=برشه";, and template code > Your search for {{ se

Re: Unexplainable delay when binding request.POST to form

2011-04-16 Thread Karen Tracey
On Sat, Apr 16, 2011 at 7:10 AM, Toni Milovan wrote: > I'm getting 20-30 seconds delay when trying to bind request.POST data > to form. > > - >CompanyFormset = modelformset_factory(Company, > form=EditCompanyForm, extra=0) > >if request.method == 'POST': >formset =

Re: Using request.GET and having issues

2011-04-16 Thread Walt
> searchterm = request.GET['q'] Shouldn't this be: request.GET.get('q','') Walt -~ -- 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 email

Re: 'Context' object has no attribute 'render_context'

2011-04-16 Thread Walt
I'm not sure I know why your code is misbehaving, but any particular reason you aren't using render_to_response instead of template/context rendering? http://docs.djangoproject.com/en/dev/topics/http/shortcuts/#render-to-response It's much simpler! Walt -~ -- You received this message because

Re: New python, django user... having issues

2011-04-16 Thread Walt
Windows 64 does make things interesting, but just to summarize what I do to install on Windows: Install python2.5: http://www.python.org/download/releases/2.5.4/ Install latest apache: http://httpd.apache.org/download.cgi#apache22 Install mod_python for python 2.5: http://archive.apache.org/dist/h

Python quit unexpectedly

2011-04-16 Thread Hudar
Hi, Anyone got this problem? I try to run grappelli on django 1.3. and run this command : #python manage.py runserver Server running. Withouth grappeli, I can go to django admin page. But after install grappelli, and try to access http://127.0.0.1/admin/ error appear 'Python quite unexpectedly'

Re: Using request.GET and having issues

2011-04-16 Thread Karen McNeil
No, that's not the issue. In addition to displaying the count, the page also shows the resulting sentences, and the count here is correct because no results were returned. I think Karen, below, might be right that it has something to do with the encoding of the search string... I'll try working th

Aw: How to unit test if user has access to page

2011-04-16 Thread Martin Brochhaus
Also beware! Only do a client.post if you really want to test that a user submits a form. Usually when a not-logged-in-user wants to go to a secured page immediately he will try a get request and just enter the URL. Sometimes your view behaves differently on get and on post (most of the times) s

Re: New python, django user... having issues

2011-04-16 Thread leo
I have two models, model A and model B , model A like this CUSTOMER_NAME = ( (IBM, 'IBM'), (GSMC, 'GSMD'), (CSMC, 'CSMC'), (HJTC, 'HJTC'), customer_name = models.IntegerField(choices = CUSTOMER_NAME, default = IBM,) activity_type = models.IntegerField(choices = ACTIVITY_TYPE

limit_choices_to (or some other way) to filter ForeignKey choices based on current model field

2011-04-16 Thread Aljoša Mohorović
if i have something like this: === class MyModel(models.Model): name = models.CharField(max_length=255) class OtherModel(models.Model): name = models.CharField(max_length=255) mymodel = models.ForeignKey(MyModel) class MyModelItem(models.Model): mymodel = models.ForeignKey(M

Re: Using request.GET and having issues

2011-04-16 Thread Karen McNeil
Yep, the encoding was the problem. I just added a line searchterm = searchterm.encode('utf-8') and now it works! Thank you! On Apr 16, 9:19 am, Karen Tracey wrote: > 2011/4/16 Karen McNeil > > > > > I have the following view set up: > > > def concord(request): > >    searchterm = reques

Re: Python quit unexpectedly

2011-04-16 Thread Yuka Poppe
On Sat, Apr 16, 2011 at 6:17 PM, Hudar wrote: > Withouth grappeli, I can go to django admin page. But > after install grappelli, and try to access  http://127.0.0.1/admin/ > error appear 'Python quite unexpectedly'. Hello Hudar, It means python crashed, in general this occurs when theres a probl

Test fails to run

2011-04-16 Thread Aleksandr Vladimirskiy
Hello, I'm running a test but it fails after syncdb part with the following message: Error: Database test_ couldn't be flushed. Possible reasons: * The database isn't running or isn't configured correctly. * At least one of the expected database tables doesn't exist. * The SQL was invalid.

Re: Using request.GET and having issues

2011-04-16 Thread Karen Tracey
2011/4/16 Karen McNeil > Yep, the encoding was the problem. I just added a line >searchterm = searchterm.encode('utf-8') > Does the nltk code not support unicode? A better solution would be to never do explicit encoding yourself, but rather just pass unicode from the DB and unicode from req

Using composition in Django

2011-04-16 Thread Guevara
Hello! I have two class, Person and employee, i need make a composition for this (Prefer composition over inheritance): class Person(models.Model): name = models.CharField(max_length=50) date_inclusion = models.DateField() # others fields class Employee(models.Model): person = mod

Re: Test fails to run

2011-04-16 Thread gladys
Hi, In which part of the test are you truncating the db? It could also be that test_ db is still in your database after a previous run of test, and it refuses to flush. Try manually deleting it and running syncdb again. -- Gladys http://blog.bixly.com On Apr 17, 1:20 am, Aleksandr Vladimirskiy

django models, nested classes, and some weird behavior

2011-04-16 Thread Ellery Newcomer
Hello. In an app I'm working on I have a package which contains an arbitrary number of modules, each of which is expected to contain several django models. In each module, the models have the same name, but they are nested in an outer class, which I assume shouldn't cause problems. However, it doe

Re: New python, django user... having issues

2011-04-16 Thread Walt
I think you're hijacking this thread, yes? Can you submit all the code for the models, please? Perhaps start a new thread... -- 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

Re: New python, django user... having issues

2011-04-16 Thread Łukasz Rekucki
On 16 April 2011 16:36, Walt wrote: > Windows 64 does make things interesting, but just to summarize > what I do to install on Windows: > > Install mod_python for python 2.5: Do yourself a favour and switch to something else then mod_python. It's a dead project (that's why it probably won't work

Re: Put an "inline" at the top of admin form instead of bottom?

2011-04-16 Thread Yuka Poppe
Hi Jeff, I dont knw the details of the top of my head, but you could place inherit a changeform template dedicated for your specific app/model, and simply edit it to have the inline formsets on the top, or use a conditional template tag to display only one of your inline models at the top. I think

Re: Using composition in Django

2011-04-16 Thread Yuka Poppe
Hi Guevara, Proxy models only inherit python logic, they are what you expect when you subclass a superclass; I dont think thats what you want in this case. I think you actually do want multi-table inheritence, im not too well educated in "design patterns" but i think thats what you mean by compos

Re: 'Context' object has no attribute 'render_context'

2011-04-16 Thread jhen095
Thanks Walt. I'm not sure why the code is misbehaving either but render_to_response works so I'll roll with that. Cheers On Apr 16, 10:22 am, Walt wrote: > I'm not sure I know why your code is misbehaving, but any > particular reason you aren't using render_to_response instead > of template/con

Re: Using composition in Django

2011-04-16 Thread Ian Clelland
On Sat, Apr 16, 2011 at 1:35 PM, Guevara wrote: > Hello! > I have two class, Person and employee, i need make a composition for > this (Prefer composition over inheritance): > > class Person(models.Model): >name = models.CharField(max_length=50) >date_inclusion = models.DateField() >#

Re: New python, django user... having issues

2011-04-16 Thread Vang
Hey, thank you guys so much for your help. I was able to get everything installed. Appreciate it lots. On Apr 16, 2:40 pm, Łukasz Rekucki wrote: > On 16 April 2011 16:36, Walt wrote: > > > Windows 64 does make things interesting, but just to summarize > > what I do to install on Windows: > > > I