Re: Django password reset modification

2011-05-05 Thread Phui-Hock
On May 6, 4:22 am, Shawn Milochik  wrote:
> This is a bad idea for multiple reasons. Don't do it.

Huh, care to explain, please?

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



Re: Email app is breaking long lines, any fix?

2011-05-05 Thread Jason Culverhouse

On May 5, 2011, at 5:50 PM, John Crawford wrote:

> I'm using the filebased email backend for testing (although the console 
> version had the same problem). When I send email, either via function or 
> template, lines that are too long, are broken, with an '=' sign at the end. 
> For instance:
> 
> this is a test of a really long line that has more words that could possibl=
> y fit in a single column of text.
> 
> When sending email, is there some maximum-linelength variable, or something, 
> that's truncating/breaking lines? Any way to prevent this from happening?

The answer is no, it it the underlying python email.MIMEText object that is 
performing the encoding
The only encoding that isn;t going to wrap is charset="us-ascii"

http://www.rfc-editor.org/rfc/rfc5322.txt

2.1.1.  Line Length Limits

   There are two limits that this specification places on the number of
   characters in a line.  Each line of characters MUST be no more than
   998 characters, and SHOULD be no more than 78 characters, excluding
   the CRLF.

   The 998 character limit is due to limitations in many implementations
   that send, receive, or store IMF messages which simply cannot handle
   more than 998 characters on a line.  Receiving implementations would
   do well to handle an arbitrarily large number of characters in a line
   for robustness sake.  However, there are so many implementations that
   (in compliance with the transport requirements of [RFC5321]) do not
   accept messages containing more than 1000 characters including the CR
   and LF per line, it is important for implementations not to create
   such messages.

   The more conservative 78 character recommendation is to accommodate
   the many implementations of user interfaces that display these
   messages which may truncate, or disastrously wrap, the display of
   more than 78 characters per line, in spite of the fact that such
   implementations are non-conformant to the intent of this
   specification (and that of [RFC5321] if they actually cause
   information to be lost).  Again, even though this limitation is put
   on messages, it is incumbent upon implementations that display
   messages to handle an arbitrarily large number of characters in a
   line (certainly at least up to the 998 character limit) for the sake
   of robustness.


Jason
> 
> Code I'm using to test:
> 
> EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
> from django.core.mail import send_mail
> 
> def send_letter(request):
>the_text = 'this is a test of a really long line that has more words that 
> could possibly fit in a single column of text.'
>send_mail('some_subject', the_text, 'm...@test.com', ['m...@test.com'])
> 
> Thanks.
> John C>
> 
> -- 
> 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: selecting all columns from a table (advanced query)

2011-05-05 Thread Andy McKay
> anyone can help show columns from list and listi18n? I tried extra but It 
> doesn't allow me to pass things like category_list.* 


You retrieve and populate data from one model in django, no more than that. 
Select related allows you to avoid lookups on objects related to the initial 
model.
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

-- 
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: not able to use editable=True or false in forms.CharField()

2011-05-05 Thread GKR
what is the alternative to disable any form field

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



Email app is breaking long lines, any fix?

2011-05-05 Thread John Crawford
I'm using the filebased email backend for testing (although the 
console version had the same problem). When I send email, either via 
function or template, lines that are too long, are broken, with an 
'=' sign at the end. For instance:


this is a test of a really long line that has more words that could possibl=
y fit in a single column of text.

When sending email, is there some maximum-linelength variable, or 
something, that's truncating/breaking lines? Any way to prevent this 
from happening?


Code I'm using to test:

EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
from django.core.mail import send_mail

def send_letter(request):
the_text = 'this is a test of a really long line that has more 
words that could possibly fit in a single column of text.'

send_mail('some_subject', the_text, 'm...@test.com', ['m...@test.com'])

Thanks.
John C>

--
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 text inputs into a string

2011-05-05 Thread Ben Walker
Hey!

Goal: To create a question field where a user can come and create a
mad-libs style question and then have others vote yes or no. (e.g.
"Would you fool around with (text input)__ if _(text
input)___ and _(text input)__ were not together?)

I am using Google App Engine and Django forms and I have created the
form to store the question

from django import newforms as forms
import models
from google.appengine.ext.db import djangoforms

class PollForm(djangoforms.ModelForm):
class Meta:
model = models.Poll


from google.appengine.ext import db
from django import newforms as forms

class Poll(db.Model):
question = db.StringProperty()
created_on = db.DateTimeProperty(auto_now_add = 1)
created_by = db.UserProperty()

def __str__(self):
return '%s' %self.question

def get_absolute_url(self):
return '/poll/%s/' % self.key()

Yet it is only taking one input. Is there a way to change this in the
django form or should I just hard code it into the HTML and then point
to that?

I thank anyone who takes the time to look over this question!

-Ben

-- 
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: Do any financial firms use a Django framework?

2011-05-05 Thread Jason Beaudoin
On Tue, May 3, 2011 at 10:53 AM, rpt...@reportlab.com
 wrote:
> Does anyone know of any financial firms which use a Django framework?

Yep. I build advanced payment services for a prominent, offshore
payment service provider, using django, python and nginx/uwsgi at the
core.

~JB

-- 
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: Question about ModelAdmin.formfield_for_foreignkey

2011-05-05 Thread Juan Pablo Romero Méndez
I think i solved it. This is the chain of method calls of admin.ModelAdmin:

...
change_view
  get_form
 formfield_for_foreignkey
...

get_form receives the current object as parameter, so all I had to do was to
inject obj in the request:

def get_form(self, request, obj=None, **kwargs):
request.obj = obj
return super(AuthorContenidoAdmin, self).get_form(request, obj,
**kwargs)

and retrieve it later in formfield_for_foreignkey:

def formfield_for_foreignkey(self, db_field, request=None, **kwargs):
obj = request.obj
if db_field.name == 'status' and obj is not None:
allowed_states = [t.destination for t in
 get_allowed_transitions(obj,request.user)]
kwargs['queryset'] = FakeQueryset([get_state(obj)] +
 allowed_states)
return super(AuthorContenidoAdmin,
self).formfield_for_foreignkey(db_field, request, **kwargs)



Regards,

  Juan Pablo

2011/5/5 Daniel Roseman 

> On Thursday, May 5, 2011 10:32:47 PM UTC+1, juanpa wrote:
>>
>> Hello,
>>
>> Is it possible to obtain a reference to the modified object
>> in ModelAdmin.formfield_for_foreignkey?
>>
>> Thanks!
>>
>>Juan Pablo
>>
>
> What do you mean, modified? formfield_for_foreignkey is used for defining
> the form, long before any modifications take place.
> --
> DR.
>
> --
> 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: Aggregation annotate question.

2011-05-05 Thread Russell Keith-Magee
On Fri, May 6, 2011 at 1:26 AM, Satan Study Django
 wrote:
> Hi. I've some question about aggregation annotate functions, like Max.
> I don't realy like the queries it makes. Let me explain.
>
> Models:
> class Person (models.Model):
>    name = models.CharField (max_length = 100)
>    login = models.CharField (max_length = 30)
> class Home (models.Model):
>    person = models.ForeignKey (Person)
>    state = models.ForeignKey (States)
>    date = models.DateTimeField ()
>    host = models.ForeignKey (Hosts)
>    time_spent = models.PositiveIntegerField (null = True)
>
>
> Here is the expression with query made by it:
>
 print Home.objects.values('person').annotate(Max('id')).order_by().query
> SELECT `main_home`.`person_id`, MAX(`main_home`.`id`) AS `id__max`
> FROM `main_home`
> GROUP BY `main_home`.`person_id`, `main_home`.`person_id`
> ORDER BY NULL
>
> Here i try to explain it:
>
> mysql> explain SELECT `main_home`.`person_id`, MAX(`main_home`.`id`)
> AS `id__max`
> FROM `main_home`
> GROUP BY `main_home`.`person_id`, `main_home`.`person_id`
> ORDER BY NULL;
> ++-+---+---+---
> ++-+--+--
> +--+
> | id | select_type | table | type | possible_keys | key | key_len |
> ref | rows | Extra |
> ++-+---+---+---
> ++-+--+--
> +--+
> | 1 | SIMPLE | main_home | index | NULL | main_home_21b911c5 | 4 |
> NULL | 2188 | Using index; Using temporary |
> ++-+---+---+---
> ++-+--+--
> +--+
>
> As you can see, Using temporary is added, it's bacause
> `main_home`.`person_id` used in GROUP BY 2 times:
> GROUP BY `main_home`.`person_id`, `main_home`.`person_id`
> and it makes query to run really long time.
>
> If i'll manually remove one of `main_home`.`person_id` from GROUP BY,
> query explain will contain no Using temporary, so execution takes
> short time.
>
> Could somebody explain to me - is it a feature? If it is, i really
> want to listen reason why. If not - then what? A bug?

Looks like a bug to me. If there isn't already a ticket describing
this, please open one so that the problem isn't forgotten.

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: Runserver has connection limit?

2011-05-05 Thread Fabrizio Mancini

Il giorno 05/mag/2011, alle ore 18.26, Davepar ha scritto:
> Any suggestions for limiting the Chrome connections or beefing up
> runserver? I don't really want to run a real http server for
> development. I like the auto-reload of runserver.
If it's just for development you can look at this
http://nedbatchelder.com/blog/201103/quick_and_dirty_multithreaded_django_dev_server.html
hth
fabrizio

-- 
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: Question about ModelAdmin.formfield_for_foreignkey

2011-05-05 Thread Daniel Roseman
On Thursday, May 5, 2011 10:32:47 PM UTC+1, juanpa wrote:
>
> Hello,
>
> Is it possible to obtain a reference to the modified object 
> in ModelAdmin.formfield_for_foreignkey?
>
> Thanks!
>
>Juan Pablo
>

What do you mean, modified? formfield_for_foreignkey is used for defining 
the form, long before any modifications take place.
--
DR.

-- 
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: not able to use editable=True or false in forms.CharField()

2011-05-05 Thread Daniel Roseman
On Thursday, May 5, 2011 10:17:38 PM UTC+1, GKR wrote:
>
> not able to use editable=True or false in forms.CharField()
>
> getting error as
>
> TypeError at /items_entry/ 
>
> __init__() got an unexpected keyword argument 'editable'
>
>  Request Method: GET  Request URL: http://localhost:8000/items_entry/  Django 
> Version: 1.3  Exception Type: TypeError  Exception Value: 
>
> __init__() got an unexpected keyword argument 'editable'
>
>  Exception Location: C:\Python27\lib\site-packages\django\forms\models.py 
> in __init__, line 912
>

`editable` is not an argument for form fields.
--
DR.

-- 
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: not able to use editable=True or false in forms.CharField()

2011-05-05 Thread GKR
ya removing the editable kwarg gets rid of the error.


-- 
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: not able to use editable=True or false in forms.CharField()

2011-05-05 Thread Shawn Milochik

Unless you want guesses, we'll need to see the code causing the problem.

Can you post your models.py (or wherever the 'editable' kwarg is)?

Can you also confirm that removing the 'editable' kwarg gets rid of the 
error? That, along with the code, will help a lot.


--
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: Testing if a receiver is connected to a signal

2011-05-05 Thread Vinicius Mendes
Boa. Funciona para resolver esse problema.

Atenciosamente,
Vinicius Mendes
Engenheiro de Computação
Globo.com



On Thu, May 5, 2011 at 1:33 PM, Bernardo Fontes wrote:

> Hello everybody,
>
> I resolved this problem by looking at Djangos Signal's code and
> understanding its structure. The signal has an attribute called receivers
> which has stored references to its receivers function that were connect to
> it. When the send function is called, the signal just call this function
> which are in this receivers list. So, I created a setUpClass and a
> tearDownClass that does a monkey patch with my signal. It's like this:
>
>
> class YourTestClass(TestCase):
>
>
> @classmethod
> def setUpClass(cls):
> cls.signal_receivers = my_signal.receivers
> my_signal.receivers = []
>
>
> @classmethod
> def tearDownClass(cls):
> my_signal.receivers = cls.signal_receivers
>
> Hope I could help!
>
>
> --
> Bernardo Fontes
> http://www.bernardofontes.net
> bernardo...@gmail.com 
> Skype: bernardoxhc
> (21) 9629 1621
>
> --
> 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.



Question about ModelAdmin.formfield_for_foreignkey

2011-05-05 Thread Juan Pablo Romero Méndez
Hello,

Is it possible to obtain a reference to the modified object
in ModelAdmin.formfield_for_foreignkey?

Thanks!

   Juan Pablo

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



not able to use editable=True or false in forms.CharField()

2011-05-05 Thread GKR
not able to use editable=True or false in forms.CharField()

getting error as

TypeError at /items_entry/ 

__init__() got an unexpected keyword argument 'editable'

 Request Method: GET  Request URL: http://localhost:8000/items_entry/  Django 
Version: 1.3  Exception Type: TypeError  Exception Value: 

__init__() got an unexpected keyword argument 'editable'

 Exception Location: C:\Python27\lib\site-packages\django\forms\models.py in 
__init__, line 912

-- 
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 password reset modification

2011-05-05 Thread Shawn Milochik

This is a bad idea for multiple reasons. Don't do 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.



Django password reset modification

2011-05-05 Thread Rich
Django framework comes with a reset password out of the box feature.
I would like to modify this to where a password is sent to the user
via e-mail. I looked at the code in django\contib\auth\views.py
I'm not sure how I can modify it.




Django Reset Password

The Django framework comes with support for resetting user passwords.
This is implemented for the Admin app, but it is possible to re-use
from your own screens.
URLs

The following four URLs are used in the password reset

(r'^accounts/password/reset/$',
'django.contrib.auth.views.password_reset',
{'post_reset_redirect' : '/accounts/password/reset/done/'}),
(r'^accounts/password/reset/done/$',
'django.contrib.auth.views.password_reset_done'),
(r'^accounts/password/reset/(?P[0-9A-Za-z]+)-(?P.+)/$',
'django.contrib.auth.views.password_reset_confirm',
{'post_reset_redirect' : '/accounts/password/done/'}),
(r'^accounts/password/done/$',
'django.contrib.auth.views.password_reset_complete'),

Templates

The following five templates are required. These are the templates for
the four urls pointed to from the urlpatterns above, plus one template
for the email.

* registration/password_reset_complete.html
* registration/password_reset_confirm.html
* registration/password_reset_done.html
* registration/password_reset_form.html
* registration/password_reset_email.html

-- 
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: Admin page select boxes smashed

2011-05-05 Thread John
I have tried chrome, firefox and ie on both versions. They all work
perfectly on the windows instance and are smashed on the linux
instance. I haven't tried changing the admin css files yet, they are
the same on the linux and windows installs. I was hoping that
something else could be mangling it because it is just the default
admin pages and they worked on windows.

On May 5, 2:24 pm, Dave Sayer  wrote:
> Looks like your issue is cross browser CSS as opposed to a Django
> issue. Have you tried looking for css based solutions? What browsers
> are you using on each machine?
>
> On 5 May 2011 18:41, John  wrote:
>
>
>
>
>
>
>
>
>
> > Hi there, I am working on a project to track servers, filesystems, and
> > space allocations using django. I have been testing the project using
> > eclipse on windows and the command line on a linux server, where it
> > will ultimately reside.
>
> > I am having a problem with the select boxes and textareas on the admin
> > page when it is run on the linux server. I looked for a solution to
> > this for a few days, but haven't come across anything. Below are links
> > to what I am seeing on windows and linux.
>
> > What I see in windows - Good
> >https://picasaweb.google.com/lh/photo/qbE0Ag3E_TgfIU899th9r21blcxgCSW...
>
> > What I see on Linux - Bad
> >https://picasaweb.google.com/lh/photo/cqe-pYEaRGbIGIUaLX-NsG1blcxgCSW...
>
> > You can clearly see that the select box and textarea fields are screwy
> > on the linux version. I tried doing a diff of all the css and
> > javascript files from the admin page on both installs and they came
> > out the same. So now I am stuck and looking for a solution. Any help
> > is greatly appreciated.
>
> > 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.
>
> --
> ---
> Dave Sayer | Bath Design
> Web design & development with standards
> ---
> mobile: +44 (0)7702787436
> email: d...@bathdesign.co.uk
> web:http://bathdesign.co.uk
> photography:http://davesayer.com
> twitter:http://twitter.com/sweet_grass
> ---

-- 
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: No module named messages.

2011-05-05 Thread Jacob Scherffenberg
Cool, but what folder should i put, the content of that download into,
found something similar.
but im not quite sure which python folder is the right one?
whereis python - gives me like 10 paths.

On 5 Maj, 20:55, David Markey  wrote:
> A quick google yields:
>
> https://github.com/robhudson/django-debug-toolbar
>
> On 5 May 2011 19:51, Jacob Scherffenberg  wrote:
>
>
>
>
>
>
>
> > I found the problem, but stil doesn't really know what to do.
> > But i was fairly sure that i used 1.3, which i did.
> > But when i install the debug-toolbar with sudo apt-get install pyhton-
> > djang-debug-toolbar.
> > My django version changes to version 1.1.1
> > Where can i get the toolbar otherwise, and without apparently reseting
> > my django version?
>
> > On 5 Maj, 14:12, Karen Tracey  wrote:
> > > On Thu, May 5, 2011 at 7:43 AM, Jacob Scherffenberg <
> > dikumol...@gmail.com>wrote:
>
> > > > Im using Django-1.3
>
> > > Are you absolutely sure about that? The message generally happens when
> > you
> > > have a settings file produced by 1.2+ or higher (thus including the
> > > django.contrib.messages app in INSTALLED_APPS) but the running level of
> > > Django is from before that module was added.
>
> > > 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.

-- 
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: No module named messages.

2011-05-05 Thread Jacob Scherffenberg
Okay i see now that the packages system install both python-django and
python-django-debug-toolbar,
when i ask for the debug-toolbar.
And apparently the python-django version in the package systems is
1.1.1 which is the problem.
but how do i get debug-toolbar without getting python-django(again) ?

On 5 Maj, 20:51, Jacob Scherffenberg  wrote:
> I found the problem, but stil doesn't really know what to do.
> But i was fairly sure that i used 1.3, which i did.
> But when i install the debug-toolbar with sudo apt-get install pyhton-
> djang-debug-toolbar.
> My django version changes to version 1.1.1
> Where can i get the toolbar otherwise, and without apparently reseting
> my django version?
>
> On 5 Maj, 14:12, Karen Tracey  wrote:
>
>
>
>
>
>
>
> > On Thu, May 5, 2011 at 7:43 AM, Jacob Scherffenberg 
> > wrote:
>
> > > Im using Django-1.3
>
> > Are you absolutely sure about that? The message generally happens when you
> > have a settings file produced by 1.2+ or higher (thus including the
> > django.contrib.messages app in INSTALLED_APPS) but the running level of
> > Django is from before thatmodulewas added.
>
> > 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: Admin page select boxes smashed

2011-05-05 Thread Dave Sayer
Looks like your issue is cross browser CSS as opposed to a Django
issue. Have you tried looking for css based solutions? What browsers
are you using on each machine?

On 5 May 2011 18:41, John  wrote:
> Hi there, I am working on a project to track servers, filesystems, and
> space allocations using django. I have been testing the project using
> eclipse on windows and the command line on a linux server, where it
> will ultimately reside.
>
> I am having a problem with the select boxes and textareas on the admin
> page when it is run on the linux server. I looked for a solution to
> this for a few days, but haven't come across anything. Below are links
> to what I am seeing on windows and linux.
>
> What I see in windows - Good
> https://picasaweb.google.com/lh/photo/qbE0Ag3E_TgfIU899th9r21blcxgCSWfIy3S6CLrFgE?feat=directlink
>
> What I see on Linux - Bad
> https://picasaweb.google.com/lh/photo/cqe-pYEaRGbIGIUaLX-NsG1blcxgCSWfIy3S6CLrFgE?feat=directlink
>
> You can clearly see that the select box and textarea fields are screwy
> on the linux version. I tried doing a diff of all the css and
> javascript files from the admin page on both installs and they came
> out the same. So now I am stuck and looking for a solution. Any help
> is greatly appreciated.
>
> 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.
>
>



-- 
---
Dave Sayer | Bath Design
Web design & development with standards
---
mobile: +44 (0)7702787436
email: d...@bathdesign.co.uk
web: http://bathdesign.co.uk
photography: http://davesayer.com
twitter: http://twitter.com/sweet_grass
---

-- 
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: No module named messages.

2011-05-05 Thread David Markey
A quick google yields:


https://github.com/robhudson/django-debug-toolbar

On 5 May 2011 19:51, Jacob Scherffenberg  wrote:

> I found the problem, but stil doesn't really know what to do.
> But i was fairly sure that i used 1.3, which i did.
> But when i install the debug-toolbar with sudo apt-get install pyhton-
> djang-debug-toolbar.
> My django version changes to version 1.1.1
> Where can i get the toolbar otherwise, and without apparently reseting
> my django version?
>
> On 5 Maj, 14:12, Karen Tracey  wrote:
> > On Thu, May 5, 2011 at 7:43 AM, Jacob Scherffenberg <
> dikumol...@gmail.com>wrote:
> >
> > > Im using Django-1.3
> >
> > Are you absolutely sure about that? The message generally happens when
> you
> > have a settings file produced by 1.2+ or higher (thus including the
> > django.contrib.messages app in INSTALLED_APPS) but the running level of
> > Django is from before that module was added.
> >
> > 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.
>
>

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



Admin page select boxes smashed

2011-05-05 Thread John
Hi there, I am working on a project to track servers, filesystems, and
space allocations using django. I have been testing the project using
eclipse on windows and the command line on a linux server, where it
will ultimately reside.

I am having a problem with the select boxes and textareas on the admin
page when it is run on the linux server. I looked for a solution to
this for a few days, but haven't come across anything. Below are links
to what I am seeing on windows and linux.

What I see in windows - Good
https://picasaweb.google.com/lh/photo/qbE0Ag3E_TgfIU899th9r21blcxgCSWfIy3S6CLrFgE?feat=directlink

What I see on Linux - Bad
https://picasaweb.google.com/lh/photo/cqe-pYEaRGbIGIUaLX-NsG1blcxgCSWfIy3S6CLrFgE?feat=directlink

You can clearly see that the select box and textarea fields are screwy
on the linux version. I tried doing a diff of all the css and
javascript files from the admin page on both installs and they came
out the same. So now I am stuck and looking for a solution. Any help
is greatly appreciated.

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: Error: No module named messages.

2011-05-05 Thread Jacob Scherffenberg
I found the problem, but stil doesn't really know what to do.
But i was fairly sure that i used 1.3, which i did.
But when i install the debug-toolbar with sudo apt-get install pyhton-
djang-debug-toolbar.
My django version changes to version 1.1.1
Where can i get the toolbar otherwise, and without apparently reseting
my django version?

On 5 Maj, 14:12, Karen Tracey  wrote:
> On Thu, May 5, 2011 at 7:43 AM, Jacob Scherffenberg 
> wrote:
>
> > Im using Django-1.3
>
> Are you absolutely sure about that? The message generally happens when you
> have a settings file produced by 1.2+ or higher (thus including the
> django.contrib.messages app in INSTALLED_APPS) but the running level of
> Django is from before that module was added.
>
> 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: How to send notification when reply to a comment?

2011-05-05 Thread Shawn Milochik

http://docs.djangoproject.com/en/1.3/topics/email/

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



selecting all columns from a table (advanced query)

2011-05-05 Thread Mo Mughrabi
Hi,

I been trying to create a backward relation using queryset and the joining
is working fine, accept that its not including the other joined table in the
selected columns. Below is my models, queryset and query.__str__() print

class Main(models.Model):
slug   = models.SlugField()
is_active  = models.BooleanField(default=True)
site   = models.ForeignKey(Site)
parent = models.ForeignKey('self', blank=True, null=True,
limit_choices_to={'parent' : None})
class Meta:
unique_together = (("slug", "parent"))
def __unicode__(self):
return self.slug

class MainI18n(models.Model):
main= models.ForeignKey(Main)
language= models.CharField(max_length=2,
choices=settings.LANGUAGES)
title   = models.CharField(max_length=100)
label   = models.CharField(max_length=200, blank=True,
null=True)
description = models.TextField(blank=True, null=True)
disclaimer  = models.TextField(blank=True, null=True)
class Meta:
unique_together = (("language", "main"))
def __unicode__(self):
return self.title
class List(models.Model):
main= models.ForeignKey(Main)
slug= models.SlugField(unique=True)
is_active   = models.BooleanField(default=True)
parent  = models.ForeignKey('self', blank=True, null=True)

def __unicode__(self):
return self.slug
class ListI18n(models.Model):
list= models.ForeignKey(List)
language= models.CharField(max_length=2,
choices=settings.LANGUAGES)
title   = models.CharField(max_length=50)
description = models.TextField()
class Meta:
unique_together = (("language", "list"))
def __unicode__(self):
return self.title

and my queryset is

Main.objects.select_related('main',
'parent').filter(list__is_active=True, maini18n__language='en',
list__listi18n__language='en')

and this is what my query is printing

'SELECT `category_main`.`id`, `category_main`.`slug`,
`category_main`.`is_active`, `category_main`.`site_id`,
`category_main`.`parent_id`, T5.`id`, T5.`slug`, T5.`is_active`,
T5.`site_id`, T5.`parent_id` FROM `category_main` INNER JOIN
`category_maini18n` ON (`category_main`.`id` =
`category_maini18n`.`main_id`) INNER JOIN `category_list` ON
(`category_main`.`id` = `category_list`.`main_id`) INNER JOIN
`category_listi18n` ON (`category_list`.`id` =
`category_listi18n`.`list_id`) LEFT OUTER JOIN `category_main` T5 ON
(`category_main`.`parent_id` = T5.`id`) WHERE
(`category_maini18n`.`language` = en  AND `category_list`.`is_active` = True
 AND `category_listi18n`.`language` = en )'

anyone can help show columns from list and listi18n? I tried extra but It
doesn't allow me to pass things like category_list.*

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.



Unable to login to django admin with ie8 on multi-level subdomain

2011-05-05 Thread v1nce
Domain is foo.bar.example.com

I am able to successfully login the django admin site with ie7, FF,
Chrome and Safari. I have tested setting SESSION_COOKIE_DOMAIN to the
following: "foo.bar.example.com", ".bar.example.com", ".example.com",
"example.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: Aggregation annotate question.

2011-05-05 Thread Cal Leeming [Simplicity Media Ltd]
Hmm, +1 on this.

On Thu, May 5, 2011 at 6:26 PM, Satan Study Django <
satan.come.and.kill.your.family.an...@gmail.com> wrote:

> Hi. I've some question about aggregation annotate functions, like Max.
> I don't realy like the queries it makes. Let me explain.
>
> Models:
> class Person (models.Model):
>name = models.CharField (max_length = 100)
>login = models.CharField (max_length = 30)
> class Home (models.Model):
>person = models.ForeignKey (Person)
>state = models.ForeignKey (States)
>date = models.DateTimeField ()
>host = models.ForeignKey (Hosts)
>time_spent = models.PositiveIntegerField (null = True)
>
>
> Here is the expression with query made by it:
>
> >>> print
> Home.objects.values('person').annotate(Max('id')).order_by().query
> SELECT `main_home`.`person_id`, MAX(`main_home`.`id`) AS `id__max`
> FROM `main_home`
> GROUP BY `main_home`.`person_id`, `main_home`.`person_id`
> ORDER BY NULL
>
> Here i try to explain it:
>
> mysql> explain SELECT `main_home`.`person_id`, MAX(`main_home`.`id`)
> AS `id__max`
> FROM `main_home`
> GROUP BY `main_home`.`person_id`, `main_home`.`person_id`
> ORDER BY NULL;
> ++-+---+---+---
> ++-+--+--
> +--+
> | id | select_type | table | type | possible_keys | key | key_len |
> ref | rows | Extra |
> ++-+---+---+---
> ++-+--+--
> +--+
> | 1 | SIMPLE | main_home | index | NULL | main_home_21b911c5 | 4 |
> NULL | 2188 | Using index; Using temporary |
> ++-+---+---+---
> ++-+--+--
> +--+
>
> As you can see, Using temporary is added, it's bacause
> `main_home`.`person_id` used in GROUP BY 2 times:
> GROUP BY `main_home`.`person_id`, `main_home`.`person_id`
> and it makes query to run really long time.
>
> If i'll manually remove one of `main_home`.`person_id` from GROUP BY,
> query explain will contain no Using temporary, so execution takes
> short time.
>
> Could somebody explain to me - is it a feature? If it is, i really
> want to listen reason why. If not - then what? A bug?
>
> --
> 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.



Aggregation annotate question.

2011-05-05 Thread Satan Study Django
Hi. I've some question about aggregation annotate functions, like Max.
I don't realy like the queries it makes. Let me explain.

Models:
class Person (models.Model):
name = models.CharField (max_length = 100)
login = models.CharField (max_length = 30)
class Home (models.Model):
person = models.ForeignKey (Person)
state = models.ForeignKey (States)
date = models.DateTimeField ()
host = models.ForeignKey (Hosts)
time_spent = models.PositiveIntegerField (null = True)


Here is the expression with query made by it:

>>> print Home.objects.values('person').annotate(Max('id')).order_by().query
SELECT `main_home`.`person_id`, MAX(`main_home`.`id`) AS `id__max`
FROM `main_home`
GROUP BY `main_home`.`person_id`, `main_home`.`person_id`
ORDER BY NULL

Here i try to explain it:

mysql> explain SELECT `main_home`.`person_id`, MAX(`main_home`.`id`)
AS `id__max`
FROM `main_home`
GROUP BY `main_home`.`person_id`, `main_home`.`person_id`
ORDER BY NULL;
++-+---+---+---
++-+--+--
+--+
| id | select_type | table | type | possible_keys | key | key_len |
ref | rows | Extra |
++-+---+---+---
++-+--+--
+--+
| 1 | SIMPLE | main_home | index | NULL | main_home_21b911c5 | 4 |
NULL | 2188 | Using index; Using temporary |
++-+---+---+---
++-+--+--
+--+

As you can see, Using temporary is added, it's bacause
`main_home`.`person_id` used in GROUP BY 2 times:
GROUP BY `main_home`.`person_id`, `main_home`.`person_id`
and it makes query to run really long time.

If i'll manually remove one of `main_home`.`person_id` from GROUP BY,
query explain will contain no Using temporary, so execution takes
short time.

Could somebody explain to me - is it a feature? If it is, i really
want to listen reason why. If not - then what? A bug?

-- 
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 draw line charts in Django?

2011-05-05 Thread Frank Becker
On 5/5/11 9:28 AM, Nge wrote:

Hi,

> I want to know. How can I create line charts in Django?
> Then I have to take data from postgresql for x-axis and y-axis.

Have a look at codespeed [0]. That's behind http://speed.pypy.org/ and
http://speed.twistedmatrix.com/. It's using one of the Javascript graph
frameworks. jqplot [1] to be precise.

[0] https://github.com/tobami/codespeed
[1] http://www.jqplot.com/

Bye,

Frank

-- 
Frank Becker  (jabber|mail) | http://twitter.com/41i3n8
GnuPG: 0xADC29ECD | F01B 5E9C 1D09 981B 5B40 50D3 C80F 7459 ADC2 9ECD
SILC-Net: a8 | Home: http://www.alien8.de | <<> http://www.c3d2.de
"> Freedom is just chaos, with better lighting. <"  Alan Dean  Foster



signature.asc
Description: OpenPGP digital signature


Re: How to draw line charts in Django?

2011-05-05 Thread Frank Becker
On 5/5/11 6:22 PM, Xavier Ordoquy wrote:
> 
> Le 5 mai 2011 à 16:06, william ratcliff a écrit :


Hi,

>> One other approach is that you can send the data to matplotlib (which is 
>> python) and use that to create a .png which you then serve--it depends on 
>> what your needs are.
[...]

> matplotlib is incredibly hard to understand and doesn't follow the good 
> python package practices (not easy install compliant).
> Use it at your own risks :)
Well, there are folks having a lot of fun using matplotlib. It's not
just for x/y charts. All Linux distributions I know have it. Since it's
not written in only Python for performance reasons to install it by hand
may cause some dependency hunting.


Bye,

Frank

-- 
Frank Becker  (jabber|mail) | http://twitter.com/41i3n8
GnuPG: 0xADC29ECD | F01B 5E9C 1D09 981B 5B40 50D3 C80F 7459 ADC2 9ECD
SILC-Net: a8 | Home: http://www.alien8.de | <<> http://www.c3d2.de
"> Freedom is just chaos, with better lighting. <"  Alan Dean  Foster



signature.asc
Description: OpenPGP digital signature


How to send notification when reply to a comment?

2011-05-05 Thread LIU Liang
I want to send a notification and e-mail to the one who write the
comment in a topic.
But didn't know how to do.
Could someone give me a hand? thanks a lot

-- 
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: Testing if a receiver is connected to a signal

2011-05-05 Thread Bernardo Fontes
Hello everybody,

I resolved this problem by looking at Djangos Signal's code and
understanding its structure. The signal has an attribute called receivers
which has stored references to its receivers function that were connect to
it. When the send function is called, the signal just call this function
which are in this receivers list. So, I created a setUpClass and a
tearDownClass that does a monkey patch with my signal. It's like this:


class YourTestClass(TestCase):

@classmethod
def setUpClass(cls):
cls.signal_receivers = my_signal.receivers
my_signal.receivers = []


@classmethod
def tearDownClass(cls):
my_signal.receivers = cls.signal_receivers

Hope I could help!

-- 
Bernardo Fontes
http://www.bernardofontes.net
bernardo...@gmail.com 
Skype: bernardoxhc
(21) 9629 1621

-- 
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: Development server: cookies not working

2011-05-05 Thread Tom Evans
On Thu, May 5, 2011 at 2:02 PM, fsang  wrote:
> Hi,
>
> I am running my Django project on a remote host (with Apache) and on
> my current machine (localhost, using "runserver"). Cookies and
> sessions work fine when the project is served via Apache from the
> remote host. But for some reasons all of my browsers reject the
> cookies from the development server (127.0.0.1).
>
> I do not have any SESSION_COOKIE_* or other COOKIE*-settings in my
> settings.py. I am accessing my local project through 127.0.0.1:8000
> (although I've also tried localhost:8000 and localhost.localdomain:
> 8000). After using wireshark I was also able to see that the cookie is
> actually being sent, but for some reason neither Firefox nor Chromium
> seem to accept it.
>
> The csrftoken-cookie works as expected (locally and with the remote
> server).
>
> Can anyone suggest a workaround?
>
>
> Regards,
> Frederik
>

If you can see the Set-Cookie header in the responses, but your
browser is not accepting them, verify that the path and domain are
correct in that response. Browsers will ignore cookies for domains
other than the domain serving the page, and for paths other than the
current path and substrings of the current path (as the browser sees
it).

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: Runserver has connection limit?

2011-05-05 Thread Shawn Milochik
Try gunicorn. It's just as easy as runserver, and you just replace 
'runserver' with 'gunicorn' in your manage.py command line.


The only downside is that it doesn't auto-refresh by default when you 
change code. However, I'm pretty confident that the core developers have 
no time or interest in making the dev server more robust. Partially 
because there are more important things to do and partially because it's 
kind of supposed to be minimally functional.


On the other hand, if you are interested in "beefing up" the dev server, 
make your proposal on the django-developers list, get feedback, and if 
they accept the idea you can submit a patch.


Shawn


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



Runserver has connection limit?

2011-05-05 Thread Davepar
I keep running into problems with Google Chrome and runserver. It
seems Chrome tries to open too many connections for all the media on
the page and overwhelms runserver. Random images and CSS just don't
load. The page loads fine in Safari (haven't tried other browsers).

Any suggestions for limiting the Chrome connections or beefing up
runserver? I don't really want to run a real http server for
development. I like the auto-reload of runserver.

Thanks,
Dave

-- 
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 draw line charts in Django?

2011-05-05 Thread Xavier Ordoquy

Le 5 mai 2011 à 16:06, william ratcliff a écrit :

> One other approach is that you can send the data to matplotlib (which is 
> python) and use that to create a .png which you then serve--it depends on 
> what your needs are.
> 
> William


Hi,

matplotlib is incredibly hard to understand and doesn't follow the good python 
package practices (not easy install compliant).
Use it at your own risks :)

Regards,
Xavier.

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



Re: Unable to access Dictionary values in Template (object pk is the dict key)

2011-05-05 Thread Tom Evans
On Thu, May 5, 2011 at 12:11 PM, AJ  wrote:
> I see. Any clue where I can begin in my case (for filters etc.)? Thanks.
>

I disagree with the BDFLs on this, for me this pattern is very natural:

{% for key in list_of_keys %}
{{ some_dictionary[key] }}
{{ some_other_dict_with_same_keys[key] }}
{% endfor %}

Obviously this syntax is not allowed, and, as you've found out, key
lookup only works for numeric or string literals.

Therefore, I use a trivial filter tag:

{% load dict_tags %}
{% for key in list_of_keys %}
{{ some_dictionary|get:key }}
{{ some_other_dict_with_same_keys|get:key }}
{% endfor %}

some_app/templatetags/dict_tags.py:

from django import template
register = template.Library()
@register.filter
def get(the_dict, key):
  return the_dict[key]

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: Adding custom filter to stand-alone template

2011-05-05 Thread Up2L8


On May 4, 7:10 pm, Ethan Jucovy  wrote:
> On Wed, May 4, 2011 at 7:19 PM, Ethan Jucovy  wrote:
> > This also feels a little hacky, but IMHO cleaner than messing with
> >> builtins.
>
> Looking at django/template/__init__.py -- it does seem like INSTALLED_APPS
> and django.template.builtins are the only ways to do this.

Thanks for the validation Ethan.  I know this isn't the primary
development style as far as django goes, so I'm not too surprised this
use case is a bit rough around the edges.
Maybe I'll file an enhancement and work on a patch.

Eric

-- 
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 add datepicker (available in admin)

2011-05-05 Thread Tom Evans
On Wed, May 4, 2011 at 9:53 AM, GKR  wrote:
> thanks but its giving an error like
>
> name 'AdminDateWidget' is not defined
>
> please help it might be a configuration problem
>
> please help
>
> thanks
>

I wrote:
> Then modify your form to use the admin date picker widget:
>
> from django.contrib.admin.widgets import AdminDateWidget
> class MyForm(forms.Form):
>   some_date = forms.DateField(widget=AdminDateWidget())

I think you need to re-read that.

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 orm group_by difficulties

2011-05-05 Thread Satan Study Django
Question solved with such sql query:

select * from `main_home` t2, `main_states` t4, `main_person` t3
where t2.id in
  (select max(id)
  from `main_home`
  where `person_id`
  in (select `person_id` from `main_online`)
  group by `person_id`)
and t4.id=t2.`state_id`
and t3.id=t2.`person_id`

Or such expression:
ok = Home.objects.filter(id__in = [ item['id__max'] for item in
Home.objects.values('person_id').annotate(Max('id')).filter(person__in=Online.objects.all().values('person__pk'))])
ok = ok.select_related('person__name','state__state')

On 4 май, 23:46, Jacob Kaplan-Moss  wrote:
> On Wed, May 4, 2011 at 9:23 AM, Satan Study Django
>
>  wrote:
> > I can also use the direct sql query in the code. But on cellular it
> > level does not seem right -)
>
> Well, if it were me, I'd just use the raw SQL. I'd guess that about 5
> to 10% of the time I find that my queries are better expressed in SQL
> than in Python. I see nothing wrong with dropping down to raw SQL
> where it's easier and clearer. Why make extra work for youself?
>
> Jacob

-- 
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 draw line charts in Django?

2011-05-05 Thread william ratcliff
One other approach is that you can send the data to matplotlib (which is
python) and use that to create a .png which you then serve--it depends on
what your needs are.

William

On Thu, May 5, 2011 at 6:40 AM, Kenneth Gonsalves wrote:

> On Thu, 2011-05-05 at 03:05 -0700, Nge wrote:
> > I already created a view and can extract data from database.But I have
> > a problem. I don't know how to send to template and how to create js/
> > ajax. Can you share me sample?
>
> how to use js does not come in the purview of this list - you just need
> to do it the same way as you do in normal web pages. The last line of
> your view has a return statement that sends a dictionary to the
> template. Send your data that way and use js to create the chart.
> --
> 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.



Re: How to draw line charts in Django?

2011-05-05 Thread Jacob Kaplan-Moss
On Thu, May 5, 2011 at 5:05 AM, Nge  wrote:
> I already created a view and can extract data from database.But I have
> a problem. I don't know how to send to template and how to create js/
> ajax. Can you share me sample?

I've recently done a project that uses Ajax, jQuery, and Flot to do
some charting/graphing. It's not incredibly well-commented, but take a
look and see if it helps:
https://github.com/jacobian/django-dev-dashboard

Jacob

-- 
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: Site.object.get(pk=x).anyobject_set() is forcing the current site. Is this a bug ?

2011-05-05 Thread ksamuel
Thanks Karen.

On May 5, 2:08 pm, Karen Tracey  wrote:
> On Thu, May 5, 2011 at 6:43 AM, ksamuel  wrote:
> > I encountered a behavior I can't explain in the site framework and
> > wonder if I should report this as a bug.
>
> > class Video(models.Model):
>
> >    sites = models.ManyToManyField(Site)
> >    on_site = CurrentSiteManager()
> >    objects = models.Manager()
>
> Note you've got CurrentSiteManager as the 1st manager object. That makes it
> the default manager object for the model. It is getting used for reverse
> ForeignKey relationships; this is contrary to documentation 
> (http://docs.djangoproject.com/en/1.3/topics/db/managers/#manager-types), has
> a ticket (http://code.djangoproject.com/ticket/14891), and has recently been
> discussed on the dev list 
> (http://groups.google.com/group/django-developers/browse_thread/thread...
> ).
>
> 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.



Development server: cookies not working

2011-05-05 Thread fsang
Hi,

I am running my Django project on a remote host (with Apache) and on
my current machine (localhost, using "runserver"). Cookies and
sessions work fine when the project is served via Apache from the
remote host. But for some reasons all of my browsers reject the
cookies from the development server (127.0.0.1).

I do not have any SESSION_COOKIE_* or other COOKIE*-settings in my
settings.py. I am accessing my local project through 127.0.0.1:8000
(although I've also tried localhost:8000 and localhost.localdomain:
8000). After using wireshark I was also able to see that the cookie is
actually being sent, but for some reason neither Firefox nor Chromium
seem to accept it.

The csrftoken-cookie works as expected (locally and with the remote
server).

Can anyone suggest a workaround?


Regards,
Frederik

-- 
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: Question about GenericRelation

2011-05-05 Thread А . Р .
If you want an one-to-one relationship, here you go:
http://docs.djangoproject.com/en/1.3/ref/models/fields/#django.db.models.OneToOneField

-- 
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: No module named messages.

2011-05-05 Thread Karen Tracey
On Thu, May 5, 2011 at 7:43 AM, Jacob Scherffenberg wrote:

> Im using Django-1.3
>
>
Are you absolutely sure about that? The message generally happens when you
have a settings file produced by 1.2+ or higher (thus including the
django.contrib.messages app in INSTALLED_APPS) but the running level of
Django is from before that module was added.

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.



Question about GenericRelation

2011-05-05 Thread Stodge
I have a Page model, with a generic foreign key. I have a Story model,
which has a generic relation to Page. If I do:

sp=StaticPage.objects.get(id=1)

I have to do this to get the Page object:

sp.content.all()[0]

However, there will only ever be on Story linked to one Page model. Is
there anyway to do:

sp=StaticPage.objects.get(id=1) and then this to get the Page object:

sp.content

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: Site.object.get(pk=x).anyobject_set() is forcing the current site. Is this a bug ?

2011-05-05 Thread Karen Tracey
On Thu, May 5, 2011 at 6:43 AM, ksamuel  wrote:

> I encountered a behavior I can't explain in the site framework and
> wonder if I should report this as a bug.
>
> class Video(models.Model):
>
>sites = models.ManyToManyField(Site)
>on_site = CurrentSiteManager()
>objects = models.Manager()
>

Note you've got CurrentSiteManager as the 1st manager object. That makes it
the default manager object for the model. It is getting used for reverse
ForeignKey relationships; this is contrary to documentation (
http://docs.djangoproject.com/en/1.3/topics/db/managers/#manager-types), has
a ticket (http://code.djangoproject.com/ticket/14891), and has recently been
discussed on the dev list (
http://groups.google.com/group/django-developers/browse_thread/thread/be12b1f422db3634/d159ae5a2ab16f53
).

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: Error: No module named messages.

2011-05-05 Thread Jacob Scherffenberg
Im using Django-1.3

On May 4, 1:35 pm, Kenneth Gonsalves  wrote:
> On Wed, 2011-05-04 at 02:10 -0700, Jacob Scherffenberg wrote:
> > Have been working on anError:Nomodulenamed debug toolbar for a
> > couple hours, finally realized that i could just use the ubuntu
> > package system, to get it.
> > Thought that was all, but now i getError:Nomodulenamed messages.?
>
> what version of django?
> --
> regards
> KGhttp://lawgon.livejournal.com
> Coimbatore LUG roxhttp://ilugcbe.techstud.org/

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



Site.object.get(pk=x).anyobject_set() is forcing the current site. Is this a bug ?

2011-05-05 Thread ksamuel
I encountered a behavior I can't explain in the site framework and
wonder if I should report this as a bug.

class Video(models.Model):

sites = models.ManyToManyField(Site)
on_site = CurrentSiteManager()
objects = models.Manager()

In manage.py shell, USING A SETTINGS FILE WITH SITE_ID = 1:

In [9]: Site.objects.get(pk=3).video_set.all()
Out[9]: []

But I __do__ have videos on the site with SITE_ID = 3. If I dump the
SQL:

SELECT *
FROM `videos_manager_video`
INNER JOIN `videos_manager_video_sites` ON
(`videos_manager_video`.`id` =
`videos_manager_video_sites`.`video_id`)
INNER JOIN `videos_manager_video_sites` T4 ON
(`videos_manager_video`.`id` = T4.`video_id`) WHERE
(`videos_manager_video_sites`.`site_id` = 1  AND T4.`site_id` = 3 )
LIMIT 21'

The part that bothers me is:

`videos_manager_video_sites`.`site_id` = 1

I don't think this manager should filter videos based on the current
site. I can have very good reasons to manipulate videos from another
site. For example to get all videos from another site, and add them to
this site.

Of course, if I use the settings file with SITE_ID = 3,
site.objects.get(pk=3).video_set.all() returns the expected result.

For now I'll be using Video.objects.filter(sites__in=(3,)) to emulate
Site.objects.get(pk=3).video_set.all() on other sites so it's not
blocking. But it may be hiding some other problems.

-- 
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: removing the source of a OneToOneField relationship

2011-05-05 Thread PFL
Seth,

see:  
http://docs.djangoproject.com/en/1.3/ref/models/instances/#deleting-objects

"Issues a SQL DELETE for the object. This only deletes the object in
the database; the Python instance will still be around, and will still
have data in its fields."

I think you will have to re-query your target object after you delete
a source object.


The delete()
On May 3, 2:05 pm, Seth Gordon  wrote:
> I have one Django model that points to another one with a OneToOneField,
> sort of like this:
>
> class Target(models.model):
>     # stuff
>
> class Source(models.Model):
>     target = models.OneToOneField(Target)
>
> Sometimes, given an object that is an instance of Target, I want to
> navigate to its Source and delete that:
>
> try:
>     some_target.source.delete()
> except ObjectDoesNotExist:
>     ## nothing to delete!
>     pass
>
> But this doesn't work: some_target.source will still exist after the
> delete() operation has been performed.  If I try "some_target.source =
> None", I get an exception, complaining that Target.source does not allow
> null values.  Calling save() and clean_fields() at strategic moments
> doesn't seem to work, either.
>
> What does seem to work is reloading the Target object:
>
> try:
>     some_target.source.delete()
>     some_target = Target.objects.get(pk=some_target.id)
> except Source.DoesNotExist:
>     ## nothing to delete!
>     pass
>
> Is this a bug in Django, or am I misunderstanding how related or cached
> objects are supposed to work?
>
> This is Django 1.2.3, Python 2.6.5, PostgreSQL 8.4.7, all running on
> Ubuntu Linux 10.04.

-- 
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: Unable to access Dictionary values in Template (object pk is the dict key)

2011-05-05 Thread AJ
I see. Any clue where I can begin in my case (for filters etc.)? 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: How to draw line charts in Django?

2011-05-05 Thread Kenneth Gonsalves
On Thu, 2011-05-05 at 03:05 -0700, Nge wrote:
> I already created a view and can extract data from database.But I have
> a problem. I don't know how to send to template and how to create js/
> ajax. Can you share me sample? 

how to use js does not come in the purview of this list - you just need
to do it the same way as you do in normal web pages. The last line of
your view has a return statement that sends a dictionary to the
template. Send your data that way and use js to create the chart. 
-- 
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.



Anyone got experience of using django-fiber cms?

2011-05-05 Thread Dave Sayer
Hi,

I am currently deliberating over writing a bespoke CMS or using a
ready rolled one for a client. I have limited experience with
Python/Django beyond the standard admin interface and building a
pretty simple photo portfolio site.

I have tried django-cms and didn't like the functionality - didn't
seem very intuitive for a user with limited tech knowledge. So now, I
am looking at django-fiber but again, the backend admin seems a little
lacking in intuitiveness for the average joe user. I do, however, like
the fronend editing functionality. It just seems a little basic for my
needs and the documentation is pretty scant.

Does anyone have any experience of using fiber and have any example
sites running on this?

Cheers,

Dave
-- 
---
Dave Sayer | Bath Design
Web design & development with standards
---
mobile: +44 (0)7702787436
email: d...@bathdesign.co.uk
web: http://bathdesign.co.uk
photography: http://davesayer.com
twitter: http://twitter.com/sweet_grass
---

-- 
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 draw line charts in Django?

2011-05-05 Thread Xavier Ordoquy

Le 5 mai 2011 à 12:05, Nge a écrit :

> Hi KG!
> 
> I already created a view and can extract data from database.But I have
> a problem. I don't know how to send to template and how to create js/
> ajax. Can you share me sample?
> 
> Thanks
> Nge

There are tons of javascript application that can draw a plot with almost just 
an array of data:
http://code.google.com/p/flot/
http://raphaeljs.com/
http://www.highcharts.com/
and so many others.

Regards,
Xavier.

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



Re: How to draw line charts in Django?

2011-05-05 Thread Nge
Hi KG!

I already created a view and can extract data from database.But I have
a problem. I don't know how to send to template and how to create js/
ajax. Can you share me sample?

Thanks
Nge

On May 5, 3:44 am, Kenneth Gonsalves  wrote:
> On Thu, 2011-05-05 at 00:28 -0700, Nge wrote:
> > I want to know. How can I create line charts in Django?
> > Then I have to take data from postgresql for x-axis and y-axis.
> > So how should I do? How can apply django, postgres, graph and ajax?
>
> create a view - extract the data you want and send it to the template
> where you use js/ajax to display the graph
> --
> regards
> KGhttp://lawgon.livejournal.com
> Coimbatore LUG roxhttp://ilugcbe.techstud.org/

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



how to combine django and wordpress

2011-05-05 Thread CCC
now I have a site which based on django which can run stable.
in this site we need to use wordpress as a cms.
the server config on ubuntu and nginx,
but i don't know how to combine the django and wordpress
together.any tips can share is great.
thanks in advance!

-- 
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 draw line charts in Django?

2011-05-05 Thread stava

On Thu, 05 May 2011 13:14:57 +0530, Kenneth Gonsalves wrote:

On Thu, 2011-05-05 at 00:28 -0700, Nge wrote:

I want to know. How can I create line charts in Django?
Then I have to take data from postgresql for x-axis and y-axis.
So how should I do? How can apply django, postgres, graph and ajax?


create a view - extract the data you want and send it to the template
where you use js/ajax to display the graph


http://code.google.com/p/flot works nicely for the js/ajax part.

/Lars


--
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 draw line charts in Django?

2011-05-05 Thread Kenneth Gonsalves
On Thu, 2011-05-05 at 00:28 -0700, Nge wrote:
> I want to know. How can I create line charts in Django?
> Then I have to take data from postgresql for x-axis and y-axis.
> So how should I do? How can apply django, postgres, graph and ajax? 

create a view - extract the data you want and send it to the template
where you use js/ajax to display the graph
-- 
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.



How to draw line charts in Django?

2011-05-05 Thread Nge
Hi everyone !

I want to know. How can I create line charts in Django?
Then I have to take data from postgresql for x-axis and y-axis.
So how should I do? How can apply django, postgres, graph and ajax?
Pls share your knowledge.

Thanks
Nge

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



login using TestCase hangs

2011-05-05 Thread LurkingFrog
I've been attempting to write some end to end integration tests using
selenium for my current django app (ver 1.3), and have been having a
problem with the login function hanging.  After much tracing, I have
discovered it hangs when psycopg2 (ver 2.4) tries to execute the
update query for the last login.  I have tested this, and it appears
to be running into a database lock on this record, but only when it is
run from an instance of django.test.TestCase.  I cannot repeat this
when using a stand alone script.

I have tried with both runserver and gunicorn, and both have shown the
same issue.  Using gunicorn with multiple workers to make sure both
should operate simultaneously, I started a stand alone copy of the
selenium calls to the test server while the TestCase was running.  It
got to the point of the update, hung until the test timed out, and
then completed successfully.

I am completely at a loss on how to work around this and was wondering
if anyone has seen this problem before or has any ideas on how to
attack it?

Thanks,
Dave

-- 
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 queryset include more columns in select statement

2011-05-05 Thread Mo Mughrabi
Hi,

I been trying to create a backward relation using queryset and the joining
is working fine, accept that its not including the other joined table in the
selected columns. Below is my models, queryset and query.__str__() print

class Main(models.Model):
slug   = models.SlugField()
is_active  = models.BooleanField(default=True)
site   = models.ForeignKey(Site)
parent = models.ForeignKey('self', blank=True, null=True,
limit_choices_to={'parent' : None})
class Meta:
unique_together = (("slug", "parent"))
def __unicode__(self):
return self.slug

class MainI18n(models.Model):
main= models.ForeignKey(Main)
language= models.CharField(max_length=2,
choices=settings.LANGUAGES)
title   = models.CharField(max_length=100)
label   = models.CharField(max_length=200, blank=True,
null=True)
description = models.TextField(blank=True, null=True)
disclaimer  = models.TextField(blank=True, null=True)
class Meta:
unique_together = (("language", "main"))
def __unicode__(self):
return self.title
class List(models.Model):
main= models.ForeignKey(Main)
slug= models.SlugField(unique=True)
is_active   = models.BooleanField(default=True)
parent  = models.ForeignKey('self', blank=True, null=True)

def __unicode__(self):
return self.slug
class ListI18n(models.Model):
list= models.ForeignKey(List)
language= models.CharField(max_length=2,
choices=settings.LANGUAGES)
title   = models.CharField(max_length=50)
description = models.TextField()
class Meta:
unique_together = (("language", "list"))
def __unicode__(self):
return self.title

and my queryset is

Main.objects.select_related('main',
'parent').filter(list__is_active=True, maini18n__language='en',
list__listi18n__language='en')

and this is what my query is printing

'SELECT `category_main`.`id`, `category_main`.`slug`,
`category_main`.`is_active`, `category_main`.`site_id`,
`category_main`.`parent_id`, T5.`id`, T5.`slug`, T5.`is_active`,
T5.`site_id`, T5.`parent_id` FROM `category_main` INNER JOIN
`category_maini18n` ON (`category_main`.`id` =
`category_maini18n`.`main_id`) INNER JOIN `category_list` ON
(`category_main`.`id` = `category_list`.`main_id`) INNER JOIN
`category_listi18n` ON (`category_list`.`id` =
`category_listi18n`.`list_id`) LEFT OUTER JOIN `category_main` T5 ON
(`category_main`.`parent_id` = T5.`id`) WHERE
(`category_maini18n`.`language` = en  AND `category_list`.`is_active` = True
 AND `category_listi18n`.`language` = en )'

anyone can help show columns from list and listi18n? I tried extra but It
doesn't allow me to pass things like category_list.*

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: hidden rows common elements also visible on list filters

2011-05-05 Thread vikalp sahni
How have you made rows hidden??

if you talking about admin, You can control by overriding querset method for
that particular table admin.

Example:

class sometableAdmin:
 def queryset(self, request):
  if(whatevercond):
return super(, self).queryset(request)
  else:
return  self.model._default_manager.filter(id=1)



Regards,
//Vikalp

On Thu, May 5, 2011 at 5:45 AM, rahul jain  wrote:

> All,
>
> Hidden rows elements also visible on list filters ?
>
> ex:
>
> I have a list filter on one of the columns ,
>
> list filter for that column displays all the distinct values, but the
> problem is that few rows i have disabled.
> But list filter still displays those rows as well.
>
> How to fix this ?
>
> Thanks.
>
> RJ
>
> --
> 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.