Writing my first view

2011-06-05 Thread bahare hoseini
hi there, i use django vs1.3 i started editing urls.py to look loke this: from django.conf.urls.defaults import * from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^polls/$', 'polls.views.index'), (r'^polls/(?P\d+)/$', 'polls.views.detail'),

Re: Request and null value

2011-06-05 Thread Jani Tiainen
On Sun, 2011-06-05 at 22:36 -0700, Constantine wrote: > Hi, a have a problem, but may be this is expected behaviour: > > on client side i'm post: > $.post("my url",{myvar:null}...) > > but on server side: > request.POST becomes {myvar:u'null'} > > null deserialized to string. So, do i need to re

Request and null value

2011-06-05 Thread Constantine
Hi, a have a problem, but may be this is expected behaviour: on client side i'm post: $.post("my url",{myvar:null}...) but on server side: request.POST becomes {myvar:u'null'} null deserialized to string. So, do i need to report a bug in tracker? -- You received this message because you are su

Re: File upload limits

2011-06-05 Thread Siddharth S
I'm running apache2 on the server. But as I mentioned, a parallel site based on PHP is able to take file uploads larger than 1Mb. So, I guess it isn't an apache configuration problem. On Sun, Jun 5, 2011 at 9:38 PM, ionic drive wrote: > This i guess is not a django setting. > Its a setting of yo

Re: Beginner needing help with a TemplateDoesNotExist exception, when the file does exist.

2011-06-05 Thread Karen Tracey
On Sun, Jun 5, 2011 at 11:23 PM, Christopher wrote: > Martin > > Just to let you know, moving the templates directory to the root of my > project did indeed work. I no longer get that exception. However, I > would still like to know why django was telling me that the file does > not exist when

Re: Beginner needing help with a TemplateDoesNotExist exception, when the file does exist.

2011-06-05 Thread Kenneth Gonsalves
On Sun, 2011-06-05 at 20:23 -0700, Christopher wrote: > would still like to know why django was telling me that the file does > not exist when it clearly does. some of django's error messages are misleading. 'Does not exist' often means - 'does not compile' or 'cannot find'. -- regards KG http:/

Re: Beginner needing help with a TemplateDoesNotExist exception, when the file does exist.

2011-06-05 Thread Christopher
Martin Just to let you know, moving the templates directory to the root of my project did indeed work. I no longer get that exception. However, I would still like to know why django was telling me that the file does not exist when it clearly does. I posted my virtual host config so if you, or a

Re: Beginner needing help with a TemplateDoesNotExist exception, when the file does exist.

2011-06-05 Thread Mike Dewhirst
Sorry Chris, I was being a bit cryptic ... Here is an excerpt from my settings.py PROJECT_DIR = os.path.realpath(os.path.dirname(__file__)).replace('\\','/') # if templates are not found here look in app_name/templates TEMPLATE_DIRS = (os.path.join(PROJECT_DIR, 'templates/').replace('\\','/'),)

Re: Beginner needing help with a TemplateDoesNotExist exception, when the file does exist.

2011-06-05 Thread Christopher
Hi Martin Thanks for this insight. I saw them placing templates outside the project directory in the tutorial, so I thought that might be a common thing to do. I am switching from php to python, so I'm learning a lot. What you say does make sense from a SCM point of view. I am assuming that mo

Re: Confused about uploading files (Cannot force both insert and updating in model saving)

2011-06-05 Thread Kenneth Gonsalves
On Sun, 2011-06-05 at 19:18 -0700, Roy Smith wrote: > ctx = {'form': form} > ctx.update(csrf(request)) indent these two lines -- regards KG http://lawgon.livejournal.com Coimbatore LUG rox http://ilugcbe.techstud.org/ -- You received this message because you are subscribed to the Googl

Confused about uploading files (Cannot force both insert and updating in model saving)

2011-06-05 Thread Roy Smith
I'm trying to figure out how to upload a file. I've got a model that looks like: class DataSet(models.Model): file = models.FileField(upload_to='data/%Y/%m/%d') and my view method is: def create_data_set(request): if request.method == 'POST': form = DataSetForm(request.POST,

Re: Beginner needing help with a TemplateDoesNotExist exception, when the file does exist.

2011-06-05 Thread Kenneth Gonsalves
On Sun, 2011-06-05 at 18:47 -0700, Christopher wrote: > >From what I understand, the location of my templates is supposed to > go > in the TEMPLATE_DIRS block of the settings.py file. This directory is > located in my home/foobar/, thus the /home/foobar/templates. > > Is there something wrong wit

Re: Beginner needing help with a TemplateDoesNotExist exception, when the file does exist.

2011-06-05 Thread Martin
It's a bit weird that you have your templates in your home folder. I would expect them to be in your project's folder. For example: /home/foobar/projects/yourproject/templates If you were using some version control software like git you would want to have everything that belongs to yout project i

Re: Django Development Environments

2011-06-05 Thread Shawn Milochik
On 06/05/2011 12:38 PM, Xavier Ordoquy wrote: For production: Ubuntu (10.x for now) buildout nginx + gunicorn stack Regards, Xavier. +1 for gunicorn & nginx -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email

Re: Beginner needing help with a TemplateDoesNotExist exception, when the file does exist.

2011-06-05 Thread Christopher
>From what I understand, the location of my templates is supposed to go in the TEMPLATE_DIRS block of the settings.py file. This directory is located in my home/foobar/, thus the /home/foobar/templates. Is there something wrong with this? On Jun 5, 4:38 pm, Mike Dewhirst wrote: > On 6/06/2011 6

Re: Edit instance for ModelChoiceField not getting selected selected

2011-06-05 Thread Martin Ostrovsky
Without seeing your model or your data, it's hard to tell what's going on. You're overriding the queryset for those two fields. If the instance's values for those two fields is not in that updated queryset, then your widgets won't get a default value. In other words, if the value of "b_name" for

Need some help with MySQL and on OSX

2011-06-05 Thread Kolbe
Anyone have any good documentation on getting django with MySQL on OSX out there? Cheers! Kolbe -- 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,

Re: bounces

2011-06-05 Thread Kenneth Gonsalves
On Sun, 2011-06-05 at 08:26 -0700, creecode wrote: > I'm assuming you mean the bounces are coming from emails you send in > response to emails from this Google group? I can't answer that one as > I use > the web interface exclusively. > > If the above isn't correct could you give us more detail

Re: connection refused when running django-celery

2011-06-05 Thread Kenneth Gonsalves
On Sun, 2011-06-05 at 08:03 -0700, Martin Ostrovsky wrote: > What are you using for your AMQP? I use celery with RabbitMQ. You have > to start your AMQP service first, then celery. I realised that - but now rabbitmq is refusing to run on fedora 14. Am investigating. -- regards KG http://lawgon.l

Prototype: LINQ-esque Manager for Django models

2011-06-05 Thread Juan Pablo Romero Méndez
Hello, I've just put a very rough prototype of a db.models.Manager that allows queries to be specified with lambdas: Choice.objects.where(lambda c: c.votes >= 1) Choice.objects.where(lambda c: c.votes != 1) Choice.objects.where(lambda c: c.poll.question.exact('aaa')) Choice.objects.where(lambda c

Re: Beginner needing help with a TemplateDoesNotExist exception, when the file does exist.

2011-06-05 Thread Mike Dewhirst
On 6/06/2011 6:51am, Christopher wrote: 110 "/home/foobar/templates", ??? -- 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 to

Re: Django Development Environments

2011-06-05 Thread Simon Connah
On 5 Jun 2011, at 16:11, Developr wrote: > Hi! > > I'm currently developing for Django using the following the setup: > > Ubuntu 10.10 > PyCharm > VirtualEnv > Yolk > Pip > > For testing I generally just use the inbuilt dev server that Django > provides. > > For production I'm currently using

Beginner needing help with a TemplateDoesNotExist exception, when the file does exist.

2011-06-05 Thread Christopher
OK. I have read many other accounts of this happening, and they were always solved when the question asker correctly modified their TEMPLATE_DIRS setting. None of these suggestions have worked for me. The strange thing is that the template loads when using the Django web server, but errors out when

Re: what is the recommended way to display currency?

2011-06-05 Thread snfctech
I guess this snippt would avoid the locale issue, but I don't know why something basic like this wouldn't be more obvious in the docs or included in the django core libraries.. http://djangosnippets.org/snippets/2365/ On Jun 5, 1:39 pm, snfctech wrote: > I thought this should be obvious but am h

what is the recommended way to display currency?

2011-06-05 Thread snfctech
I thought this should be obvious but am having a hard time finding it in the docs. There are a couple snippets that suggest using a custom currency filter: http://www.djangosnippets.org/snippets/552/ http://djangosnippets.org/snippets/1825/ But both use locale.setlocale, which is apparently not

Re: __unicode__() addition not working in basic poll application.

2011-06-05 Thread EPS
Hi, i found this post when try to solve same problem: my trouble was a "spaces" in models.py. in your first message it seems to be ok, but you must really check spaces in your class describe. http://mail.python.org/pipermail/tutor/2007-January/051903.html On May 17, 4:59 pm, maaz muqri wrote: > i

Re: Django Development Environments

2011-06-05 Thread Xavier Ordoquy
Hi > Ubuntu 10.10 > PyCharm > VirtualEnv > Yolk > Pip OSX PyCharm virtualenv + pip and/or buildout django-command-extensions and django-debug-toolbar > For testing I generally just use the inbuilt dev server that Django > provides. TDD (unit tests) + BDD (freshen) > For production I'm currentl

Re: File upload limits

2011-06-05 Thread ionic drive
This i guess is not a django setting. Its a setting of your webserver (Nginx, Apache2, etc.) If you do use Nginx as an example, this setting would be client_max_body_size. http://www.rockia.com/2011/01/how-to-change-nginx-file-upload-size-limit good luck scrapper On Sun, 2011-06-05 at 06:57 -

Re: Dynamic verbose_name_plural to display number of models in admin panes

2011-06-05 Thread Alexey Moskvin
Tim, thanks for your help! Also, I've found another solution for this problem: http://stackoverflow.com/questions/6241906/display-number-of-instances-for-each-model-in-djangos-admin-index On 5 июн, 16:50, Tim Shaffer wrote: > You could probably do it using a signal. Every time a record is created

Re: bounces

2011-06-05 Thread creecode
Hello KG, On Sunday, June 5, 2011 12:03:51 AM UTC-7, lawgon wrote: is anyone else getting bounces starting like this? I'm assuming you mean the bounces are coming from emails you send in response to emails from this Google group? I can't answer that one as I use the web interface exclusively

Re: Django Development Environments

2011-06-05 Thread Martin
Ubuntu 11.04 Wing IDE virtualenv pip github TDD using the inbuild dev server Production: Hosted on Webfaction nginx for static files Apache with mod_wsgi Best regards, Martin On Sun, Jun 5, 2011 at 11:11 PM, Developr wrote: > Hi! > > I'm currently developing for Django using the following the

Django Development Environments

2011-06-05 Thread Developr
Hi! I'm currently developing for Django using the following the setup: Ubuntu 10.10 PyCharm VirtualEnv Yolk Pip For testing I generally just use the inbuilt dev server that Django provides. For production I'm currently using nginx and FapWS3 - whilst it works great, with FapWS3 not running thre

Re: connection refused when running django-celery

2011-06-05 Thread Martin Ostrovsky
What are you using for your AMQP? I use celery with RabbitMQ. You have to start your AMQP service first, then celery. On Jun 4, 2:17 am, Kenneth Gonsalves wrote: > hi, > > I am trying django-celery, but on running: > > python manage.py celeryd -l info > > I get this error: > > [2011-06-04 01:08:5

File upload limits

2011-06-05 Thread Siddharth Swaminathan
Hi, I have a django project where I have a form to upload files. The problem is that I'm not able to upload files larger than 192Kb. Is there some django setting that can be used to change this behaviour? Also, I've eliminated the possibility of apache configuration problems, coz a parallel dr

Re: Dynamic verbose_name_plural to display number of models in admin panes

2011-06-05 Thread Tim Shaffer
You could probably do it using a signal. Every time a record is created or deleted, you can update the verbose_name_plural with the current count. from django.db.models.signals import post_save, post_delete def update_verbose_name(sender, **kwargs): Elephant._meta.verbose_name_plural = 'elep

Dynamic verbose_name_plural to display number of models in admin panes

2011-06-05 Thread Alexey Moskvin
Hi, I need to display number of objects at main django site admin page. For example, in list of models I need to display Elephants (6) instead of Elephants I added this code to my model: class Elephant(models.Model): class Meta: verbose_name_plural = 'Elephant ' + '(' + unicod

Edit instance for ModelChoiceField not getting selected selected

2011-06-05 Thread sushanth Reddy
Hi, When i edit a records none of the modelchoicefields are getting selected using form edit form instance. I have gone though below blog, but confusing http://blog.brendel.com/2009/07/setting-initial-value-for-djangos.html *view.py* : def EditTable(request, get_id): detail_data = shortc

Re: confused over use of XYZ.objects.get() method

2011-06-05 Thread Michal Petrucha
On Sat, Jun 04, 2011 at 12:21:37PM -0700, Ryan wrote: > Right, if what you have typed in your post is the code you are actually > trying to use, there are two problems that jump out at me. > > The first is that *question = models.CaaQuestion(pk=210) *will actually > create a new question with th

Re: confused over use of XYZ.objects.get() method

2011-06-05 Thread Michal Petrucha
On Sat, Jun 04, 2011 at 09:01:36PM -0500, Javier Guerra Giraldez wrote: > I have never seen that usage of Meta. where is it documented? I'd say such usage would fail, see https://code.djangoproject.com/browser/django/trunk/django/db/models/options.py#L96 All in all, adding custom attributes to Me

sorl-thumbnail: upscale won't wok

2011-06-05 Thread Eugene Goldberg
Hello! I'm trying to create a thumbnail using sorl-thumbnail in Django template: source: {{ photo.image.width }} x {{ photo.image.height }} {% thumbnail photo.image "1024x1024" upscale="False" as photo_thumbnail %} thumbnail: {{ photo_thumbnail.width }} x {{ photo_thumbnail.height }} {% en

bounces

2011-06-05 Thread Kenneth Gonsalves
hi, is anyone else getting bounces starting like this? 'The user dws at wildpalmsresources.com does not accept mail from your address'. -- regards KG http://lawgon.livejournal.com Coimbatore LUG rox http://ilugcbe.techstud.org/ -- You received this message because you are subscribed to the Goo