Re: how to write data to csv using DictWriter

2011-03-09 Thread sushanth Reddy
thanks you for the link ,KG

-- 
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: Any clue what this error could mean

2011-03-09 Thread delegbede
The error message is straight forward. You are referring to a file or directory 
that doesn't exist. 
Check the name of the file and be sure you've spelt it correctly or you 
actually saved it in the directory from where you're tryin to access it. 
Sent from my BlackBerry wireless device from MTN

-Original Message-
From: ydjango 
Sender: django-users@googlegroups.com
Date: Wed, 9 Mar 2011 22:21:08 
To: Django users
Reply-To: django-users@googlegroups.com
Subject: Any clue what this error could mean

[Errno 2] No such file or directory: '/home/xyz/webapps/prodxyz/temp/
tmpn2C5Lk.upload'

I see it in logs. Any clue what this error could mean or be related to?

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



Any clue what this error could mean

2011-03-09 Thread ydjango
[Errno 2] No such file or directory: '/home/xyz/webapps/prodxyz/temp/
tmpn2C5Lk.upload'

I see it in logs. Any clue what this error could mean or be related to?

-- 
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: PLEASE HELP ME IN ADDING A CATEGORY IN THE ADMIN SITE

2011-03-09 Thread Sneaky Wombat
Ronny is right.  South is the way to go. no pun intended.

On Mar 8, 6:30 pm, ronny  wrote:
> Ignore the rest of these guys, and go here:
>
> http://south.aeracode.org/docs/tutorial/part1.html#tutorial-part-1
>
> It's called django-south, all the cool kids are using it.
>
> Enjoy.  :D
>
> -ron
>
> On Mar 8, 7:34 am, pankaj sharma  wrote:
>
> > same as categories i have to add affiliation to every college.
> > so i added
>
> > class Affiliation(models.Model):
> >     title = models.CharField(max_length=100)
>
> >     def __unicode__(self):
> >         return self.title
>
> > to models.py
>
> > and  added one more field to class of colleges
>
> > class College(models.Model):
> >    name = models.CharField(max_length=250)
> >    category = models.ForeignKey(Category)
> >    city = models.ForeignKey(City)
> >    affiliation = models.ForeignKey(Affiliation)            ### i added
> > this line to college class in models .py
>
> > now i changed my admin.py to this:
>
> > from django.contrib import admin
> > from college.models import *
>
> > class CollegeAdmin(admin.ModelAdmin):
> >     list_display = ('name','category', 'city', 'affiliation')
> >     list_filter = ['category', 'city']
> >     search_fields = ['name', 'city']
>
> > class CityAdmin(admin.ModelAdmin):
> >     list_display = ('title', 'state')
> >     list_filter = ['state']
> >     search_fields = ['title',]
>
> > admin.site.register(College, CollegeAdmin)
> > admin.site.register(City, CityAdmin)
> > admin.site.register(State)
> > admin.site.register(Category)
> > admin.site.register(Affiliation)
>
> >  but when i use syncdb command it shows no fixtures found
>
> > and when i click on college in admin site  then it show me error like
> > this
>
> > OperationalError at /admin/college/college/
> > (1054, "Unknown column 'college_college.affiliation_id' in 'field
> > list'")
>
> > now what to do? do i have to edit some more codes?

-- 
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: Re: Multiple Servers and Authentication Sessions Breaking

2011-03-09 Thread Matthew Roy
@Tom: I'm not configuring SESSION_ENGINE so it should be the default
django.contrib.sessions.backends.db

@Henrik: That may well be the problem, I have a cron job to generate a
random secret key on each server weekly. I will try setting them statically.

Thanks for your responses, I'll let you know how it goes.

Matthew


On Wed, Mar 9, 2011 at 08:01, Henrik Genssen wrote:

> SECRET_KEY

-- 
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 app and Amazon AWS (beginner)

2011-03-09 Thread CLIFFORD ILKAY

On 03/09/2011 10:37 PM, nai wrote:

According to djangoproject, deploying Django with apache and mod_wsgi
is the way to go. I keep seeing these terms over and over again but
I've had it explained to me over and over but I still don't get it. I
know this is getting a bit off topic but it would be great if someone
could take another stab and explain how apache and mod_wsgi fits in
with the deployment.


The built-in dev server isn't intended to be run in production. It can 
only handle one connection at a time and has never been security 
audited. It's purely for the convenience of the developer and not 
intended for production deployment.


Apache is a web server. Simplistically, mod_wsgi is the means by which 
Apache can pass requests to and from the Python interpreter. I prefer 
nginx and fcgi as alternatives to Apache and mod_wsgi. Feel free to 
contact me if you would rather have someone else get this setup for you 
so that you can concentrate on your development.

--
Regards,

Clifford Ilkay
Dinamis
1419-3266 Yonge St.
Toronto, ON
Canada  M4N 3P6


+1 416-410-3326

--
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 app and Amazon AWS (beginner)

2011-03-09 Thread nai
According to djangoproject, deploying Django with apache and mod_wsgi
is the way to go. I keep seeing these terms over and over again but
I've had it explained to me over and over but I still don't get it. I
know this is getting a bit off topic but it would be great if someone
could take another stab and explain how apache and mod_wsgi fits in
with the deployment.

On Mar 10, 11:27 am, nai  wrote:
> Ok, this is where I start running into the limitations of my
> knowledge. Does installing a webserver like Apache 'persist' the
> website then? Is that what I should be doing if I want to do things
> 'properly'?
>
> Also, when I run nohup, I get: nohup: ignoring input and appending
> output to `nohup.out'
>
> On Mar 10, 10:50 am, Huy Ton That  wrote:
>
>
>
>
>
>
>
> > Well, if you are just doing a development test, as it seems below foregoing
> > apache, you can do
>
> > sudo nohup python manage.py runserver 0.0.0.0:8000
>
> > It will keep on running after you close the terminal.
>
> > -H
>
> > On Wed, Mar 9, 2011 at 9:46 PM, nai  wrote:
> > > Hi guys,
>
> > > I've been lurking on the forums and groups for a while now but I've
> > > recently ran into some problems I couldn't figure out whilst learning
> > > to code.
>
> > > Basically, I have a simple working webapp on my local machine. I've
> > > signed up for the free Amazon tier and have been messing around with
> > > it since. So my question is, once I run
>
> > > python manage.py runserver ec2-122-248-194-176.ap-
> > > southeast-1.compute.amazonaws.com:8000 &
>
> > > Everytime I close my terminal the site goes down even though I added
> > > the '&' to run it as a background task.
>
> > > Is there a better way of doing this? Are there any resources/books
> > > that shows you how to deploy on Amazon? Why isn't there a heroku for
> > > Django?
>
> > > Ok, that became a 3 part question :)
>
> > > 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: Django app and Amazon AWS (beginner)

2011-03-09 Thread nai
Ok, this is where I start running into the limitations of my
knowledge. Does installing a webserver like Apache 'persist' the
website then? Is that what I should be doing if I want to do things
'properly'?

Also, when I run nohup, I get: nohup: ignoring input and appending
output to `nohup.out'

On Mar 10, 10:50 am, Huy Ton That  wrote:
> Well, if you are just doing a development test, as it seems below foregoing
> apache, you can do
>
> sudo nohup python manage.py runserver 0.0.0.0:8000
>
> It will keep on running after you close the terminal.
>
> -H
>
>
>
>
>
>
>
> On Wed, Mar 9, 2011 at 9:46 PM, nai  wrote:
> > Hi guys,
>
> > I've been lurking on the forums and groups for a while now but I've
> > recently ran into some problems I couldn't figure out whilst learning
> > to code.
>
> > Basically, I have a simple working webapp on my local machine. I've
> > signed up for the free Amazon tier and have been messing around with
> > it since. So my question is, once I run
>
> > python manage.py runserver ec2-122-248-194-176.ap-
> > southeast-1.compute.amazonaws.com:8000 &
>
> > Everytime I close my terminal the site goes down even though I added
> > the '&' to run it as a background task.
>
> > Is there a better way of doing this? Are there any resources/books
> > that shows you how to deploy on Amazon? Why isn't there a heroku for
> > Django?
>
> > Ok, that became a 3 part question :)
>
> > 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: Django app and Amazon AWS (beginner)

2011-03-09 Thread Brian Bouterse
I recommend running your runserver inside
screenand leaving it detached
when you are logged out.

Brian

On Wed, Mar 9, 2011 at 9:50 PM, Huy Ton That  wrote:

> Well, if you are just doing a development test, as it seems below foregoing
> apache, you can do
>
> sudo nohup python manage.py runserver 0.0.0.0:8000
>
> It will keep on running after you close the terminal.
>
> -H
>
>
> On Wed, Mar 9, 2011 at 9:46 PM, nai  wrote:
>
>> Hi guys,
>>
>> I've been lurking on the forums and groups for a while now but I've
>> recently ran into some problems I couldn't figure out whilst learning
>> to code.
>>
>> Basically, I have a simple working webapp on my local machine. I've
>> signed up for the free Amazon tier and have been messing around with
>> it since. So my question is, once I run
>>
>> python manage.py runserver ec2-122-248-194-176.ap-
>> southeast-1.compute.amazonaws.com:8000 &
>>
>> Everytime I close my terminal the site goes down even though I added
>> the '&' to run it as a background task.
>>
>> Is there a better way of doing this? Are there any resources/books
>> that shows you how to deploy on Amazon? Why isn't there a heroku for
>> Django?
>>
>> Ok, that became a 3 part question :)
>>
>> 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.
>



-- 
Brian Bouterse
ITng Services

-- 
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 app and Amazon AWS (beginner)

2011-03-09 Thread Huy Ton That
Well, if you are just doing a development test, as it seems below foregoing
apache, you can do

sudo nohup python manage.py runserver 0.0.0.0:8000

It will keep on running after you close the terminal.

-H

On Wed, Mar 9, 2011 at 9:46 PM, nai  wrote:

> Hi guys,
>
> I've been lurking on the forums and groups for a while now but I've
> recently ran into some problems I couldn't figure out whilst learning
> to code.
>
> Basically, I have a simple working webapp on my local machine. I've
> signed up for the free Amazon tier and have been messing around with
> it since. So my question is, once I run
>
> python manage.py runserver ec2-122-248-194-176.ap-
> southeast-1.compute.amazonaws.com:8000 &
>
> Everytime I close my terminal the site goes down even though I added
> the '&' to run it as a background task.
>
> Is there a better way of doing this? Are there any resources/books
> that shows you how to deploy on Amazon? Why isn't there a heroku for
> Django?
>
> Ok, that became a 3 part question :)
>
> 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.



Django app and Amazon AWS (beginner)

2011-03-09 Thread nai
Hi guys,

I've been lurking on the forums and groups for a while now but I've
recently ran into some problems I couldn't figure out whilst learning
to code.

Basically, I have a simple working webapp on my local machine. I've
signed up for the free Amazon tier and have been messing around with
it since. So my question is, once I run

python manage.py runserver ec2-122-248-194-176.ap-
southeast-1.compute.amazonaws.com:8000 &

Everytime I close my terminal the site goes down even though I added
the '&' to run it as a background task.

Is there a better way of doing this? Are there any resources/books
that shows you how to deploy on Amazon? Why isn't there a heroku for
Django?

Ok, that became a 3 part question :)

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: Template Referencing Dictionary By Name

2011-03-09 Thread Karen Tracey
 On Wed, Mar 9, 2011 at 1:30 PM, octopusgrabbus
wrote:

> This is for Django 1.2 and MySQL 5.x
>
> How does a template know a dictionary's name, if a dictionary is
> supplied in render_to_response?
>
>
It doesn't.


>   totals_dict['TotalActiveAccounts'] = ret_list[0]
>totals_dict['TotalBillableAccounts'] = ret_list[1]
>totals_dict['TotalNon-BillableAccounts'] = int(ret_list[0]) -
> int(ret_list[1])
>
> context_instance=RequestContext(request))
>return render_to_response('main_page.html', totals_dict,
> context_instance=RequestContext(request))
>
>
Given that code, the template can access TotalActiveAccounts and
TotalBillableAccounts:

{{ TotalActiveAccounts }} {{ TotalBillableAccounts }}

That last key of 'TotalNon-BillableAccounts' is going to be a problem
because the dash isn't allowed in a template variable name (though I can't
find where allowed chars in template variable name are listed...but trying
to access {{ TotalNon-BillableAccounts }} will generate a template syntax
error relating to not being able to parse the content after the dash. So
you're going to want to avoid putting dashes in your dictionary key names.

If for some reason you wanted that dictionary, directly, accessible in the
context for the template, you'd pass it inside a different dictionary passed
to render_to_response:

render_to_response('main_page.html', {'totals_dict': totals_dict }, ...

Since I gave the key the same name as the variable with the value, that's
the name it will have in the template context, and you can get to the
individual items using the . operator, e.g.:

{{ totals_dict.TotalActiveAccounts }}

If I instead passed the dict under a different name:

render_to_response('main_page.html', {'foo': totals_dict }, ...

that's the name I'd use in the template:

{{ foo.TotalActiveAccounts }}

So the variable name for the dictionary in the view makes no difference,
it's the key names in the dictionary passed to render_to_response that
matter to the template.

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: When do we stop using Django admin?

2011-03-09 Thread ajaishankar
Thanks everyone for your valuable suggestions!

On Mar 8, 3:23 am, Michael Radziej  wrote:
> On Mon, 7 Mar 2011 21:49:45 -0800 (PST), ajaishankar  
> wrote:
> > I do know we can tweak the admin to restrict querysets etc. and also
> > override admin templates - but is admin preferable in this situation?
>
> > Or is it better to treat all this as a front end web app, and start
> > work on fresh pages.
>
> The admin pages usually are a compromise for a user interface. They have
> to be very generic and as such are usually not the best fit. I usually
> stay away from them when they need more than trivial customization. It's more 
> open
> to changes (and you don't get big eyes from your customer because
> changing this little detail needs so much additional effort). The admin
> pages are also very simple to implement as views.
>
> Anyway, your mileage may vary, and it all depends on the
> circumstances. If leaving admin pages means writing hundreds of views,
> or if the admin pages really fit the user interaction in your
> application, it might make sense to stay with them.
>
> As a rule of thumb: When understanding the customization is harder than
> writing a view, there's probably not much sense in using the admin.
>
> Hope that helps
>
> Michael

-- 
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 best server for Django

2011-03-09 Thread Huy Ton That
+1 for Rackspace.

On Wed, Mar 9, 2011 at 8:25 PM, Kenneth Gonsalves wrote:

> On Wed, 2011-03-09 at 16:47 +0200, Sithembewena Lloyd Dube wrote:
> > I guess it all depends on what one's needs are. For Django, I only
> > have
> > WebFaction experience and I second William Ratcliff on that note. They
> > have
> > been brilliant, offering a very user-friendly setup process as well as
> > great
> > turnaround times on support. They also
>
> +1 for webfaction - they rock. If you need a vps, another good choice is
> Gandi. They are rock solid, but their ui is kinda weird. Even after 3
> years I spend a good amount of time each month trying to figure out how
> to make my monthly payment ;-)
> --
> 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.
>
>

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



database connection from long lasting script

2011-03-09 Thread Brian Craft
I have a script that sits in a loop, doing occasional queries, something like

while 1:
  wait.for.some.event()
  object=get.some.django.db.object()
  do.something.with(object)
  transaction.commit_unless_managed()

The last line is required so the script will see updates to the
database from other processes. If there's no event for a long time,
the database wait timeout is exceeded, and the script aborts with a
"mysql sever has gone away" message. This is expected.

What is surprising to me is that the error consistently happens during
commit_unless_managed(). It's been waiting for an event for 8+ hours,
finally gets one, appears to do a db query, and then aborts during
commit because the connection is gone.

What's going on here? Is this a caching issue? Django satisfies the
query w/o touching the db, then aborts when updating with the db?

If this is the case, I suspect the commit should be just after the wait.

-- 
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 best server for Django

2011-03-09 Thread Kenneth Gonsalves
On Wed, 2011-03-09 at 16:47 +0200, Sithembewena Lloyd Dube wrote:
> I guess it all depends on what one's needs are. For Django, I only
> have
> WebFaction experience and I second William Ratcliff on that note. They
> have
> been brilliant, offering a very user-friendly setup process as well as
> great
> turnaround times on support. They also 

+1 for webfaction - they rock. If you need a vps, another good choice is
Gandi. They are rock solid, but their ui is kinda weird. Even after 3
years I spend a good amount of time each month trying to figure out how
to make my monthly payment ;-)
-- 
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: Customizing how the elements are listed in admin change_list.html

2011-03-09 Thread MrMuffin
If anybody else finds this post and wonders how it went. Follow these
instructions. Works great!

http://stackoverflow.com/questions/4794528/extending-django-admin-templates-altering-change-list

Thomas

On 8 Mar, 23:59, Thomas Weholt  wrote:
> My app handles photos and the admin shows these photos in a table-like
> manner as shown in attachment.
>
> but I want to show it as google does when you search for images; a
> bunch of photos spread across the page, like here:
>
> http://www.google.no/images?q=django+pony
>
> but still inside the admin and hopefully by extending django by
> editing change_list.html for my model. I guess the code is somehow
> being generated here somewhere :
>
>  {% if cl.formset %}
>         {{ cl.formset.management_form }}
>       {% endif %}
>
>       {% block result_list %}
>           {% if action_form and actions_on_top and
> cl.full_result_count %}{% admin_actions %}{% endif %}
>           {% result_list cl %}
>           {% if action_form and actions_on_bottom and
> cl.full_result_count %}{% admin_actions %}{% endif %}
>       {% endblock %}
>
> that`s from the change_list.html. But I`m not sure if I can access the
> result queryset in the template somehow and add my own template code
> to accomplish what I`m after.
>
> Any hint or thoughts on how to do this would be great, and I apologize
> in advance for adding the attachment.
>
> --
> Mvh/Best regards,
> Thomas Weholthttp://www.weholt.org
>
>  as_list.jpg
> 30KVisLast ned

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



#PgEast 2011: Session Schedule Up, registration open (Django Training)

2011-03-09 Thread Joshua D. Drake
Hey,

#PgEast has its schedule up.

Register: https://www.postgresqlconference.org/register
Schedule: https://www.postgresqlconference.org/

There is a Django training available on the 22nd.

Sincerely,

Joshua D. Drake

-- 
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 509.416.6579
Consulting, Training, Support, Custom Development, Engineering
http://twitter.com/cmdpromptinc | http://identi.ca/commandprompt



-- 
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 best server for Django

2011-03-09 Thread Andy
It really depends on your needs.

If you are also running a DB on the server and have significant
traffic, virtual servers such as EC2 or Linode might not work well
because they tend to have poor IO performance.

On Mar 9, 4:53 am, Chen Xu  wrote:
> I am thinking to buy a server, and integrated with Django environment. So
> could anyone please give me some suggestions, which server is the best for
> this, amazon ec2 or?
>
> Thanks very much
> Best regards
>
> --
> ⚡ Chen Xu ⚡

-- 
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: Two request.GET on same site

2011-03-09 Thread Tom Evans
On Wed, Mar 9, 2011 at 6:35 PM, maciekjbl  wrote:
> On 9 Mar, 17:41, bruno desthuilliers 
> wrote:
>> (and  is misspelled FWIW).
> What do you mean  is misspelled ?

Compare/contrast.

Cheers

Tom

-- 
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: Weird behaviour in Django logging (Django 1.3 RC)

2011-03-09 Thread Edwin
I've had help from SO:
http://stackoverflow.com/questions/5249265/strange-behaviour-in-django-logging-django-1-3-rc/5250829#5250829

The solution is simply to explicitly call self.format(record) on my
emit() method under DatabaseHandler.

Hope this helps whoever face a similar problem.


-Edwin

On Mar 7, 8:58 am, Edwin  wrote:
> Sorry I wasn't clear enough. Here's the stack trace:
>
> Traceback:
> File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
> base.py" in get_response
>   89.                     response = middleware_method(request)
> File "/home/user/projects/django/../django/common/middleware.py" in
> process_request
>   27.             return login(request, **defaults)
> File "/usr/local/lib/python2.6/dist-packages/django/utils/
> decorators.py" in _wrapped_view
>   93.                     response = view_func(request, *args,
> **kwargs)
> File "/usr/local/lib/python2.6/dist-packages/django/views/decorators/
> cache.py" in _wrapped_view_func
>   79.         response = view_func(request, *args, **kwargs)
> File "/home/user/projects/django/../django/apps/django_extra_auth/
> views.py" in login
>   57.             auth_login(request, form.get_user())
> File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/
> __init__.py" in login
>   85.     user_logged_in.send(sender=user.__class__, request=request,
> user=user)
> File "/usr/local/lib/python2.6/dist-packages/django/dispatch/
> dispatcher.py" in send
>   172.             response = receiver(signal=self, sender=sender,
> **named)
> File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/
> models.py" in update_last_login
>   50.     user.save()
> File "/usr/local/lib/python2.6/dist-packages/django/db/models/base.py"
> in save
>   460.         self.save_base(using=using, force_insert=force_insert,
> force_update=force_update)
> File "/usr/local/lib/python2.6/dist-packages/django/db/models/base.py"
> in save_base
>   570.                 created=(not record_exists), raw=raw,
> using=using)
> File "/usr/local/lib/python2.6/dist-packages/django/dispatch/
> dispatcher.py" in send
>   172.             response = receiver(signal=self, sender=sender,
> **named)
> File "/home/user/projects/django/apps/history/audit.py" in
> post_save_handler
>   102.             logging.log_to_db(logging.INFO, msg, log_type)
> File "/home/user/projects/django/apps/history/__init__.py" in
> log_to_db
>   61.         db_logger.log(level, msg, extra=extras)
> File "/usr/lib/python2.6/logging/__init__.py" in log
>   1119.             self._log(level, msg, args, **kwargs)
> File "/usr/lib/python2.6/logging/__init__.py" in _log
>   1173.         self.handle(record)
> File "/usr/lib/python2.6/logging/__init__.py" in handle
>   1183.             self.callHandlers(record)
> File "/usr/lib/python2.6/logging/__init__.py" in callHandlers
>   1220.                     hdlr.handle(record)
> File "/usr/lib/python2.6/logging/__init__.py" in handle
>   679.                 self.emit(record)
> File "/home/user/projects/django/apps/history/handlers.py" in emit
>   11.         timestamp = datetime.strptime(record.asctime,
> settings.LOG_DATE_FORMAT)
>
> Also, I have a wrapper to call db_logger, which you can see from the
> stacktrace:
>     def log_to_db(self, level, msg, log_type, extra={}):
>         db_logger = logging.getLogger('db_logger')
>         extras = {
>             'category': log_type.category.name,
>             'sub_category': log_type.sub_category.name,
>             'type_id': log_type.type_id,
>         }
>         extras.update(extra)
>         db_logger.log(level, msg, extra=extras)
>
> My DB Handler looks like this:
>
> class DatabaseHandler(logging.Handler):
>     def emit(self, record):
>         user = getattr(record, 'user', None)
>         category = getattr(record, 'category', None)
>         sub_category = getattr(record, 'sub_category', None)
>         type_id = getattr(record, 'type_id', None)
>         timestamp = datetime.strptime(record.asctime,
> settings.LOG_DATE_FORMAT)
>         from history.models import LogRecord
>         LogRecord.objects.create(timestamp=timestamp,
> level=record.levelname,
>             category=category, sub_category=sub_category,
> type_id=type_id,
>             message=record.message, user=user)
>
> Thanks again.
>
> On Mar 5, 10:59 pm, Russell Keith-Magee 
> wrote:
>
> > On Sat, Mar 5, 2011 at 10:41 AM, Edwin  wrote:
> > > I'm getting a strange behaviour when setting up logging. Here's my
> > > logging configuration:
>
> > > LOGGING =
> > > {
> > >    'version': 1,
> > >    'disable_existing_loggers': True,
> > >    'formatters': {
> > >        'admin_configuration': {
> > >            'format': '%(asctime)s %(levelname)s %(category)s %
> > > (sub_category)s %(type_id)s %(message)s',
> > >            'datefmt': LOG_DATE_FORMAT,
> > >        },
> > >    },
> > >    'handlers': {
> > >        'admin_console': {
> > >            

authentication

2011-03-09 Thread Tony
I have been looking into django-socialauth and am wondering how well
it works.  Another question I have about it is, if these users log in
with their accounts from other sites, what is the best way for me to
store their data and keep track of them?  Thanks for the help.

-- 
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: jquery toggle in form from model

2011-03-09 Thread Andres Lucena
El mié, 09-03-2011 a las 12:17 -0500, Rich Wilson escribió:
> Hello all, I was wondering if I could get some guidance using jquery.
> 
> I have a form from model in which I would like to display certain form
> fields based on a check box being checked or unchecked.  Could also be
> done using a button.  I am already using Jquery datepicker and
> timepicker in the form which works fine.  Jquery toggle is here.
> I can get it work elsewhere, just not inside the form.
> 
> Here is a some template code where 'e' is the form from model being
> passed in, the datepicker code included as a quide for how toggle
> should work, and toggle code using a button to toggle highlighted.
> Thanks in advance.
> 
> ~ Rich
> 
/.../

Hey Rich, 

This is the Django mailing list, and this question is regarding JQuery.
Maybe JQuery have a list or you can try in StackOverflow...

Also, maybe what you're looking is this one:

http://api.jquery.com/checked-selector/

And: 

http://api.jquery.com/checkbox-selector/

See you,
Andres


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



Introducing Site Deploy, a GUI-based tool for web site deployment (with Django support!)

2011-03-09 Thread Andreas Sommer
Hello everyone!

In the last weeks, I've been working on a PyGTK-based tool that eases
the deployment of web sites to remote servers. It is cross-platform,
tested on Windows and Linux, and comes with support for Django sites. I
tried to make usage as easy as possible, but there's also documentation
available, showing how to deploy a Django test site.

As an additional advantage for Django users, Site Deploy can
automatically wrap a Django site's settings module in a way that the
site can be "mounted" on arbitrary URL paths - normally, Django sites
won't work correctly on paths other than "/" (e.g. problems with
redirects and the URL reverse() function).

So if you are interested in this software, here's what you can do:

* Install and test it
* Tell me what you think. Would you use it at all?
* Any problems encountered? Bugs? Feature requests?

Please refer to the documentation on site-deploy.sourceforge.net
. Source code is on Launchpad
(https://launchpad.net/site-deploy). Screenshots can be viewed on
sourceforge.net/projects/site-deploy
 but are also in the
documentation.

Installation is very easy on Ubuntu (from my experimental PPA):
  apt-add-repository ppa:andidog/ppa
  apt-get update
  apt-get install site-deploy

On Windows, you need GTK (with Glade support) and the Python modules
PyGTK, PyGObject, PyCairo and lxml. Sorry, no installers yet.

Best regards,
 Andreas

-- 
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: Two request.GET on same site

2011-03-09 Thread maciekjbl


On 9 Mar, 17:41, bruno desthuilliers 
wrote:
> On 9 mar, 09:01, maciekjbl  wrote:


> > My base template :
> >  
> >    Strona G³ówna  
> >   Wyszukaj Producenta:  > name="q">
>
> Is that the full (relevant) code ? If yes, the closing  tag is
> missing, and you don't have any submit in it (and  is
> misspelled FWIW).


OMG !! 4 hours of searching and it was just one closing tag .
Now it's working fine.

Thank you so much.

What do you mean  is misspelled ?


> You mean "it submits the other form" ?

Yes. Because of unclose . Thx onec more.


-- 
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: Error 503 Service Unavailable from 127.0.0.1

2011-03-09 Thread Casey Greene

Do you have DEBUG = True in your settings.py?

If not, set it to true and that should provide additional information.

Hope this helps,
Casey

On 03/09/2011 12:35 PM, pjstunna wrote:

Hi,

I just recently discovered Django and I'm following the Django
tutorial as it is written on the website ( 
http://docs.djangoproject.com/en/dev//intro/tutorial01/
) but when i start the development server and view http://127.0.0.1:8000
from my browser I get this error

Error 503 Service Unavailable from 127.0.0.1

I just installed Django 1.2.5 and I'm using the SQlite3 backend on a
Windows 7 laptop

Please help!!!

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.



Template Referencing Dictionary By Name

2011-03-09 Thread octopusgrabbus
This is for Django 1.2 and MySQL 5.x

How does a template know a dictionary's name, if a dictionary is
supplied in render_to_response?

   totals_dict['TotalActiveAccounts'] = ret_list[0]
totals_dict['TotalBillableAccounts'] = ret_list[1]
totals_dict['TotalNon-BillableAccounts'] = int(ret_list[0]) -
int(ret_list[1])

context_instance=RequestContext(request))
return render_to_response('main_page.html', totals_dict,
context_instance=RequestContext(request))

Thanks.
cmn

-- 
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: Bug in Django admin?

2011-03-09 Thread Michael Radziej
Hi Martin!


On Wed, 09 Mar 2011 15:58:54 +0100, Martin Tiršel  wrote:
> NO = False
> YES = True
> YES_NO_CHOICES = (
>  (NO, 'no'),
>  (YES, 'yes')
> )
> 
> to
> 
> 
> NO = 0
> YES = 1
> YES_NO_CHOICES = (
>  (NO, 'no'),
>  (YES, 'yes')
> )
> 
> Then I get 0 or 1 for filter instead of True or False and it works. I  
> think that the admin takes the True/False parameter in URL as string and  
> does't convert it to bool.

Aha! That's very interesting.

I'm not sure whether this is really a bug or not--SQL is a bit strange
about Boolean values sometimes--, but it looks like one, too. Would
you like to open a ticket for this, referring to the URL of this thread
in google groups?

Please also state your database engine.

I'd appreciate if you set Cc to my email address. ;-)



Kind regards

Michael

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



Error 503 Service Unavailable from 127.0.0.1

2011-03-09 Thread pjstunna
Hi,

I just recently discovered Django and I'm following the Django
tutorial as it is written on the website ( 
http://docs.djangoproject.com/en/dev//intro/tutorial01/
) but when i start the development server and view http://127.0.0.1:8000
from my browser I get this error

Error 503 Service Unavailable from 127.0.0.1

I just installed Django 1.2.5 and I'm using the SQlite3 backend on a
Windows 7 laptop

Please help!!!

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: Logging raw sql

2011-03-09 Thread Dave Sluder
Thanks krzysiekpl, I actually have to use mysql. Having browsed
through the django source, I don't think there is anyway to intercept
the query unless it were done for example in mysqldb, since the
library actually generates the raw sql. I've discovered the
general_log to table feature of mysql 5.1 and am just executing a
query against that to filter the results.

On Mar 9, 4:35 am, krzysiekpl  wrote:
> Hi, if you are using postgresql you can use logger_collector. Try
> this:http://www.postgresql.org/docs/8.3/static/runtime-config-logging.html.
>
> On 9 Mar, 05:04, Dave Sluder  wrote:
>
>
>
>
>
>
>
> > I need to log all insert/update/delete queries such that the database
> > could be rebuilt from the log. I know I can do this at the database
> > level, but I need to log selectively for certain models.
> > The statements captured from db.connection.queries still contain
> > parameters so they won't work.
>
> > Does anyone have any insight as to where I can intercept the raw query
> > if at all?

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



Queryset using group_by on different fields than the ones in the aggregation function

2011-03-09 Thread Massimiliano della Rovere
We have this model in module X:

class A(models.Model):
  when = models.DateTimeField()
  type = models.CharField(max_length=10)
  subtype = models.CharField(max_length=10)
  data = models.CharField(max_length=100)

I am trying to do something like:
SELECT MAX(when), type, subtype, data
FROM x_a
GROUP_BY type, subtype

That is the most recent record for each (type, subtype) pair.

As far as I understood there is no way (maybe some undocumented feature...?)
to specify a different set of fields for GROUP BY than the ones used in
aggregation

I need something like:
A.objects.group_by('type', 'subtype').aggregate(Max(when))

Is there a way to solve this problem without using extra() ?

-- 
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: Two request.GET on same site

2011-03-09 Thread bruno desthuilliers
On 9 mar, 09:01, maciekjbl  wrote:
> Hi,
>
> My problem is how can I separate two request on the same site. This
> situation is caused by text field in base template and form in another
> template which extends base.

(snip)
>
> My base template :
>  
>    Strona G³ówna  
>   Wyszukaj Producenta:  name="q">

Is that the full (relevant) code ? If yes, the closing  tag is
missing, and you don't have any submit in it (and  is
misspelled FWIW).


> My second template with form (lista_promocji):
>   

Better to specifiy the target url in the action attribute.

>         {{ promo.form.as_p }}

Are we supposed to guess what's in promo.form ?

>         
>     
>
> Now when I try to use form to filter content it triggers input in base
> template

You mean "it submits the other form" ?

> and I get search view insted of filterd site.


Fix the above points first. If you still have problems, please post
the full generated HTML (or post a link to it).

-- 
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: Two request.GET on same site

2011-03-09 Thread Tom Evans
On Wed, Mar 9, 2011 at 4:34 PM, bruno desthuilliers
 wrote:
>
>
> On 9 mar, 14:58, Norberto Leite  wrote:
>> Rule number one of any html:
>> Only one form per page!
>
> I have quite a few sites (django or whatever) with many forms per
> page. It's just a matter of being careful with forms actions and
> fields names.
>

In a similar vein, I have a number of s that consist of multiple
django forms.Form. As you said, as long as you don't conflict with
field names, it is trivial. Even if you do have clashes, that simply
requires a different form prefix. As described in the lovely docs.

Cheers

Tom

-- 
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: Two request.GET on same site

2011-03-09 Thread bruno desthuilliers


On 9 mar, 14:58, Norberto Leite  wrote:
> Rule number one of any html:
> Only one form per page!

I have quite a few sites (django or whatever) with many forms per
page. It's just a matter of being careful with forms actions and
fields names.

-- 
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: CSRF Cookie in IE

2011-03-09 Thread cootetom
I think I can only get it working in IE because IE forgets the cookie
when the browser closes and the other browsers on my machine aren't. I
think the fact that I have only found this in IE is not really
related.

I guess I'm miss understanding the use of CSRF. Perhaps the correct
way is to place {% csrf_token %} on the pages where I'm making POST
requests regardless as to if those POST's are via a form or AJAX.




On Mar 9, 2:24 pm, cootetom  wrote:
> I have got the jQuery that does the ajaxSetup. However the problem is
> when #csrfmiddlewaretoken isn't on the page. My jQuery is as the
> Django documentation suggests which is to read the cookie value which
> is meant to be set at every request.
>
> If the user hasn't visited a page that has #csrfmiddlewaretoken on it
> then there is also no cookie, in IE only.
>
> I can solve my issue by putting {% csrf_token %} on every page of the
> web site but something is telling me there is a deeper problem.
>
> On Mar 9, 2:12 pm, krzysiekpl  wrote:
>
>
>
>
>
>
>
> > Did you try add custom header X-CSRFToken ? Try this solution if youre
> > using jquery
>
> > $.ajaxSetup({
> >         beforeSend: function(xhr, settings) {
> >             if (!(/^http:.*/.test(settings.url) || /
> > ^https:.*/.test(settings.url))) {
> >                 // Only send the token to relative URLs i.e. locally.
> >                 xhr.setRequestHeader("X-CSRFToken",
> >                                      $("#csrfmiddlewaretoken").val());
> >             }
> >         }
> >     });
>
> >http://www.djangoproject.com/weblog/2011/feb/08/security/
>
> > On 9 Mar, 14:59, cootetom  wrote:
>
> > > I am experiencing some off behaviour with CSRF but only in IE
> > > browsers. Using Django 1.2.5 (final).
>
> > > I have a page that has no form and no use of {% csrf_token %} but it
> > > does make a POST request using JavaScript. I have implemented the
> > > jQuery code to grab the CSRF cookie value for all AJAX requests. The
> > > strange thing is that in IE browsers there is no CSRF cookie but in
> > > all other browsers, on the same page that cookie exists. So IE
> > > browsers get 403 for AJAX requests and other browsers work just fine.
>
> > > I'm just using the django.middleware.csrf.CsrfViewMiddleware
> > > middleware.
>
> > > Here is the scenario to replicate this:
>
> > > 1. Visit a page that does have a form and so does have a {% csrf_token
> > > %}
> > > 2. Move onto a page that doesn't make use of {% csrf_token %} but does
> > > still do a JavaScript POST. The JavaScript POST will work this time
> > > around.
> > > 3. Close the web browser down, re-open it but go directly to the web
> > > page that doesn't use {% csrf_token %} but does make a JavaScript
> > > POST. This will now fail as no cookie has been set for CSRF.
>
> > > The documentation says the cookie is set for every request so I don't
> > > understand this?

-- 
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: How to delete ONLY m2m relation?

2011-03-09 Thread Casey Greene

In that case, I believe you can remove it with

user.province_set.remove(province)
user.save()

if you have the user and province objects.

I am going from memory here.  I tried to find this in the docs to make 
sure but couldn't.


Hope this helps,
Casey

On 03/09/2011 10:02 AM, galgal wrote:

Thanks, but I don't want to delete any "main" objects. I want to delete
ONLY 1 specific relation - I know user and province, and want to unlink
the user from province.

--
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: How to delete ONLY m2m relation?

2011-03-09 Thread galgal
Thanks, but I don't want to delete any "main" objects. I want to delete ONLY 
1 specific relation - I know user and province, and want to unlink the user 
from province.

-- 
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: How to delete ONLY m2m relation?

2011-03-09 Thread Casey Greene

If you are using django 1.2 or lower you will have to override delete.
http://docs.djangoproject.com/en/dev/topics/db/models/#overriding-predefined-model-methods

For 1.3 you can use the new on_delete:
http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ForeignKey.on_delete

Hope this helps,
Casey

On 03/09/2011 09:46 AM, galgal wrote:

model:
class Province(models.Model):
user = models.ManyToManyField(User, blank=True)
name = models.CharField(max_length=30, unique=True)

How can I delete relation when I know user_id and province_id? If i user
delete() method it also removes province and I want to avoid it.

--
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: Bug in Django admin?

2011-03-09 Thread Martin Tiršel

Hi Michael,

On Tue, 08 Mar 2011 11:05:40 +0100, Michael Radziej   
wrote:



Hi Martin!

Args--you're right. Stupid fingers :-)

I meant

.../admin/appname/booltest/?completed__exact=0

Does it work that way for you with 0 instead of False?



Yes, if I rewrite URL to ?completed__exact=0, then I get Completed with  
`no` choice.





This link is called after I click on `no` in filter category `By
completed`.


Hmm. I see a 0 here. I don't know the reason for the difference, I
checked it on a django 1.1 system. I vaguely remember a change.

What database and which version of Django are you using?




I have Django 1.2.5. But when I change choices definition from:


NO = False
YES = True
YES_NO_CHOICES = (
(NO, 'no'),
(YES, 'yes')
)

to


NO = 0
YES = 1
YES_NO_CHOICES = (
(NO, 'no'),
(YES, 'yes')
)

Then I get 0 or 1 for filter instead of True or False and it works. I  
think that the admin takes the True/False parameter in URL as string and  
does't convert it to bool.



Kind regards

Michael



Kind regads,
Martin

--
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 best server for Django

2011-03-09 Thread James Abel
+1 webfaction

-- 
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 best server for Django

2011-03-09 Thread Sithembewena Lloyd Dube
P.S: by "custom modules", I really meant long-running processes. They also
limit the number of users allocated per shared machine to maintain decent
performance.

On Wed, Mar 9, 2011 at 4:47 PM, Sithembewena Lloyd Dube
wrote:

> I guess it all depends on what one's needs are. For Django, I only have
> WebFaction experience and I second William Ratcliff on that note. They have
> been brilliant, offering a very user-friendly setup process as well as great
> turnaround times on support. They also
>
> - stay very current on software updates, offering new versions barely days
> after they are released.
> - allow the installation and use of custom modules even with their shared
> hosting plans.
>
> N.B: - I am neither affiliate nor employee of WebFaction, and I get nothing
> for this plug :)
>
>
> On Wed, Mar 9, 2011 at 12:07 PM, Bruce Dou  wrote:
>
>> Linode or EC2.
>>
>> On Wed, Mar 9, 2011 at 5:53 PM, Chen Xu  wrote:
>> > I am thinking to buy a server, and integrated with Django environment.
>> So
>> > could anyone please give me some suggestions, which server is the best
>> for
>> > this, amazon ec2 or?
>> >
>> > Thanks very much
>> > Best regards
>> >
>> > --
>> > ⚡ Chen Xu ⚡
>> >
>> > --
>> > 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.
>> >
>>
>>
>>
>> --
>> A decathlon Drupal developer & programmer
>> http://blog.eood.cn/
>>
>> --
>> 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.
>>
>>
>
>
> --
> Regards,
> Sithembewena Lloyd Dube
>



-- 
Regards,
Sithembewena Lloyd Dube

-- 
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 best server for Django

2011-03-09 Thread Sithembewena Lloyd Dube
I guess it all depends on what one's needs are. For Django, I only have
WebFaction experience and I second William Ratcliff on that note. They have
been brilliant, offering a very user-friendly setup process as well as great
turnaround times on support. They also

- stay very current on software updates, offering new versions barely days
after they are released.
- allow the installation and use of custom modules even with their shared
hosting plans.

N.B: - I am neither affiliate nor employee of WebFaction, and I get nothing
for this plug :)

On Wed, Mar 9, 2011 at 12:07 PM, Bruce Dou  wrote:

> Linode or EC2.
>
> On Wed, Mar 9, 2011 at 5:53 PM, Chen Xu  wrote:
> > I am thinking to buy a server, and integrated with Django environment. So
> > could anyone please give me some suggestions, which server is the best
> for
> > this, amazon ec2 or?
> >
> > Thanks very much
> > Best regards
> >
> > --
> > ⚡ Chen Xu ⚡
> >
> > --
> > 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.
> >
>
>
>
> --
> A decathlon Drupal developer & programmer
> http://blog.eood.cn/
>
> --
> 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.
>
>


-- 
Regards,
Sithembewena Lloyd Dube

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



How to delete ONLY m2m relation?

2011-03-09 Thread galgal
model:
class Province(models.Model):
user = models.ManyToManyField(User, blank=True)
name = models.CharField(max_length=30, unique=True)

How can I delete relation when I know user_id and province_id? If i user 
delete() method it also removes province and I want to avoid it.

-- 
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 + WebFaction file: where to place the ie_css3.htc file?

2011-03-09 Thread Sithembewena Lloyd Dube
Yep, they are. Thanks to you Kenneth, for pointing me in the right
direction! Had spent a lot of time wrecking my head over this one.

On Wed, Mar 9, 2011 at 1:20 PM, Kenneth Gonsalves wrote:

> On Wed, 2011-03-09 at 13:16 +0200, Sithembewena Lloyd Dube wrote:
> > Problem solved, thanks to the brilliant folks at WebFaction.
>
> they are good guys
> --
> 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.
>
>


-- 
Regards,
Sithembewena Lloyd Dube

-- 
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: CSRF Cookie in IE

2011-03-09 Thread Casey Greene

Everything makes sense about this except for:

> If the user hasn't visited a page that has #csrfmiddlewaretoken on it
> then there is also no cookie, in IE only.

I am looking in firefox as well and I cannot see that cookie until I 
visit a page that has the csrf_token on it -- afterwards it persists. 
Can you confirm that your cookie settings are the same in firefox and IE?


Also, I use the csrf_token with any form that POSTs to my domain, (ajax 
or otherwise), which prevents this issue.


Hope this helps,
Casey


On 03/09/2011 09:24 AM, cootetom wrote:

I have got the jQuery that does the ajaxSetup. However the problem is
when #csrfmiddlewaretoken isn't on the page. My jQuery is as the
Django documentation suggests which is to read the cookie value which
is meant to be set at every request.

If the user hasn't visited a page that has #csrfmiddlewaretoken on it
then there is also no cookie, in IE only.

I can solve my issue by putting {% csrf_token %} on every page of the
web site but something is telling me there is a deeper problem.




On Mar 9, 2:12 pm, krzysiekpl  wrote:

Did you try add custom header X-CSRFToken ? Try this solution if youre
using jquery

$.ajaxSetup({
 beforeSend: function(xhr, settings) {
 if (!(/^http:.*/.test(settings.url) || /
^https:.*/.test(settings.url))) {
 // Only send the token to relative URLs i.e. locally.
 xhr.setRequestHeader("X-CSRFToken",
  $("#csrfmiddlewaretoken").val());
 }
 }
 });

http://www.djangoproject.com/weblog/2011/feb/08/security/

On 9 Mar, 14:59, cootetom  wrote:








I am experiencing some off behaviour with CSRF but only in IE
browsers. Using Django 1.2.5 (final).



I have a page that has no form and no use of {% csrf_token %} but it
does make a POST request using JavaScript. I have implemented the
jQuery code to grab the CSRF cookie value for all AJAX requests. The
strange thing is that in IE browsers there is no CSRF cookie but in
all other browsers, on the same page that cookie exists. So IE
browsers get 403 for AJAX requests and other browsers work just fine.



I'm just using the django.middleware.csrf.CsrfViewMiddleware
middleware.



Here is the scenario to replicate this:



1. Visit a page that does have a form and so does have a {% csrf_token
%}
2. Move onto a page that doesn't make use of {% csrf_token %} but does
still do a JavaScript POST. The JavaScript POST will work this time
around.
3. Close the web browser down, re-open it but go directly to the web
page that doesn't use {% csrf_token %} but does make a JavaScript
POST. This will now fail as no cookie has been set for CSRF.



The documentation says the cookie is set for every request so I don't
understand this?




--
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: CSRF Cookie in IE

2011-03-09 Thread cootetom
I have got the jQuery that does the ajaxSetup. However the problem is
when #csrfmiddlewaretoken isn't on the page. My jQuery is as the
Django documentation suggests which is to read the cookie value which
is meant to be set at every request.

If the user hasn't visited a page that has #csrfmiddlewaretoken on it
then there is also no cookie, in IE only.

I can solve my issue by putting {% csrf_token %} on every page of the
web site but something is telling me there is a deeper problem.




On Mar 9, 2:12 pm, krzysiekpl  wrote:
> Did you try add custom header X-CSRFToken ? Try this solution if youre
> using jquery
>
> $.ajaxSetup({
>         beforeSend: function(xhr, settings) {
>             if (!(/^http:.*/.test(settings.url) || /
> ^https:.*/.test(settings.url))) {
>                 // Only send the token to relative URLs i.e. locally.
>                 xhr.setRequestHeader("X-CSRFToken",
>                                      $("#csrfmiddlewaretoken").val());
>             }
>         }
>     });
>
> http://www.djangoproject.com/weblog/2011/feb/08/security/
>
> On 9 Mar, 14:59, cootetom  wrote:
>
>
>
>
>
>
>
> > I am experiencing some off behaviour with CSRF but only in IE
> > browsers. Using Django 1.2.5 (final).
>
> > I have a page that has no form and no use of {% csrf_token %} but it
> > does make a POST request using JavaScript. I have implemented the
> > jQuery code to grab the CSRF cookie value for all AJAX requests. The
> > strange thing is that in IE browsers there is no CSRF cookie but in
> > all other browsers, on the same page that cookie exists. So IE
> > browsers get 403 for AJAX requests and other browsers work just fine.
>
> > I'm just using the django.middleware.csrf.CsrfViewMiddleware
> > middleware.
>
> > Here is the scenario to replicate this:
>
> > 1. Visit a page that does have a form and so does have a {% csrf_token
> > %}
> > 2. Move onto a page that doesn't make use of {% csrf_token %} but does
> > still do a JavaScript POST. The JavaScript POST will work this time
> > around.
> > 3. Close the web browser down, re-open it but go directly to the web
> > page that doesn't use {% csrf_token %} but does make a JavaScript
> > POST. This will now fail as no cookie has been set for CSRF.
>
> > The documentation says the cookie is set for every request so I don't
> > understand this?

-- 
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: CSRF Cookie in IE

2011-03-09 Thread David Markey
If its not too much trouble for you, I've switched to GETs instead of POSTs
for my AJAX calls, so i wont have to think about CSRF again.



On 9 March 2011 14:12, krzysiekpl  wrote:

> Did you try add custom header X-CSRFToken ? Try this solution if youre
> using jquery
>
> $.ajaxSetup({
>beforeSend: function(xhr, settings) {
>if (!(/^http:.*/.test(settings.url) || /
> ^https:.*/.test(settings.url))) {
>// Only send the token to relative URLs i.e. locally.
>xhr.setRequestHeader("X-CSRFToken",
> $("#csrfmiddlewaretoken").val());
>}
>}
>});
>
> http://www.djangoproject.com/weblog/2011/feb/08/security/
>
> On 9 Mar, 14:59, cootetom  wrote:
> > I am experiencing some off behaviour with CSRF but only in IE
> > browsers. Using Django 1.2.5 (final).
> >
> > I have a page that has no form and no use of {% csrf_token %} but it
> > does make a POST request using JavaScript. I have implemented the
> > jQuery code to grab the CSRF cookie value for all AJAX requests. The
> > strange thing is that in IE browsers there is no CSRF cookie but in
> > all other browsers, on the same page that cookie exists. So IE
> > browsers get 403 for AJAX requests and other browsers work just fine.
> >
> > I'm just using the django.middleware.csrf.CsrfViewMiddleware
> > middleware.
> >
> > Here is the scenario to replicate this:
> >
> > 1. Visit a page that does have a form and so does have a {% csrf_token
> > %}
> > 2. Move onto a page that doesn't make use of {% csrf_token %} but does
> > still do a JavaScript POST. The JavaScript POST will work this time
> > around.
> > 3. Close the web browser down, re-open it but go directly to the web
> > page that doesn't use {% csrf_token %} but does make a JavaScript
> > POST. This will now fail as no cookie has been set for CSRF.
> >
> > The documentation says the cookie is set for every request so I don't
> > understand this?
>
> --
> 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: CSRF Cookie in IE

2011-03-09 Thread krzysiekpl
Did you try add custom header X-CSRFToken ? Try this solution if youre
using jquery

$.ajaxSetup({
beforeSend: function(xhr, settings) {
if (!(/^http:.*/.test(settings.url) || /
^https:.*/.test(settings.url))) {
// Only send the token to relative URLs i.e. locally.
xhr.setRequestHeader("X-CSRFToken",
 $("#csrfmiddlewaretoken").val());
}
}
});

http://www.djangoproject.com/weblog/2011/feb/08/security/

On 9 Mar, 14:59, cootetom  wrote:
> I am experiencing some off behaviour with CSRF but only in IE
> browsers. Using Django 1.2.5 (final).
>
> I have a page that has no form and no use of {% csrf_token %} but it
> does make a POST request using JavaScript. I have implemented the
> jQuery code to grab the CSRF cookie value for all AJAX requests. The
> strange thing is that in IE browsers there is no CSRF cookie but in
> all other browsers, on the same page that cookie exists. So IE
> browsers get 403 for AJAX requests and other browsers work just fine.
>
> I'm just using the django.middleware.csrf.CsrfViewMiddleware
> middleware.
>
> Here is the scenario to replicate this:
>
> 1. Visit a page that does have a form and so does have a {% csrf_token
> %}
> 2. Move onto a page that doesn't make use of {% csrf_token %} but does
> still do a JavaScript POST. The JavaScript POST will work this time
> around.
> 3. Close the web browser down, re-open it but go directly to the web
> page that doesn't use {% csrf_token %} but does make a JavaScript
> POST. This will now fail as no cookie has been set for CSRF.
>
> The documentation says the cookie is set for every request so I don't
> understand this?

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



CSRF Cookie in IE

2011-03-09 Thread cootetom
I am experiencing some off behaviour with CSRF but only in IE
browsers. Using Django 1.2.5 (final).

I have a page that has no form and no use of {% csrf_token %} but it
does make a POST request using JavaScript. I have implemented the
jQuery code to grab the CSRF cookie value for all AJAX requests. The
strange thing is that in IE browsers there is no CSRF cookie but in
all other browsers, on the same page that cookie exists. So IE
browsers get 403 for AJAX requests and other browsers work just fine.

I'm just using the django.middleware.csrf.CsrfViewMiddleware
middleware.

Here is the scenario to replicate this:

1. Visit a page that does have a form and so does have a {% csrf_token
%}
2. Move onto a page that doesn't make use of {% csrf_token %} but does
still do a JavaScript POST. The JavaScript POST will work this time
around.
3. Close the web browser down, re-open it but go directly to the web
page that doesn't use {% csrf_token %} but does make a JavaScript
POST. This will now fail as no cookie has been set for CSRF.

The documentation says the cookie is set for every request so I don't
understand this?

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



redirect and still pass dict

2011-03-09 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

I want to redirect to a certains url, but still pass a dict like in
render_to_response...is that possible ?!

 

Kind regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





-- 
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: Two request.GET on same site

2011-03-09 Thread Norberto Leite
Rule number one of any html:
Only one form per page!

I would recommend the usage of template_tags / include tag to control the
usage of only one form or the usage of 2 different base.html.
Since I'm a strong supporter of DRY I wouldn't 2 different types of
base.html but would control the encoding of the base.html form through
template_tags.

lazy example:

base.html

{% if some_param  %}
  {my_base_form}
{%end if%}

http://docs.djangoproject.com/en/dev/howto/custom-template-tags/



2011/3/9 maciekjbl 

> Hi,
>
> My problem is how can I separate two request on the same site. This
> situation is caused by text field in base template and form in another
> template which extends base.
>
> My view.py:
>
> def search(request):
>if 'q' in request.GET:
>term = request.GET['q']
>prod =
> Producent.objects.filter(Q(nazwa_producenta__contains=term))
>context = {
>'producent' : prod,
>}
>return render_to_response(
>'promocje/producent_search.html',
>context,
>context_instance = RequestContext(request),
>)
>
> def lista_promocji(request, slug):
>producent = get_object_or_404(Producent, slug=slug)
>promo = PromocjaFilter(request.GET,
> queryset=Promocja.objects.filter(producent=producent))
>return render_to_response(
>'promocje/producent_detail.html',
>{"promo" : promo, "prod" : producent }
>)
>
> My base template :
>  
>   Strona Główna  
>  Wyszukaj Producenta:  name="q">
>
> My second template with form (lista_promocji):
>  
>{{ promo.form.as_p }}
>
>
>
> Now when I try to use form to filter content it triggers input in base
> template and I get search view insted of filterd site.
>
> --
> 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.
>
>


-- 
Norberto Leite

-- 
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: Why does Django Fail on Date Field?

2011-03-09 Thread octopusgrabbus
This is a MySQL 5.0+ database. I can manually insert using Query
Browser.

On Mar 8, 12:34 pm, octopusgrabbus  wrote:
> Sorry. The error is Exception Type:
> ValidationError
> Exception Value:
> [u'Enter a valid date in -MM-DD format.']
>
> I have printed out for myself to prove that my date is in this format.
>
> On Mar 8, 8:24 am, Jirka Vejrazka  wrote:> Well, 
> we're missing the bit where you tell us what error are you
> > getting. I don't know about others, but my crystal ball is a bit dusty
> > these days.
>
> > The models.py snippet you posted is obvious result of inspectdb
> > output, which *may* need some manual tweaking. But it's difficult for
> > us to guess as we don't know your database and we don't know what
> > exactly is wrong (except for "Django fails").
>
> > If you add more details, someone might be able to help you
>
> > My 2 cents
>
> >    Jirka
>
> > On Tue, Mar 8, 2011 at 14:08, octopusgrabbus  
> > wrote:
> > > Here is the table:
>
> > > class CsRemove(models.Model):
> > >    action = models.CharField(max_length=3, db_column='Action') #
> > > Field name made lowercase.
> > >    endpointid = models.IntegerField(primary_key=True,
> > > db_column='EndpointId') # Field name made lowercase.
> > >    devicetype = models.IntegerField(primary_key=True,
> > > db_column='DeviceType') # Field name made lowercase.
> > >    channelnumber = models.IntegerField(primary_key=True,
> > > db_column='ChannelNumber') # Field name made lowercase.
> > >    actiondate = models.DateField(primary_key=True,
> > > db_column='ActionDate') # Field name made lowercase.
> > >    class Meta:
> > >        db_table = u'cs_remove'
>
> > > I can use MySQL Query browser and insert successfully. Django cannot.
> > > I can easily roll some MySQL code to do this, but would prefer to do
> > > it the Django way.
>
> > > What am I missing?
>
> > > 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 
> > > athttp://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: Sharable permalinks

2011-03-09 Thread urukay
Hi,

one way is to do it like google docs when you want to share your doc
with other people for viewing only..generate link with unique key e.g.
www.whatever.com/page/321fg6h4fgh321fdh654fh654fh/
You store the key in your DB and verify validity of the link.
Then you can also restrict access to it, not every one is allowed to
see it, right? And you can use this key to grant access to other
subpages of page.

But also temporary account is solution too, but you should also
restrict access to other pages.

Radovan



On 9. Mar., 10:31 h., Torsten Bronger 
wrote:
> Hall chen!
>
> We create a central database for our research institute.  One must
> be logged-in in order to access any pages.  Sometimes, however, it
> is interesting to be able to send a deep link in an email to an
> external collegue who doesn't have an account.
>
> The collegue should then be able to see the link, and a couple of
> others (in particular, the embedded graphics).  Thus, the sent link
> must be connected with a set of pages it grants access to.
>
> How would you solve this?  A session key in the query string?  How
> do I then propagate the query string to all the  tags in the
> page?
>
> Or is a dynamically generated account better?
>
> Is there a better way to identify the set of accessable pages than
> by a set of URLs?
>
> Is there already middleware in existence that I could use?
>
> Tsch ,
> Torsten.
>
> --
> Torsten Bronger    Jabber ID: torsten.bron...@jabber.rwth-aachen.de
>                                   orhttp://bronger-jmp.appspot.com

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



AW: automated query if already exists

2011-03-09 Thread Szabo, Patrick (LNG-VIE)
Hi, 

So easy :-)

Thanks i just didn't think of that hat.

Kind regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Casey Greene
Gesendet: Mittwoch, 09. März 2011 14:12
An: django-users@googlegroups.com
Betreff: Re: automated query if already exists

Hi Patrick,

Does get not do what you want?

http://docs.djangoproject.com/en/dev/topics/db/queries/#retrieving-a-single-object-with-get

Hope this helps,
Casey

On 03/09/2011 08:03 AM, Szabo, Patrick (LNG-VIE) wrote:
> Hi,
>
> Since django is able to do so much so easy i was wandering if there was
> some kind of possibility to check if an entry with the same values
> already exists.
>
> I've tried unique_together but this only does the job on the database
> end and if i want to store an not unique object i get an error.
>
> I'd rather not show that error but return my own message.
>
> Is there a simpler way to do this thatn check alle the entries "manually"
>
> Kind regards
>
> . . . . . . . . . . . . . . . . . . . . . . . . . .
>
> **
>
> Patrick Szabo
> XSLT Developer
>
> LexisNexis
> Marxergasse 25, 1030 Wien
>
> patrick.sz...@lexisnexis.at 
>
> Tel.: +43 (1) 534 52 - 1573
>
> Fax: +43 (1) 534 52 - 146
>
>
>
> --
> 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.



-- 
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: automated query if already exists

2011-03-09 Thread Casey Greene

Hi Patrick,

Does get not do what you want?

http://docs.djangoproject.com/en/dev/topics/db/queries/#retrieving-a-single-object-with-get

Hope this helps,
Casey

On 03/09/2011 08:03 AM, Szabo, Patrick (LNG-VIE) wrote:

Hi,

Since django is able to do so much so easy i was wandering if there was
some kind of possibility to check if an entry with the same values
already exists.

I’ve tried unique_together but this only does the job on the database
end and if i want to store an not unique object i get an error.

I’d rather not show that error but return my own message.

Is there a simpler way to do this thatn check alle the entries ”manually”

Kind regards

. . . . . . . . . . . . . . . . . . . . . . . . . .

**

Patrick Szabo
XSLT Developer

LexisNexis
Marxergasse 25, 1030 Wien

patrick.sz...@lexisnexis.at 

Tel.: +43 (1) 534 52 - 1573

Fax: +43 (1) 534 52 - 146



--
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: Job on Django + python

2011-03-09 Thread Prashant C
Hi,

JOB
DESCRIPTION


The vacancy is for a large Mumbai-based media house which has
incubated a media-focused private equity fund, focusing on India and
other emerging markets.

DESIGNATION:  Manager – Software Development


REPORTING TO: CTO


EXPERIENCE: 3 to 4 Years in total and atleast 2 years in the relevant
skillset

QUALIFICATION: B.E. / B.Tech Computers/IT from reputed institute. Post
graduation (ME  / MCA / MCS / MCM) would be a plus


SALARY: As per industry standards


TEAM SIZE: Should be able to work in a start-up environment

LOCATION: Mumbai

JOB ROLE / RESPONSIBILITIES:
•   Responsible for new development, feature addition and updation of
Online platforms the company operates or plan to launch
•   Understanding product / project requirements
•   Proposing decisions related to technological architecture
•   Implementations of final decisions
•   Should be able understand existing code and modify
•   Should be able to work in smaller teams
•   Should have an expertise in web applications

KEY SKILL SET:
KNOWLEDGE OF FOLLOWING IS COMPULSORY:
DJANGO + PYTHON, JAVASCRIPT, AJAX, MONGODB, LINUX PLATFORM, SVN, SSH
LOGINS

KNOWLEDGE OF FOLLOWING WILL BE A PLUS :
NGINX, LINUX CHROOT ENVIRONMENT, TYRANT, SOLR, WEB SERVICES

PERSONALITY TRAITS:

•   The individual needs to be a team player
•   Go getter and passionate about new technologies
•   Candidate should be self starter & open to learn new technologies
and handle various technical integrations
•   Hard working and sincere towards the company, team and projects
•   Continuous self development – Individually and Collectively


Please revert asap as this is a very urgent requirement



On Mar 9, 5:34 pm, spa...@gmail.com wrote:
> Hello Prashant,
>
> Can you please send detailed JD.
>
> Thanks and Regards,
> Sumod
>
> On Wed, Mar 9, 2011 at 12:38 PM, Prashant C 
> wrote:
>
>
>
> > Hi ,
>
> > We are looking for developers looking to work on a Django + python
> > project, job location is mumbai,
> > Salary is not an issue for a right candidate
>
> > you can send me an email at prashantchaudha...@gmail.com
>
> > Regards
> > Prashant chaudharry
>
> > --
> > 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.
>
> --http://spawgi.wordpress.com
> We can do it and do it better.

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



automated query if already exists

2011-03-09 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

Since django is able to do so much so easy i was wandering if there was
some kind of possibility to check if an entry with the same values
already exists.

 

I've tried unique_together but this only does the job on the database
end and if i want to store an not unique object i get an error.

I'd rather not show that error but return my own message.

 

Is there a simpler way to do this thatn check alle the entries
"manually"

 

Kind regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





-- 
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: Re: Multiple Servers and Authentication Sessions Breaking

2011-03-09 Thread Henrik Genssen
and do you use the same SECRET_KEY on both servers?

regards

Henrik

>reply to message:
>date: 09.03.2011 13:33:17
>from: "Tom Evans" 
>to: django-users@googlegroups.com
>subject: [] Re: Multiple Servers and 
>Authentication Sessions Breaking
>
>On Wed, Mar 9, 2011 at 8:24 AM, Matthew Roy  wrote:
>> I'm running a site with 2 front end servers (lighttpd with django in
>> fcgi daemons) and one database server (MySQL). The two front end
>> servers are in DNS round-robin so a user might get some content from
>> one and some from the other in any given session. All this works fine
>> and has had no problems for the past year it's been live.
>>
>> Now we're starting to actually use the Django authentication
>> middleware and admin interface on the production servers and it's
>> logging out users whenever their browser makes multiple requests or
>> bounces between servers. What's going wrong? Does Django not store
>> sessions in the database? Is the auth framework caching instead of
>> going back to the database server?
>>
>> Thanks for your help,
>> Matthew
>>
>
>Django stores sessions where you tell it to store sessions - what do
>you have SESSION_ENGINE set to?
>
>Cheers
>
>Tom
>
>-- 
>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: Logging raw sql

2011-03-09 Thread krzysiekpl
Hi, if you are using postgresql you can use logger_collector. Try
this: http://www.postgresql.org/docs/8.3/static/runtime-config-logging.html.

On 9 Mar, 05:04, Dave Sluder  wrote:
> I need to log all insert/update/delete queries such that the database
> could be rebuilt from the log. I know I can do this at the database
> level, but I need to log selectively for certain models.
> The statements captured from db.connection.queries still contain
> parameters so they won't work.
>
> Does anyone have any insight as to where I can intercept the raw query
> if at all?

-- 
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: Job on Django + python

2011-03-09 Thread spawgi
Hello Prashant,

Can you please send detailed JD.

Thanks and Regards,
Sumod

On Wed, Mar 9, 2011 at 12:38 PM, Prashant C wrote:

> Hi ,
>
> We are looking for developers looking to work on a Django + python
> project, job location is mumbai,
> Salary is not an issue for a right candidate
>
> you can send me an email at prashantchaudha...@gmail.com
>
> Regards
> Prashant chaudharry
>
> --
> 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.
>
>


-- 
http://spawgi.wordpress.com
We can do it and do it better.

-- 
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: Multiple Servers and Authentication Sessions Breaking

2011-03-09 Thread Tom Evans
On Wed, Mar 9, 2011 at 8:24 AM, Matthew Roy  wrote:
> I'm running a site with 2 front end servers (lighttpd with django in
> fcgi daemons) and one database server (MySQL). The two front end
> servers are in DNS round-robin so a user might get some content from
> one and some from the other in any given session. All this works fine
> and has had no problems for the past year it's been live.
>
> Now we're starting to actually use the Django authentication
> middleware and admin interface on the production servers and it's
> logging out users whenever their browser makes multiple requests or
> bounces between servers. What's going wrong? Does Django not store
> sessions in the database? Is the auth framework caching instead of
> going back to the database server?
>
> Thanks for your help,
> Matthew
>

Django stores sessions where you tell it to store sessions - what do
you have SESSION_ENGINE set to?

Cheers

Tom

-- 
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 best server for Django

2011-03-09 Thread Bruce Dou
Linode or EC2.

On Wed, Mar 9, 2011 at 5:53 PM, Chen Xu  wrote:
> I am thinking to buy a server, and integrated with Django environment. So
> could anyone please give me some suggestions, which server is the best for
> this, amazon ec2 or?
>
> Thanks very much
> Best regards
>
> --
> ⚡ Chen Xu ⚡
>
> --
> 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.
>



-- 
A decathlon Drupal developer & programmer
http://blog.eood.cn/

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



Multiple Servers and Authentication Sessions Breaking

2011-03-09 Thread Matthew Roy
I'm running a site with 2 front end servers (lighttpd with django in
fcgi daemons) and one database server (MySQL). The two front end
servers are in DNS round-robin so a user might get some content from
one and some from the other in any given session. All this works fine
and has had no problems for the past year it's been live.

Now we're starting to actually use the Django authentication
middleware and admin interface on the production servers and it's
logging out users whenever their browser makes multiple requests or
bounces between servers. What's going wrong? Does Django not store
sessions in the database? Is the auth framework caching instead of
going back to the database server?

Thanks for your help,
Matthew

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



Job on Django + python

2011-03-09 Thread Prashant C
Hi ,

We are looking for developers looking to work on a Django + python
project, job location is mumbai,
Salary is not an issue for a right candidate

you can send me an email at prashantchaudha...@gmail.com

Regards
Prashant chaudharry

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



Logging raw sql

2011-03-09 Thread Dave Sluder
I need to log all insert/update/delete queries such that the database
could be rebuilt from the log. I know I can do this at the database
level, but I need to log selectively for certain models.
The statements captured from db.connection.queries still contain
parameters so they won't work.

Does anyone have any insight as to where I can intercept the raw query
if at all?

-- 
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 best server for Django

2011-03-09 Thread william ratcliff
For hosted, I rather like webfaction.

On Wed, Mar 9, 2011 at 5:34 AM, Norberto Leite  wrote:

> PS - You are not buying a server on EC2, google apps engine or any VPS
> provider, you are renting!
>
>
> On Wed, Mar 9, 2011 at 11:33 AM, Norberto Leite wrote:
>
>> What you need is a the proper server for your application needs.If you are
>> looking for managed hosting there are plenty of options to do this, a simple
>> google query will give a lifetime of options.
>> Now if you want to manage your own server instance and you need to define
>> which type of machine you are looking for. Django/Python will run in the
>> most common OS's,the question is which applies the best to your needs.
>>
>> In my case I'm using a linode VPS (*Linode 
>> 512)
>> *which pretty much handles all my server needs for the time being.
>>
>> If you are looking for a more extensible / elastic platform that enables
>> you to scale up or down in a very fashionable way I recommend the using an
>> EC2 instance.
>> Pretty straightforward way getting started and a lot of already available
>> instance images tailored for django environments.
>> But there are tons of different hosting / housing / VPS solutions tailored
>> for django.
>>
>> For the more purists, the recommendation will be google web apps wich
>> as plenty of support  and helps paying Guido salary :)
>>
>> It's all about having a clear view of what you need and how much you are
>> willing to pay.
>>
>> N.
>>
>>
>> On Wed, Mar 9, 2011 at 10:53 AM, Chen Xu  wrote:
>>
>>> I am thinking to buy a server, and integrated with Django environment. So
>>> could anyone please give me some suggestions, which server is the best for
>>> this, amazon ec2 or?
>>>
>>> Thanks very much
>>> Best regards
>>>
>>> --
>>> ⚡ Chen Xu ⚡
>>>
>>> --
>>> 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.
>>>
>>
>>
>>
>> --
>> Norberto Leite
>>
>>
>
>
> --
> Norberto Leite
>
>  --
> 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: The server failed after serving a video file.

2011-03-09 Thread Tom Evans
On Wed, Mar 9, 2011 at 11:29 AM, Kenneth Gonsalves
 wrote:
> On Wed, 2011-03-09 at 11:26 +, Tom Evans wrote:
>> These are to be expected in this sort of scenario. If you want to
>> support this sort of architecture, use a different hosting solution
>> for development, eg mod_wsgi, mod_fastcgi etc.
>
> you could even proxy nginx to devserver and get the best of both
> worlds ;-)

Note that this doesn't solve all the issues - the dev server can still
only handle one request at a time. It may solve the OPs issue, since
logically the video would be streamed from nginx, not from django, but
it would not solve a view trying to make a web service call to the
server the view is being served from.

Also note that nginx is not doing anything particularly clever here,
apache and other webservers are more than capable of acting as a
reverse proxy. If you already use apache, no need to learn nginx also.

Cheers

Tom

-- 
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: cannot change the year in the admin datepicker

2011-03-09 Thread Kenneth Gonsalves
On Wed, 2011-03-09 at 08:33 -0300, Ramiro Morales wrote:
> > shall I file a ticket? I am still amazed that it took me 4 odd years
> to
> > notice this.
> 
> There is already a [1]ticket for this. I've just tried the latest
> patch, it
> applies (with some fuzz) and works. Souyou can use that one
> with the current non-jQuery-based widget. 

cool - will try it out
-- 
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: cannot change the year in the admin datepicker

2011-03-09 Thread Ramiro Morales
On Wed, Mar 9, 2011 at 8:07 AM, Kenneth Gonsalves
 wrote:
> On Wed, 2011-03-09 at 18:58 +0800, Russell Keith-Magee wrote:
>> Either way, this is worth a ticket, and it would be a good project to
>> tackle for 1.4.
>
> shall I file a ticket? I am still amazed that it took me 4 odd years to
> notice this.

There is already a [1]ticket for this. I've just tried the latest patch, it
applies (with some fuzz) and works. Souyou can use that one
with the current non-jQuery-based widget.

Regards,

-- 
Ramiro Morales

1. http://code.djangoproject.com/ticket/9388

-- 
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: The server failed after serving a video file.

2011-03-09 Thread Kenneth Gonsalves
On Wed, 2011-03-09 at 11:26 +, Tom Evans wrote:
> These are to be expected in this sort of scenario. If you want to
> support this sort of architecture, use a different hosting solution
> for development, eg mod_wsgi, mod_fastcgi etc. 

you could even proxy nginx to devserver and get the best of both
worlds ;-)
-- 
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: The server failed after serving a video file.

2011-03-09 Thread Tom Evans
On Wed, Mar 9, 2011 at 11:19 AM, balu  wrote:
> Hi all :)
>
> I'm trying to include a video into my webpage. The page is loading
> fine and the video I embedded is playing properly.
>
> But... after loading of page, the server unexpectedly stopped working
> and it is showing an error message as below. From then it is not
> serving the requests. Please let me know how to handle this.
>

The django dev server only supports one single connection. Once you
are streaming a video to your browser, that is your single connection,
and any further connections will time out.

In your dev server log you have a number of errors:

error: [Errno 104] Connection reset by peer
  The browser on the other end reset the connection - it got tired of waiting

error: [Errno 32] Broken pipe
  The webserver tried to write to a client that had disconnected

These are to be expected in this sort of scenario. If you want to
support this sort of architecture, use a different hosting solution
for development, eg mod_wsgi, mod_fastcgi etc.

Cheers

Tom

-- 
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 + WebFaction file: where to place the ie_css3.htc file?

2011-03-09 Thread Kenneth Gonsalves
On Wed, 2011-03-09 at 13:16 +0200, Sithembewena Lloyd Dube wrote:
> Problem solved, thanks to the brilliant folks at WebFaction.

they are good guys
-- 
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.



The server failed after serving a video file.

2011-03-09 Thread balu
Hi all :)

I'm trying to include a video into my webpage. The page is loading
fine and the video I embedded is playing properly.

But... after loading of page, the server unexpectedly stopped working
and it is showing an error message as below. From then it is not
serving the requests. Please let me know how to handle this.


[08/Mar/2011 02:36:52] "POST /exam/login/ HTTP/1.1" 302 0
[08/Mar/2011 02:36:52] "GET /exam/home/ HTTP/1.1" 200 1582
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/django/core/servers/
basehttp.py", line 283, in run
self.finish_response()
  File "/usr/local/lib/python2.6/dist-packages/django/core/servers/
basehttp.py", line 323, in finish_response
self.write(data)
  File "/usr/local/lib/python2.6/dist-packages/django/core/servers/
basehttp.py", line 415, in write
self._write(data[offset:offset+chunk_size])
  File "/usr/lib/python2.6/socket.py", line 318, in write
self.flush()
  File "/usr/lib/python2.6/socket.py", line 297, in flush
self._sock.sendall(buffer(data, write_offset, buffer_size))
error: [Errno 104] Connection reset by peer

Exception happened during processing of request from ('127.0.0.1',
49573)
Traceback (most recent call last):
  File "/usr/lib/python2.6/SocketServer.py", line 283, in
_handle_request_noblock
self.process_request(request, client_address)
  File "/usr/lib/python2.6/SocketServer.py", line 309, in
process_request
self.finish_request(request, client_address)
  File "/usr/lib/python2.6/SocketServer.py", line 322, in
finish_request
self.RequestHandlerClass(request, client_address, self)
  File "/usr/local/lib/python2.6/dist-packages/django/core/servers/
basehttp.py", line 569, in __init__
BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
  File "/usr/lib/python2.6/SocketServer.py", line 618, in __init__
self.finish()
  File "/usr/lib/python2.6/SocketServer.py", line 661, in finish
self.wfile.flush()
  File "/usr/lib/python2.6/socket.py", line 297, in flush
self._sock.sendall(buffer(data, write_offset, buffer_size))
error: [Errno 32] Broken pipe

Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/django/core/servers/
basehttp.py", line 283, in run
self.finish_response()
  File "/usr/local/lib/python2.6/dist-packages/django/core/servers/
basehttp.py", line 323, in finish_response
self.write(data)
  File "/usr/local/lib/python2.6/dist-packages/django/core/servers/
basehttp.py", line 415, in write
self._write(data[offset:offset+chunk_size])
  File "/usr/lib/python2.6/socket.py", line 318, in write
self.flush()
  File "/usr/lib/python2.6/socket.py", line 297, in flush
self._sock.sendall(buffer(data, write_offset, buffer_size))
error: [Errno 104] Connection reset by peer

Exception happened during processing of request from ('127.0.0.1',
49574)
Traceback (most recent call last):
  File "/usr/lib/python2.6/SocketServer.py", line 283, in
_handle_request_noblock
self.process_request(request, client_address)
  File "/usr/lib/python2.6/SocketServer.py", line 309, in
process_request
self.finish_request(request, client_address)
  File "/usr/lib/python2.6/SocketServer.py", line 322, in
finish_request
self.RequestHandlerClass(request, client_address, self)
  File "/usr/local/lib/python2.6/dist-packages/django/core/servers/
basehttp.py", line 569, in __init__
BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
  File "/usr/lib/python2.6/SocketServer.py", line 618, in __init__
self.finish()
  File "/usr/lib/python2.6/SocketServer.py", line 661, in finish
self.wfile.flush()
  File "/usr/lib/python2.6/socket.py", line 297, in flush
self._sock.sendall(buffer(data, write_offset, buffer_size))
error: [Errno 32] Broken pipe



-- 
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 + WebFaction file: where to place the ie_css3.htc file?

2011-03-09 Thread Sithembewena Lloyd Dube
Problem solved, thanks to the brilliant folks at WebFaction.

*behaviour:url('/site_media/css/ie_css3.htc')* <= MEDIA_URL + rest of path.

Gracias.

On Wed, Mar 9, 2011 at 12:08 PM, Sithembewena Lloyd Dube
wrote:

> Hi Kenneth,
>
> I am yet to ask WebFaction. Thanks for the suggestion, I did put the file
> next to the favicon (in MEDIA_ROOT) and IE still won't execute the VML.
>
> Thanks.
>
>
> On Wed, Mar 9, 2011 at 11:55 AM, Kenneth Gonsalves  > wrote:
>
>> On Wed, 2011-03-09 at 11:51 +0200, Sithembewena Lloyd Dube wrote:
>> > - The site is hosted at WebFaction - the setup there isn't like
>> > typical GCI/
>> > PHP sites, with a root folder and such.
>> >
>> > Any ideas please?
>>
>> what did webfaction support say about this? I would suggest finding out
>> where your favicon is and putting the file in the same place.
>> --
>> 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.
>>
>>
>
>
> --
> Regards,
> Sithembewena Lloyd Dube
>



-- 
Regards,
Sithembewena Lloyd Dube

-- 
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: cannot change the year in the admin datepicker

2011-03-09 Thread Kenneth Gonsalves
On Wed, 2011-03-09 at 18:58 +0800, Russell Keith-Magee wrote:
> Either way, this is worth a ticket, and it would be a good project to
> tackle for 1.4. 

shall I file a ticket? I am still amazed that it took me 4 odd years to
notice this.
-- 
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: cannot change the year in the admin datepicker

2011-03-09 Thread Russell Keith-Magee
On Wed, Mar 9, 2011 at 4:43 PM, Kenneth Gonsalves
 wrote:
> hi,
>
> a client has pointed out to me that it is not possible to change the
> year in the admin datepicker. One has to go back month by month or
> manually do it in the text input. Could this be considered a bug?

Well, it's not a bug, because it is *possible* to specify a year, it
just isn't good UI.

However, it is an entirely reasonable feature request. There was a
recent proposal to replace Django's custom widgets with JQuery UI;
that would be one way to resolve this issue, but it's not the only
way, and we'd need to come to a decision about the use of JQueryUI.

Either way, this is worth a ticket, and it would be a good project to
tackle for 1.4.

Yours,
Russ Magee %-)

-- 
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 best server for Django

2011-03-09 Thread Norberto Leite
PS - You are not buying a server on EC2, google apps engine or any VPS
provider, you are renting!

On Wed, Mar 9, 2011 at 11:33 AM, Norberto Leite  wrote:

> What you need is a the proper server for your application needs.If you are
> looking for managed hosting there are plenty of options to do this, a simple
> google query will give a lifetime of options.
> Now if you want to manage your own server instance and you need to define
> which type of machine you are looking for. Django/Python will run in the
> most common OS's,the question is which applies the best to your needs.
>
> In my case I'm using a linode VPS (*Linode 
> 512)
> *which pretty much handles all my server needs for the time being.
>
> If you are looking for a more extensible / elastic platform that enables
> you to scale up or down in a very fashionable way I recommend the using an
> EC2 instance.
> Pretty straightforward way getting started and a lot of already available
> instance images tailored for django environments.
> But there are tons of different hosting / housing / VPS solutions tailored
> for django.
>
> For the more purists, the recommendation will be google web apps wich
> as plenty of support  and helps paying Guido salary :)
>
> It's all about having a clear view of what you need and how much you are
> willing to pay.
>
> N.
>
>
> On Wed, Mar 9, 2011 at 10:53 AM, Chen Xu  wrote:
>
>> I am thinking to buy a server, and integrated with Django environment. So
>> could anyone please give me some suggestions, which server is the best for
>> this, amazon ec2 or?
>>
>> Thanks very much
>> Best regards
>>
>> --
>> ⚡ Chen Xu ⚡
>>
>> --
>> 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.
>>
>
>
>
> --
> Norberto Leite
>
>


-- 
Norberto Leite

-- 
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 best server for Django

2011-03-09 Thread Norberto Leite
What you need is a the proper server for your application needs.If you are
looking for managed hosting there are plenty of options to do this, a simple
google query will give a lifetime of options.
Now if you want to manage your own server instance and you need to define
which type of machine you are looking for. Django/Python will run in the
most common OS's,the question is which applies the best to your needs.

In my case I'm using a linode VPS (*Linode
512)
*which pretty much handles all my server needs for the time being.

If you are looking for a more extensible / elastic platform that enables you
to scale up or down in a very fashionable way I recommend the using an EC2
instance.
Pretty straightforward way getting started and a lot of already available
instance images tailored for django environments.
But there are tons of different hosting / housing / VPS solutions tailored
for django.

For the more purists, the recommendation will be google web apps wich
as plenty of support  and helps paying Guido salary :)

It's all about having a clear view of what you need and how much you are
willing to pay.

N.


On Wed, Mar 9, 2011 at 10:53 AM, Chen Xu  wrote:

> I am thinking to buy a server, and integrated with Django environment. So
> could anyone please give me some suggestions, which server is the best for
> this, amazon ec2 or?
>
> Thanks very much
> Best regards
>
> --
> ⚡ Chen Xu ⚡
>
> --
> 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.
>



-- 
Norberto Leite

-- 
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: how to write data to csv using DictWriter

2011-03-09 Thread Kenneth Gonsalves
On Wed, 2011-03-09 at 02:00 -0800, sushanth Reddy wrote:
> I have gone through to that documentation,but output in wired
> format ,plz 
> add few lines of codes to undersstand better 

https://bitbucket.org/lawgon/fossconf/src/71c974a48f25/web/views.py at
line 1022 onwards
-- 
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: Django + WebFaction file: where to place the ie_css3.htc file?

2011-03-09 Thread Sithembewena Lloyd Dube
Hi Kenneth,

I am yet to ask WebFaction. Thanks for the suggestion, I did put the file
next to the favicon (in MEDIA_ROOT) and IE still won't execute the VML.

Thanks.

On Wed, Mar 9, 2011 at 11:55 AM, Kenneth Gonsalves
wrote:

> On Wed, 2011-03-09 at 11:51 +0200, Sithembewena Lloyd Dube wrote:
> > - The site is hosted at WebFaction - the setup there isn't like
> > typical GCI/
> > PHP sites, with a root folder and such.
> >
> > Any ideas please?
>
> what did webfaction support say about this? I would suggest finding out
> where your favicon is and putting the file in the same place.
> --
> 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.
>
>


-- 
Regards,
Sithembewena Lloyd Dube

-- 
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: how to write data to csv using DictWriter

2011-03-09 Thread sushanth Reddy
I have gone through to that documentation,but output in wired format ,plz 
add few lines of codes to undersstand better


-- 
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 + WebFaction file: where to place the ie_css3.htc file?

2011-03-09 Thread Kenneth Gonsalves
On Wed, 2011-03-09 at 11:51 +0200, Sithembewena Lloyd Dube wrote:
> - The site is hosted at WebFaction - the setup there isn't like
> typical GCI/
> PHP sites, with a root folder and such.
> 
> Any ideas please? 

what did webfaction support say about this? I would suggest finding out
where your favicon is and putting the file in the same place.
-- 
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: how to write data to csv using DictWriter

2011-03-09 Thread Kenneth Gonsalves
On Wed, 2011-03-09 at 01:33 -0800, sushanth Reddy wrote:
> How to write  below data to csv in below output format ?

http://docs.djangoproject.com/en/dev/howto/outputting-csv/
-- 
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.



What is the best server for Django

2011-03-09 Thread Chen Xu
I am thinking to buy a server, and integrated with Django environment. So
could anyone please give me some suggestions, which server is the best for
this, amazon ec2 or?

Thanks very much
Best regards

-- 
⚡ Chen Xu ⚡

-- 
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 + WebFaction file: where to place the ie_css3.htc file?

2011-03-09 Thread Sithembewena Lloyd Dube
Hi Folks,

Perchance somebody here is hosting Django sites at WebFaction, I need advice
on the situation described below:

- I have the file ie_css3.htc, which enables Internet Explorer to render
CSS3.
- The file's functionality can be accessed by adding the attribute *
behaviour:url('ie_css3.htc')* to whatever html element needs it.
- Unfortunately, instead of treating *url:('ie_css3.htc')* relative to
current location, Internet Explorer apparently looks for the file in the
root folder.
- Adding the file to MEDIA_ROOT does not resolve the issue.
- The site is hosted at WebFaction - the setup there isn't like typical GCI/
PHP sites, with a root folder and such.

Any ideas please?

-- 
Regards,
Sithembewena Lloyd Dube

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



how to write data to csv using DictWriter

2011-03-09 Thread sushanth Reddy
Hi,


How to write  below data to csv in below output format ?


list of dict


data=[{'date': datetime.date(2011, 2, 8), 'user': u'xxx', 'status': 
u'P'}, {'date': datetime.date(2011, 2, 8), 'user': u'yyy', 'status': u'P'}, 
{'date': datetime.date(2011, 2, 8), 'user': u'zzz', 'status': u'P'}, 
{'date': datetime.date(2011, 2, 9), 'user': u'xxx, 'status': u'P'}, {'date': 
datetime.date(2011, 2, 9), 'user': u'yyy', 'status': u'E'}, {'date': 
datetime.date(2011, 2, 9), 'user': u'zzz', 'status': u'E'}, {'date': 
datetime.date(2011, 2, 10), 'user': u'xxx', 'status': u'P'}, {'date': 
datetime.date(2011, 2, 10), 'user': u'yyy', 'status': u'P'}, {'date': 
datetime.date(2011, 2, 10), 'user': u'zzz', 'status': u'P'}]


Output format should be :

S.no  user  2011-02-08 2011-02-09 2011-02-10  p-total E-total total 
 1xxx  p  p p   3   0   3
 2yyy  p  E p   2   1   3
 3zzz  p  E E   1   2   3




 code :

 import csv
 from datetime import datetime,date
 
  d=28
  for i in xrange(1,d):
   date_format = now.replace( year = 2011 , month = 02 , day = i )
   writer = csv.DictWriter(f, ['S.no', 'user', 
'date_format','p-total','E-total','Total'])
   how to write to items to csv  ?

Please need help 
   

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



Sharable permalinks

2011-03-09 Thread Torsten Bronger
Hallöchen!

We create a central database for our research institute.  One must
be logged-in in order to access any pages.  Sometimes, however, it
is interesting to be able to send a deep link in an email to an
external collegue who doesn't have an account.

The collegue should then be able to see the link, and a couple of
others (in particular, the embedded graphics).  Thus, the sent link
must be connected with a set of pages it grants access to.

How would you solve this?  A session key in the query string?  How
do I then propagate the query string to all the  tags in the
page?

Or is a dynamically generated account better?

Is there a better way to identify the set of accessable pages than
by a set of URLs?

Is there already middleware in existence that I could use?

Tschö,
Torsten.

-- 
Torsten BrongerJabber ID: torsten.bron...@jabber.rwth-aachen.de
  or http://bronger-jmp.appspot.com

-- 
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 and an indirect access to the database tables (over stored procedures calls for data retrieval and modification)

2011-03-09 Thread Vazir
Have a clue now, thanks so much!

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



cannot change the year in the admin datepicker

2011-03-09 Thread Kenneth Gonsalves
hi,

a client has pointed out to me that it is not possible to change the
year in the admin datepicker. One has to go back month by month or
manually do it in the text input. Could this be considered a bug?
-- 
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: Django and an indirect access to the database tables (over stored procedures calls for data retrieval and modification)

2011-03-09 Thread Michael Radziej
On Tue, 8 Mar 2011 22:18:12 -0800 (PST), Vazir  wrote:
> There is some examples via raw() for data selects, but nothing
> about data updates. Any suggestions?

If you want to go this path, you can override the save method and do raw
SQL instead to interact with the stored procedures. Go into the django
sources, look for the module django.db.models.base--you need to get at
least a basic level of understanding how this all works.

You might also do the same for the query set class.


Kind regards

Michael

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



Failure to execute Transactional unit tests.

2011-03-09 Thread Kartik
Hi Django Gurus,

I am trying to execute a transactional test and I see this problem:

Error: Database moglog 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.
Hint: Look at the output of 'django-admin.py sqlflush'. That's the SQL
this command wasn't able to run.
The full error: (1146, "Table 'moglog.south_migrationhistory' doesn't
exist")

I am trying to update one column (source code/unit tests given below).
Hopefully after the test has been executed, all changes would be
rolled back. Is there a way to avoid flushing the database before
executing the test. Any assistance would be appreciated.

I have a source code that runs updates one column in the table. I am
trying to test this code.

def SoftDeleteExistingRackTypes(attributes):
  soft_delete_count = 0  # number of soft deletes.
  rack_type_name = attributes.get('name')
  fetched_rack_types = \
 
models.RackType.objects.filter(name__iexact=rack_type_name).distinct()
  for fetched_rack_type in fetched_rack_types:
fetched_rack_type.delete_flag=True
soft_delete_count+=1
fetched_rack_type.save()
  return soft_delete_count

My unit test is given below:

class TransactionalTest(test.TransactionTestCase):
  """Test actual database calls.

  This call leverages django's transaction api.
  """

  def setUp(self):
super(TransactionalTest, self).setUp()
transaction.enter_transaction_management()
transaction.managed(True)

  def testSoftDeleteExistingRackTypes(self):
"""Test soft delete of rack type."""
# Just take the first one.
attributes = FAKE_ATTRIBUTE_LIST[0]
count =
rack_type_dimension_update.SoftDeleteExistingRackTypes(attributes)
self.assertTrue(count > 0, 'Should have atleast one valid value')


  def tearDown(self):
super(TransactionalTest, self).tearDown()
if transaction.is_dirty():
  transaction.rollback()
transaction.leave_transaction_management()

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



Two request.GET on same site

2011-03-09 Thread maciekjbl
Hi,

My problem is how can I separate two request on the same site. This
situation is caused by text field in base template and form in another
template which extends base.

My view.py:

def search(request):
if 'q' in request.GET:
term = request.GET['q']
prod =
Producent.objects.filter(Q(nazwa_producenta__contains=term))
context = {
'producent' : prod,
}
return render_to_response(
'promocje/producent_search.html',
context,
context_instance = RequestContext(request),
)

def lista_promocji(request, slug):
producent = get_object_or_404(Producent, slug=slug)
promo = PromocjaFilter(request.GET,
queryset=Promocja.objects.filter(producent=producent))
return render_to_response(
'promocje/producent_detail.html',
{"promo" : promo, "prod" : producent }
)

My base template :
 
   Strona Główna  
  Wyszukaj Producenta: 

My second template with form (lista_promocji):
  
{{ promo.form.as_p }}



Now when I try to use form to filter content it triggers input in base
template and I get search view insted of filterd site.

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