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 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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 }} 
  
{% endthumbnail %}

photo.image contains target image, after rendering I've got:

source: 522 x 374 thumbnail: 1024 x 734

and there is big ugly upscaled image. Why does sorl-thumbnail still
upscale image even then upscale option is False?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 Meta isn't supported, unless
they're private (they start with _) in which case they are ignored.

Michal


signature.asc
Description: Digital signature


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 the primary key 210, not fetch one from the 
> database, so when you try to use this to find answers in the subsequent 
> lines it will not find anything as it is not currently in any of those 
> tables.
I don't think this is entirely true. You're right in the fact that the
created CaaQuestion instance will not be fetched nor saved, that
however doesn't mean it isn't in the database.

However, it is correct to use such instance in filters. In that case,
django picks up the vlue of the target field from the instance and
uses that to build the database query. If there is no such row in the
table with this ID, the QuerySet will just return an empty result.

> The second if the FieldError you are receiving.  This is because the 
> question_id and assessment_id arguments should have double underscores to 
> tell django that you are trying to span a relationship.  So these two should 
> actually be question__id and assessment__id.  However the line above that 
> with question = question and assessment = assessment should work fine when 
> you have a question that is actually in the database.
This is correct under the assumption that Assessment has id as its
primary key. Otherwise you should use _pk to be on the safe side.

Nevertheless, when my patch for
https://code.djangoproject.com/ticket/5535 gets in, it will be
possible to specify the primary key value explicitly, the same way
Fred tried to.

Michal


signature.asc
Description: Digital signature


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 = shortcuts.get_object_or_404(models.TestTable, id=get_id)
  if request.method == 'POST':
form = forms.EditForm(
request, data=request.POST, instance=detail_data)
if form_is_valid():
form.save()
  else:
form  =  forms.EditForm(instance=detail_data)
 return form

*form.py*

class EditForm(forms.ModelForm):
  activity = forms.TypedChoiceField(choices=choice.Activity_CHOICES)
  def __init__(self,  *args, **kwargs):
super(EditForm, self).__init__(*args, **kwargs)
self.fields['b_name'] = forms.ModelChoiceField(
queryset=models.CreateDb.objects.filter( list_p='English', 
status='A'),
self.fields['type'] = forms.ModelChoiceField(
queryset=models.CreateType.objects.filter( list_T='Grammer', 
status='A'),

I any help really appreciate. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/eGVYTVF2bU04YmNK.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 ' + '(' +
unicode(count_elephants()) + u')'

where count_elephants() calculates number of objects. The problem is
that verbose_name_plural  is calculated at server start and is not
called when I delete/insert objects, so this calculated value becomes
irrelevant.
Is it possible to do it in correct way?
Thanks!

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 = 'elephants (%s)' % Elephant()

post_delete.connect(update_verbose_name, sender=Elephant)
post_save.connect(update_verbose_name, sender=Elephant)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/b1hxcndNWGRCRElK.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 drupal site on the same server is able to accept files larger 
than even 1Mb.

Any help would be appreciated.

Thanks in advance,
Siddharth Swaminathan

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/VjJXMVhZeWE2WHNK.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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:51,946:
> WARNING/MainProcess]                                                          
>                       
>
>  -- cel...@xlquest.web
> v2.2.6                                                                        
>             
>  
> -                                                                         
>                                      
> --- * ***  * --
> [Configuration]                                                               
>                                
> -- * -  ---   . broker:
> amqplib://root@localhost:5672/                                                
>               
> - ** --   . loader:
> djcelery.loaders.DjangoLoader                                                 
>                
> - ** --   . logfile:
> [stderr]@INFO                                                                 
>                
> - ** --   . concurrency:
> 2                                                                             
>                
> - ** --   . events:
> OFF                                                                           
>                
> - *** --- * ---   . beat:
> OFF                                                                           
>                
> -- ***
>                                                                           
>                                     
> --- * - [Queues]
>  --   . celery:      exchange:celery (direct) binding:celery
>
> [Tasks]
>
> [2011-06-04 01:08:51,968: INFO/PoolWorker-1] child process calling
> self.run()
> [2011-06-04 01:08:51,974: INFO/PoolWorker-2] child process calling
> self.run()
> [2011-06-04 01:08:51,980: WARNING/MainProcess] cel...@xlquest.web has
> started.
> [2011-06-04 01:08:51,983: ERROR/MainProcess] Consumer: Connection Error:
> [Errno 111] Connection refused. Trying again in 2 seconds...
>
> I know this is a bit OT here, but I hope some one can throw light on
> this
> --
> regards
> KGhttp://lawgon.livejournal.com
> Coimbatore LUG roxhttp://ilugcbe.techstud.org/

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 threaded I'm looking into other
alternatives.

I'm curious to see what other developers are using for their
projects!

Thanks.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 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 threaded I'm looking into other
> alternatives.
>
> I'm curious to see what other developers are using for their
> projects!
>
> Thanks.
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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.

If the above isn't correct could you give us more detail?

Toodle-lo
creecode

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/MFJodmtIUmF3TVVK.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 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 = 'elephants (%s)' % Elephant()
>
> post_delete.connect(update_verbose_name, sender=Elephant)
> post_save.connect(update_verbose_name, sender=Elephant)

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 -0700, Siddharth Swaminathan wrote:
> 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 drupal site on the same server is able to
> accept files larger than even 1Mb.
> 
> 
> Any help would be appreciated.
> 
> 
> Thanks in advance,
> Siddharth Swaminathan
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/VjJXMVhZeWE2WHNK.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users
> +unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.


-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 currently using nginx and FapWS3 - whilst it works
> great, with FapWS3 not running threaded I'm looking into other
> alternatives.

For production:
Ubuntu (10.x for now)
buildout
nginx + gunicorn stack

Regards,
Xavier.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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:
> im just getting "Poll object" as output
>
> On May 17, 1:14 pm, Roman Klesel  wrote:> 
> 2011/5/16 maaz muqri :
>
> > > I am getting this
>
> > Poll.objects.all()
> > > []
>
> > What do you get when you do:
>
> > print unicode(Poll.objects.all()[0])
>
> > ?
>
> > Regards
> >  Roman

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 thread safe.

So am I stuck with decimal formatting and hard-coding a currency
symbol somewhere?

Thanks.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 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 thread safe.
>
> So am I stuck with decimal formatting and hard-coding a currency
> symbol somewhere?
>
> Thanks.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 using mod_wsgi. I think django is maybe
throwing an incorrect exception, because the TemplateDoesNotExist
error simply can not apply given my settings.

My code:

my app/views/view.py (yes, i have my views in a subfolder)

  8 def index(request):
  9 return render_to_response('pages/home/base_home.html')

Here is my settings.py located at root (standard location)

106 TEMPLATE_DIRS = (
107 # Put strings here, like "/home/html/django_templates" or "C:/
www/django/templates".
108 # Always use forward slashes, even on Windows.
109 # Don't forget to use absolute paths, not relative paths.
110 "/home/foobar/templates",
111 )

And finally, here is my view located at /home/foobar/templates/pages/
home/

  1 {% extends 'base.html' %}
  2
  3 {% block navigation %}
  4 {% include 'modules/navigation/navigation.html' %}
  5 {% endblock %}
  6
  7 {% block slideshow %}
  8 {% include 'modules/slideshow/slideshow.html' %}
  9 {% endblock %}

Also, here is an ls -l proving that the file does exist

foo@bar:~$ ls -l templates/pages/home/
total 12
-rwxr-xr-x 1 foo foo 205 2011-06-05 12:37 base_home.html
foo@bar:~$

Here is the postmortem report that Django gives me:

Template-loader postmortem

Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
/home/foobar/templates/pages/home/base_home.html (File does not exist)
Using loader django.template.loaders.app_directories.Loader:
/usr/local/lib/python2.6/dist-packages/django/contrib/admin/templates/
pages/home/base_home.html (File does not exist)

Thank you for any insight, as I am baffled and stuck!

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 nginx and FapWS3 - whilst it works
> great, with FapWS3 not running threaded I'm looking into other
> alternatives.
> 
> I'm curious to see what other developers are using for their
> projects!
> 
> Thanks.

For development:

Mac OS X
MacVim
Virtualenv (production also)
Pip (production also)
Mercurial and Bitbucket (used for deployment also)

For production:

Debian 6 / Ubuntu 10.04
Nginx + Flup (FastCGI configuration)
Daemontools
Soon to be integrating Fabric into production process too

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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: c.poll.question.contains('aa'))
Choice.objects.where(lambda c: c.votes == c.anumber)
Choice.objects.where(lambda c: c.votes > c.anumber)


https://github.com/jpablo/django-orm-lambdas


Regards,

  Juan Pablo

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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? 

correct
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 the instance is 1 and the
queryset is limited to values 2,3,4 and 5, then you won't see a
default value.

On Jun 5, 6:06 am, sushanth Reddy  wrote:
> 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 = shortcuts.get_object_or_404(models.TestTable, id=get_id)
>   if request.method == 'POST':
>     form = forms.EditForm(
>         request, data=request.POST, instance=detail_data)
>     if form_is_valid():
>         form.save()
>   else:
>     form  =  forms.EditForm(instance=detail_data)
>  return form
>
> *form.py*
>
> class EditForm(forms.ModelForm):
>   activity = forms.TypedChoiceField(choices=choice.Activity_CHOICES)
>   def __init__(self,  *args, **kwargs):
>     super(EditForm, self).__init__(*args, **kwargs)
>     self.fields['b_name'] = forms.ModelChoiceField(
>         queryset=models.CreateDb.objects.filter( list_p='English',
> status='A'),
>     self.fields['type'] = forms.ModelChoiceField(
>         queryset=models.CreateType.objects.filter( list_T='Grammer',
> status='A'),
>
> I any help really appreciate.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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: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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 inside your project folder.
Otherwise you would have to create several repositories (one for your apps
and views and one for your templates) which doesn't really make sense.

But in the end that is probably up to you.

Best regards,
Martin

On Mon, Jun 6, 2011 at 9:47 AM, 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 with this?
>
> On Jun 5, 4:38 pm, Mike Dewhirst  wrote:
> > 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 with this? 

no
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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,
   request.FILES)
if form.is_valid():
f = request.FILES['file']
data_set = DataSet()
data_set.save('foo', f)
return HttpResponseRedirect("/")
print "invalid"
else:
form = DataSetForm()
ctx = {'form': form}
ctx.update(csrf(request))
return render_to_response('chart/data_set.html', ctx)

with a form

class DataSetForm(forms.Form):
file = forms.FileField()

When I execute this, I get a form containing a file picker (so far, so
good), but when I submit the form I get a mysterious error (below).
What am I doing wrong?


Environment:


Request Method: POST
Request URL: http://localhost:8000/dataset/create

Django Version: 1.3
Python Version: 2.6.1
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'chart']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File "/Users/roy/lib/webchart/lib/python2.6/site-packages/Django-1.3-
py2.6.egg/django/core/handlers/base.py" in get_response
  111. response = callback(request,
*callback_args, **callback_kwargs)
File "/Users/roy/WebChart/chart/views.py" in create_data_set
  27. data_set.save('foo', f, False)
File "/Users/roy/lib/webchart/lib/python2.6/site-packages/Django-1.3-
py2.6.egg/django/db/models/base.py" in save
  459. raise ValueError("Cannot force both insert and
updating in model saving.")

Exception Type: ValueError at /dataset/create
Exception Value: Cannot force both insert and updating in model
saving.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 most django'ers put their templates inside of the
project?  The thing that really bugs me is that the site works
perfectly using the django web server, but when I deploy to apache
wsgi, it gives me that exception.  I am almost thinking that it is my
apache virtual host config.  Here it is if this can help anyone shine
some light onto this issue.

  1 NameVirtualHost *
  2 
  3
  4 ServerName foo
  5 DocumentRoot /media/PENDRIVE/Projects/foo/
  6
  7 
  8 Order allow,deny
  9 Allow from all
 10 
 11
 12
 13 ErrorLog ${APACHE_LOG_DIR}/foo-error.log
 14
 15 # Possible values include: debug, info, notice, warn, error,
crit,
 16 # alert, emerg.
 17 LogLevel warn
 18
 19 CustomLog ${APACHE_LOG_DIR}/foo.log combined
 20
 21 WSGIDaemonProcess foo python-path=/media/PENDRIVE/Projects/foo
 22 WSGIProcessGroup foo
 23 WSGIScriptAlias / /media/PENDRIVE/Projects/foo/deploy/
pinax.wsgi
 24
 25 

Thanks again

Cheers!

On Jun 5, 6:58 pm, Martin  wrote:
> 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 inside your project folder.
> Otherwise you would have to create several repositories (one for your apps
> and views and one for your templates) which doesn't really make sense.
>
> But in the end that is probably up to you.
>
> Best regards,
> Martin
>
> On Mon, Jun 6, 2011 at 9:47 AM, 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 with this?
>
> > On Jun 5, 4:38 pm, Mike Dewhirst  wrote:
> > > 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
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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('\\','/'),)

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
# filesystem ahead of app_directories looks in project first
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader'
#'django.template.loaders.eggs.Loader',
)

... where PROJECT_DIR is the directory containing settings.py. I set 
mine this way for this project because it gives me a single directory 
containing a separate sub-dir for each application.


This works for both the dev server and mod_wsgi

Django will look in ../appdir/templates first if the loaders are reversed.

Mike





On 6/06/2011 11:47am, 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 with this?

On Jun 5, 4:38 pm, Mike Dewhirst  wrote:

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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 anyone else is interested...

It has to be my apache config...

Cheers

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 it clearly does.  I posted my virtual host config so if
> you, or anyone else is interested...
>

I'd guess the web server did not have permissions to read the template when
it was somewhere under your home directory. Usually you will see "File
exists" for that case, but perhaps if the lack of permission extended higher
up in the tree, the web server would not even be able to detect the
existence of the file.

Karen
-- 
http://tracey.org/kmt/

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 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 -0700, Siddharth Swaminathan wrote:
> > 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 drupal site on the same server is able to
> > accept files larger than even 1Mb.
> >
> >
> > Any help would be appreciated.
> >
> >
> > Thanks in advance,
> > Siddharth Swaminathan
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Django users" group.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msg/django-users/-/VjJXMVhZeWE2WHNK.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to django-users
> > +unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.
>
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Siddharth. S,
Dept. of Mechanical Engineering,
Indian Institute of Technology, Madras.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 report a bug in tracker?
> 

It's not "deserialized" thus not a but but works as designed. HTTP
POST/GET parameters are only strings. Nothing more, nothing less. Django
doesn't do any magic by default. 

You can use some known notation to handle your data, like JSON which can
serialize and deserialize data correctly.

-- 

Jani Tiainen



-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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'),

(r'^polls/(?P\d+)/results/$', 'polls.views.results'),

(r'^polls/(?P\d+)/vote/$', 'polls.views.vote'),

(r'^admin/', include(admin.site.urls)),

)


but when i save it and run http//127.0.0.1:8000/admin/polls , the page can
not be loaded and the errors are irrelevant such as:



  File "F:\Program Files\python
2.7.1\lib\site-packages\django\views\defaults.py", line 30, in server_error

t = loader.get_template(template_name) # You need to create a 500.html
template.



  File "F:\Program Files\python
2.7.1\lib\site-packages\django\template\loader.py", line 157, in
get_template

template, origin = find_template(template_name)



  File "F:\Program Files\python
2.7.1\lib\site-packages\django\template\loader.py", line 138, in
find_template

raise TemplateDoesNotExist(name)


  , i should mention that i don't forget "python manage.py runserver".
can someone help me please?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.