Re: Javascript with built-in templates tags

2009-08-08 Thread Sam Lai
Can you show us the generated template HTML, and if possible, the expected result? That way we can work out the issue with your django templates, rather than trying to guess your code. 2009/8/9 WilsonOfCanada : > > I tried that before, but it only seems to work when it is used on >

Re: Mod_wsgi and Apache Problems - Unhandled request return Internal Server Error / Premature end of script headers

2009-08-08 Thread Graham Dumpleton
On Aug 9, 3:12 pm, Lee wrote: > On Aug 8, 5:55 pm, Lee wrote: > > > > > > > Interesting timing-- I have the same problem.  My basic testing django > > app loads and works fine, but trying to access the admin causes the > > seg fault.  Unfortunately I'll

Re: Javascript with built-in templates tags

2009-08-08 Thread WilsonOfCanada
I tried that before, but it only seems to work when it is used on the .html file. onchange="changeArea('{{ list_areas.BC|safe|escapejs}}') I need it to be onchange="changeArea('{{ list_areas|safe|escapejs}}') so the function can use list_areas (My javascript and html are on separate files). On

Re: Mod_wsgi and Apache Problems - Unhandled request return Internal Server Error / Premature end of script headers

2009-08-08 Thread Lee
On Aug 8, 5:55 pm, Lee wrote: > Interesting timing-- I have the same problem.  My basic testing django > app loads and works fine, but trying to access the admin causes the > seg fault.  Unfortunately I'll have to wait until my sys admin is > available on Monday to try

select_related(field) doesn't use the default manager of the field

2009-08-08 Thread Gleber
I have something like this: class MyManager(models.Manager): use_for_related_fields = True def get_query_set(self): return super(MyManager, self).get_query_set().extra(select = {'_extra_field':"xxx"}) class ModelA(models.Model): ... objects = MyManager() class

Re: How to get rid of the 'u'? Seems to be everyhere :)

2009-08-08 Thread David Zhou
See: http://diveintopython.org/xml_processing/unicode.html -- dz On Sat, Aug 8, 2009 at 11:27 PM, Joshua Partogi wrote: > u' stands for Python unicode. > > On Sun, Aug 9, 2009 at 12:03 PM, strotos wrote: >> >> Hey all, >> >> I am very new to

Re: How to get rid of the 'u'? Seems to be everyhere :)

2009-08-08 Thread Joshua Partogi
u' stands for Python unicode. On Sun, Aug 9, 2009 at 12:03 PM, strotos wrote: > > Hey all, > > I am very new to Django and am having a bit of trouble with something > and I'm hoping I can get some help from you all. > > I was just wondering how do I share say a list or

Re: Javascript with built-in templates tags

2009-08-08 Thread Luke Seelenbinder
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 That needs to be : alert({{ selectedAreas.BC }}); Look at the documentation. This problem is fairly obvious if you do: http://docs.djangoproject.com/en/dev/topics/templates/#variables I'm not trying to be mean, but please look at the docs before

Re: using python libraries in django?

2009-08-08 Thread Luke Seelenbinder
Django follows normal python import rules. So just lookup those to know what Django can use and how it needs to be setup. -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Luke Seelenbinder luke.seelenbin...@gmail.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux)

Re: How to get rid of the 'u'? Seems to be everyhere :)

2009-08-08 Thread Luke Seelenbinder
As James said, spend some time with the Python basics. Here is a good online book to checkout (free) http://www.diveintopython.org/toc/index.html Get a firm foundation in Python before attempting anything with Django. That will help immensely. I took a college-level python class before I started

Re: How to get rid of the 'u'? Seems to be everyhere :)

2009-08-08 Thread James Bennett
On Sat, Aug 8, 2009 at 9:03 PM, strotos wrote: > In my update the "query" variable is added to the list myList, but a u > is appended which seams to be the url of the app, is there a way to > remove this u, or is there a better way to share data like a dict or > list between

How to get rid of the 'u'? Seems to be everyhere :)

2009-08-08 Thread strotos
Hey all, I am very new to Django and am having a bit of trouble with something and I'm hoping I can get some help from you all. I was just wondering how do I share say a list or dictionary between views? What I have at the moment is. from django.shortcuts import render_to_response

Re: Continuing problems running Django when not site Root.

2009-08-08 Thread Malcolm Tredinnick
On Sat, 2009-08-08 at 13:41 -0700, Streamweaver wrote: > Let me clarify. This method handles the RequestContext obviously since > it's a login but what I mean is the SCRIPT_NAME variable isn't set for > the template and can't be read as far as I can tell. Nothing is automatically set for a

Re: Bug with model get_*_display() methods?

2009-08-08 Thread Malcolm Tredinnick
On Sat, 2009-08-08 at 12:09 -0700, Margie wrote: [...] > Question: If want to use a special widget for a ChoiceField, is it > true that I need to instantiate the ChoiceField (or TypedChoiceField), > rather than just setting the .widget attribute on the one that is by > default created for me (due

Re: My ModelAdmin customizations don't work

2009-08-08 Thread Alex Gaynor
On Sat, Aug 8, 2009 at 8:37 PM, Chao Xu wrote: > > I want't to add search in admin site and followed the instructions of > official guide of The Django admin site. But nothing on admin site > changed, nor errors appeared after I changed my code. > > following is my code,

My ModelAdmin customizations don't work

2009-08-08 Thread Chao Xu
I want't to add search in admin site and followed the instructions of official guide of The Django admin site. But nothing on admin site changed, nor errors appeared after I changed my code. following is my code, please help me. Thank you in advance! entity.models.py code ===

Re: generate sql query from ORM

2009-08-08 Thread Malcolm Tredinnick
On Sat, 2009-08-08 at 07:26 -0700, Lokesh wrote: > Hi, > > Need help in generating the sql query i.e generated by django at > runtime from ORM > > from django.contrib.auth.models import User > class UserBasicDetails(models.Model): > user_id = models.OneToOneField(User, primary_key=True, >

Re: DeprecationWarning - How can I fix this?

2009-08-08 Thread Karen Tracey
On Sat, Aug 8, 2009 at 7:41 PM, dmpeters63 wrote: > > I get the following error when accessing my MySQL database with Django > on my localhost: > >/var/lib/python-support/python2.6/MySQLdb/__init__.py:34: > DeprecationWarning: the sets module is deprecated from sets

Re: DeprecationWarning - How can I fix this?

2009-08-08 Thread Alex Gaynor
On Sat, Aug 8, 2009 at 6:41 PM, dmpeters63 wrote: > > I get the following error when accessing my MySQL database with Django > on my localhost: > >    /var/lib/python-support/python2.6/MySQLdb/__init__.py:34: > DeprecationWarning: the sets module is deprecated from sets

DeprecationWarning - How can I fix this?

2009-08-08 Thread dmpeters63
I get the following error when accessing my MySQL database with Django on my localhost: /var/lib/python-support/python2.6/MySQLdb/__init__.py:34: DeprecationWarning: the sets module is deprecated from sets imports ImmutableSet How can I fix this? Anyone please help. I'm running the

Dynamic Auth Backend and subdomains

2009-08-08 Thread coulix
Hello Pony Wizards, I am facing a use case where my authentication process is variable depending on the request.subdomain catched by a custom GetSubdomainMiddleware. AAA.example.com/login BBB.example.com/login In this case my subdomain is "AAA", I have the domain name in a model which also

django-profiles: exclude field from edit form

2009-08-08 Thread Léon Dignòn
I wonder why the avatar field is still display in the form after passing another form class. Still the built-in form is used. What's wrong? -- forms.py from django.forms import ModelForm from profiles import utils class _ProfileForm(ModelForm): class Meta: model =

Re: Sum for each day? aggregate / annotate

2009-08-08 Thread Alex Gaynor
On Sat, Aug 8, 2009 at 6:12 PM, tm wrote: > > Hello, > > I have been trying all sorts of things with aggregate and annotate and > can't seem to get the right combination.  Is there a way to get the > sum of one or multiple columns for each day?  Similar to: > > SELECT

Sum for each day? aggregate / annotate

2009-08-08 Thread tm
Hello, I have been trying all sorts of things with aggregate and annotate and can't seem to get the right combination. Is there a way to get the sum of one or multiple columns for each day? Similar to: SELECT view_date, SUM(my_column) FROM my_table GROUP BY DAY (view_date); This works in raw

Re: Mod_wsgi and Apache Problems - Unhandled request return Internal Server Error / Premature end of script headers

2009-08-08 Thread Lee
Interesting timing-- I have the same problem. My basic testing django app loads and works fine, but trying to access the admin causes the seg fault. Unfortunately I'll have to wait until my sys admin is available on Monday to try Graham's vhost config suggestions... I'm hoping that fixes it.

Re: Proxy model only shows for superuser

2009-08-08 Thread lzantal
On Aug 7, 12:31 pm, lzantal wrote: > Hi, > > I have a Client model and I created a BrokerClient model as a proxy of > client > class Client(models.Model): >     ... > > class BrokerClient(Client): >     class Meta: >         proxy = True > > Now in admin the BrokerClient

Re: Javascript with built-in templates tags

2009-08-08 Thread WilsonOfCanada
I sent the variable as dictionary with lists {'BC:['Vancouver', 'Kamloops'], AB:['Calgary']} However, when I use the variable in the function, it is treated as a string. function changeArea(mooman) { alert(selectedAreas["BC"]); } This was not defined. Is there something more I need to

Re: Managed attributes with 'filter()' and 'exclude()'

2009-08-08 Thread Daniel Roseman
On Aug 8, 8:25 pm, BenW wrote: > Hello, > > I am working with a legacy database that stores IP addresses as 32bit > packed integers.  Is there a way I can use 'managed' attributes with > filter() and exclude() etc?  Please see example below: > > Thanks! > > class

Re: Continuing problems running Django when not site Root.

2009-08-08 Thread Streamweaver
Let me clarify. This method handles the RequestContext obviously since it's a login but what I mean is the SCRIPT_NAME variable isn't set for the template and can't be read as far as I can tell. On Aug 8, 4:15 pm, Streamweaver wrote: > I appreciate all the comment here

Re: Continuing problems running Django when not site Root.

2009-08-08 Thread Streamweaver
I appreciate all the comment here and I definitly could be missing something. I tried backing out to a fresh install as requested above. The issue as best I can understand it lies in the default login scripts provided which are called as follows in my urls.py file (r'^accounts/login/$',

Re: Bug with model get_*_display() methods?

2009-08-08 Thread Alex Gaynor
On Sat, Aug 8, 2009 at 2:09 PM, Margie wrote: > > Ok, still slightly confused.  First - a high level description.  I > have a field that contains choices, but when I display the select, I > want to display some extra html below the select box, so I am creating > a custom

Managed attributes with 'filter()' and 'exclude()'

2009-08-08 Thread BenW
Hello, I am working with a legacy database that stores IP addresses as 32bit packed integers. Is there a way I can use 'managed' attributes with filter() and exclude() etc? Please see example below: Thanks! class Host(models.Model): id = models.AutoField(primary_key=True,

Re: Javascript with built-in templates tags

2009-08-08 Thread Daniel Roseman
On Aug 8, 7:49 pm, WilsonOfCanada wrote: > Thanks, > It worked, but out of curiosity, what do the additional quotes change > (why are they needed)? They're needed in Javascript, not in Django. If you looked at the generated source (via View Source in your browser) you could have

Re: using python libraries in django?

2009-08-08 Thread Daniel Roseman
On Aug 8, 7:42 pm, djangonoob wrote: > Hi Alex, > in that case, do we need to know where is the python modules being > installed > before importing it? No. > Or do we install another python library to a directory where our > django project lives before importing the >

Re: Bug with model get_*_display() methods?

2009-08-08 Thread Margie
Ok, still slightly confused. First - a high level description. I have a field that contains choices, but when I display the select, I want to display some extra html below the select box, so I am creating a custom widget that displays the standard select followed by my html. Question: If want

Re: Javascript with built-in templates tags

2009-08-08 Thread WilsonOfCanada
Thanks, It worked, but out of curiosity, what do the additional quotes change (why are they needed)? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

2 Questions about feeds

2009-08-08 Thread When ideas fail
Hi, i'm developing a feed but i still have a couple of questionss. 1. I have this in my models: def get_absolute_url(self): return "/blog/%s/" % self.post_slug but the rss has the links down as: http://example.com/blog/post_3/, the blog/post_3/ is correct, how can i make sure its

Re: using python libraries in django?

2009-08-08 Thread djangonoob
Hi Alex, in that case, do we need to know where is the python modules being installed before importing it? Or do we install another python library to a directory where our django project lives before importing the python modules? Best Rgds. On Jul 6, 9:31 pm, Alex Gaynor

Re: Django/ Python 3 - nervous about starting large project

2009-08-08 Thread Vasil Vangelovski
If you are writing your code in python 2.6 it will be easy to port it to python 3 later. The backwards incompatible changes introduced in python 3 are not a good reason not to write you web application with django. snfctech wrote: > Hello. > > We are researching technologies to begin what may

Re: how to deploy Django on the web server?

2009-08-08 Thread Eric Abrahamsen
On Aug 8, 2009, at 8:24 PM, justin jools wrote: > ok well thanks for your reply: > > first I have free access and they have told me python is installed > but it's not working as I ran a hello world test script which doesbt > execute. That is the first of my problems. > > My second problem is

Re: how to deploy Django on the web server?

2009-08-08 Thread Larrik Jaerico
I'll bet a lot of the mailing list will faint when they see this, but I've gotten it to work pretty easily by just dropping the django directory directly into my project directory. On Aug 8, 8:24 am, justin jools wrote: > ok well thanks for your reply: > > first I

Re: Javascript with built-in templates tags

2009-08-08 Thread Matthias Kestenholz
On Sat, Aug 8, 2009 at 6:34 PM, WilsonOfCanada wrote: > > I am not sure; I am just trying to pass the variable from the > dictionary using render_to_response to a javascript function.  The > function is stored as a .js file.  This is a part of the code I am > using it for: > > {{

Re: Javascript with built-in templates tags

2009-08-08 Thread WilsonOfCanada
No, I placed the spaces in so it is more readable (I tested with spaces afterwards and they still do not work). The function is passed in by:

Re: Javascript with built-in templates tags

2009-08-08 Thread Luke Seelenbinder
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I think your problem is just the spaces between the filters, try {{ mooman|safe|escapejs }}. Other then that, as long as the mooman is set in the context... that should work. Luke On Sat, Aug 8, 2009 at 12:34 PM, WilsonOfCanada wrote: -BEGIN

Re: Javascript with built-in templates tags

2009-08-08 Thread WilsonOfCanada
I am not sure; I am just trying to pass the variable from the dictionary using render_to_response to a javascript function. The function is stored as a .js file. This is a part of the code I am using it for: {{ selectCity|safe }} The {{ selectCity|safe }} works but the {{ mooman | safe |

Re: Duplicate results using ORd Q queries

2009-08-08 Thread Luke Seelenbinder
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Tom, The reason it was returning dupes is simply you had multiple querysets that matched some of the same items. As for the while loop, it was malformed. It looks like an infinite loop to me... I might be wrong; however, a for loop would have better

Re: Application decoupling - project architecture question

2009-08-08 Thread kmike
I wrote a simple app that may be useful for avatar management: http://bitbucket.org/kmike/django-generic-images/wiki/Home It's similar to django-tagging in aspect that images can be attached to any model using generic relations and then fetched in a few sql queries. Avatar-uploading view example

Re: Application decoupling - project architecture question

2009-08-08 Thread kmike
I wrote a simple app that may be useful for avatar management: http://bitbucket.org/kmike/django-generic-images/wiki/Home It's similar to django-tagging in aspect that images can be attached to any model using generic relations and then fetched in a few sql queries. Avatar-uploading view

generate sql query from ORM

2009-08-08 Thread Lokesh
Hi, Need help in generating the sql query i.e generated by django at runtime from ORM from django.contrib.auth.models import User class UserBasicDetails(models.Model): user_id = models.OneToOneField(User, primary_key=True, to_field='username') name = models.CharField(null=False,

Re: Duplicate results using ORd Q queries

2009-08-08 Thread Tom
Luke, That's brilliant, thank you so much! Just out of interest, do you know why the query was returning dupes in the first place, and why my while loop was not removing them? Thanks again, Tom On Aug 8, 2:51 pm, Luke Seelenbinder wrote: > Tom, > > make your

Re: Duplicate results using ORd Q queries

2009-08-08 Thread Luke Seelenbinder
Tom, make your line read: results = Film.objects.filter( Q(title__icontains=q) | Q(director__name__icontains=q) | Q(actors__name__icontains=q) |

Re: Django documentation site is SLOW

2009-08-08 Thread Torsten Bronger
Hallöchen! Torsten Bronger writes: > [...] > > While loading the pages is sufficiently fast for me, scrolling has > always been slightly annoying for me, with various FFs on various > computers. [...] > > Funny enough, scrolling with the scroll bar is rather smooth, > while scrolling with the

Duplicate results using ORd Q queries

2009-08-08 Thread Thomas Scrace
Hi all, In order to teach myself Django I am creating a simple film database project. My search code looks like this: results = Film.objects.filter( Q(title__icontains=q) | Q(director__name__icontains=q) |

Re: how to deploy Django on the web server?

2009-08-08 Thread justin jools
ok well thanks for your reply: first I have free access and they have told me python is installed but it's not working as I ran a hello world test script which doesbt execute. That is the first of my problems. My second problem is installing Django... and third configuring the django scripts to

Re: checking/using model data in form save

2009-08-08 Thread zayatzz
Thank you tomZ! My problems were pretty much fixed by this snippet: http://www.djangosnippets.org/snippets/636/ It does exactly what i wanted with only a few glitches - does not add that checbox after saving the form when i have uploaded the picture and does not remove the delete checkbox when

Re: Django documentation site is SLOW

2009-08-08 Thread Lakshman Prasad
Indeed for most of the people in this group Django documentation is very often consulted resource. It makes a lot of sense to have those locally. If you have a svn co, documentation is within the checkout, so you need to browse to file:///home/name/django-trunk/docs/_build/html/index.html and you

Re: Recursive request and page layout

2009-08-08 Thread SardarNL
I've checked the custom tags and the middleware that automatically registers request object inside the template context, this is all I need to get the recursive call working. However I wonder why such functionality isn't there. Probably there is another way to put content from totally independent

Re: Mod_wsgi and Apache Problems - Unhandled request return Internal Server Error / Premature end of script headers

2009-08-08 Thread Graham Dumpleton
On Aug 8, 5:22 pm, pcrutch wrote: > The problem still exists. I added the changes you suggested. > > here is my sites-available file > > >     >         ServerName dragonfly.cens.ucla.edu > >   WSGIDaemonProcess dragonfly.cens.ucla.edu processes=4 threads=1 >    

Re: how to deploy Django on the web server?

2009-08-08 Thread Eric Abrahamsen
On Aug 8, 2009, at 5:14 PM, justin jools wrote: > Yes Ive read these docs and I understand certain script changes are > needed before running on the server but I want to know about: > > installing Django on the server, do i need to use telnet to do > this? or can i upload already executed

Re: how to deploy Django on the web server?

2009-08-08 Thread justin jools
Yes Ive read these docs and I understand certain script changes are needed before running on the server but I want to know about: installing Django on the server, do i need to use telnet to do this? or can i upload already executed django directory from local server? On Fri, Aug 7, 2009 at

Re: Django documentation site is SLOW

2009-08-08 Thread Torsten Bronger
Hallöchen! Malcolm Tredinnick writes: > On Sat, 2009-08-08 at 00:14 -0700, Thierry wrote: > >> Just wanted to add my own testimony: I too, noticed serious >> performance issues with Firefox when consulting Django >> documentation. > > "Performance issues" could many a myriad of things. Is it

Re: Django documentation site is SLOW

2009-08-08 Thread Malcolm Tredinnick
On Sat, 2009-08-08 at 00:14 -0700, Thierry wrote: > Hi, > > Just wanted to add my own testimony: I too, noticed serious > performance issues with Firefox when consulting Django documentation. "Performance issues" could many a myriad of things. Is it slow to render, or slow to load the data? Or

Re: Mod_wsgi and Apache Problems - Unhandled request return Internal Server Error / Premature end of script headers

2009-08-08 Thread pcrutch
The problem still exists. I added the changes you suggested. here is my sites-available file ServerName dragonfly.cens.ucla.edu WSGIDaemonProcess dragonfly.cens.ucla.edu processes=4 threads=1 WSGIApplicationGroup %{GLOBAL} WSGIProcessGroup dragonfly.cens.ucla.edu

Re: Django documentation site is SLOW

2009-08-08 Thread Thierry
Hi, Just wanted to add my own testimony: I too, noticed serious performance issues with Firefox when consulting Django documentation. So far it is the only website where I experience this. I am home, using Firefox 3.5.2 on Ubuntu 9.04 (officially installed package 'firefox-3.5'), and have

Re: Bug with model get_*_display() methods?

2009-08-08 Thread Malcolm Tredinnick
Hi Margie, On Fri, 2009-08-07 at 23:17 -0700, Margie wrote: > > Hmmm, ok, after digging around I realize that full_clean was not > setting cleaned_data for the status field to an integer value; > cleaned_data['status'] was just getting set to something like u'1'. > > I am in fact using

Re: Bug with model get_*_display() methods?

2009-08-08 Thread Margie
Hmmm, ok, after digging around I realize that full_clean was not setting cleaned_data for the status field to an integer value; cleaned_data['status'] was just getting set to something like u'1'. I am in fact using sqllite, and yes, my status fields are just integers: OPEN_STATUS = 1