how to check size of a dict or list in template

2010-03-02 Thread harryos
hi I am passing a dictionary to the template say, objects_status={obj1:True, obj2:False, obj3:True } In the template I want to show something like {%if not len(objects_tatus ) %} # just to clarify the purpose..I know len will not work No objects to show {% else %} Objects are: .

checking size of dict or list in template

2010-03-02 Thread harryos
hi I am passing a dictionary to the template say, objects_status={obj1:True, obj2:False, obj3:True } In the template I want to show something like {%if not len(objects.status ) %} # just to clarify the purpose..I know len will not work No objects to show {% else %} Objects are: .show

what has to be changed after project.db deletion and new empty project.db file creation manually

2010-03-02 Thread gintare
Hello. to summarize the question is which lines has to be changed when the database file i.e, referenc.db is deleted and later created manually as empty database? The problem is that i created whole project a week before. Later i modified modules, added new tables and new fields (Rrest column

Re: Templates sometimes load at bottom of page

2010-03-02 Thread Atamert Ölçgen
On Wednesday 03 March 2010 07:58:39 timdude wrote: > I'm using .96. Other than that, what would my problem be? There has been significant changes since 0.96, you should seriously consider upgrading! -- Saygılarımla, Atamert Ölçgen -+- --+ +++ www.muhuk.com mu...@jabber.org -- You

Templates sometimes load at bottom of page

2010-03-02 Thread timdude
Hi, First post, first question. I've been using django for about a year now, learning heaps. My problem: Sometimes pages load...the base template loads fine, but the template inside my base template, sometimes loads with a large gap at the top. All I have to do is refresh the page and all is

Multi table query

2010-03-02 Thread Lee Hinde
Hi; I've posted a diagram of what I'm trying to explain here: http://www.hinde.net/images/queryquestion.png I'm working on a tool for a screen printer. Products (t-shirts, hats, etc.) can be linked to multiple categories. A product can come in multiple colors and each color can come in a

Re: Storing API Passwords

2010-03-02 Thread Eric Chamberlain
On Mar 1, 2010, at 2:56 PM, Chris wrote: > Hello, > > When working with photo API's such as twitpic, what is the best way of > storing the password? > Since the password needs to be sent in its natural form, hashing is > not an option. I read recently heard that a company was held > accountable

HTML & Django (Google App Engine)

2010-03-02 Thread slenno1
Hey everyone, I am currently working with a section of a site that takes user input using Django forms: description = forms.CharField(widget=forms.Textarea(attrs={'rows': '10', 'cols': '80'})) The only problem however is that this ignores any html tags that are added in by the user and

Re: How to create connection pooling in django

2010-03-02 Thread Christophe Pettus
On Mar 2, 2010, at 7:05 PM, vijaya ragavan wrote: http://code.djangoproject.com/ticket/1237 That ticket is solving a different problem: Multiple threads using the same connection incorrectly. It was superseded by: http://code.djangoproject.com/ticket/1442 Which was applied and

Re: Storing API Passwords

2010-03-02 Thread hcarvalhoalves
On 2 mar, 14:40, Dougal Matthews wrote: > On 2 March 2010 14:11, hcarvalhoalves wrote: > > > Sorry, I just saw Twitpic's documentation now [1]. > > > What I can say, is that their implementation is a joke. > > It's not that simple. Twitpic is usually

Re: How to create connection pooling in django

2010-03-02 Thread vijaya ragavan
Hi Christophe Pettus, I am using MSSQL. I don't want to use SQLAlchemy. I would like to change the code in Django to achieve connection pooling. I followed the steps given in the following link http://code.djangoproject.com/ticket/1237 But the code

Re: Django custom types / DjangoUnicodeDecodeError:

2010-03-02 Thread Karen Tracey
On Tue, Mar 2, 2010 at 7:05 PM, Brandon wrote: > No error. I'm guessing Django doesn't populate connection.queries > when it isn't in debug mode? > Right. > This would definitely work for production, but what other options do I > have for development? It would be a huge

Re: How to create connection pooling in django

2010-03-02 Thread Christophe Pettus
On Mar 2, 2010, at 6:54 PM, vijaya ragavan wrote: Please provide me the link to achive connection pooling with the Django1.1.1. Django does not, itself, do connection pooling. Depending on what database back-end you are using, you might look at pooling middleware, just as pgpool II or

Re: How to create connection pooling in django

2010-03-02 Thread vijaya ragavan
Hi All, I am using Django1.1.1(Apache via mod_wsgi deployment) with MSSQL DB. I found that the new DB connection is getting created for every request . But i want to use connection pooling. Please provide me the link to achive connection pooling with the Django1.1.1. Thanks and Regards, vijay.

Re: LDAP/AD Persistent authentication

2010-03-02 Thread valhalla
Yeah Defiantly cant store the users password. I was thinking it might be possible with kerberos but had no idea where to start...any pointers? On Mar 3, 10:38 am, Eric Chamberlain wrote: > On Mar 1, 2010, at 8:05 PM, valhalla wrote: > > > Hi All, > > > I am looking for a

Re: Update a single column of a row in a Model

2010-03-02 Thread Shawn Milochik
Use a forms.ModelForm and exclude all the fields except one, or use a forms.Form with one field and use its value in a queryset .update() call. Shawn Sent from my iPhone On Mar 2, 2010, at 7:11 PM, Ken wrote: Folks This is a bit of a newbie question on Model

Update a single column of a row in a Model

2010-03-02 Thread Ken
Folks This is a bit of a newbie question on Model updates. I've been happily using Django to give my users a read-only view of the database for nearly a year, but now I'd like my users to be able to update a row in one of my tables. We're told in the Model documentation that "Django knows best"

Re: Django custom types / DjangoUnicodeDecodeError:

2010-03-02 Thread Brandon
No error. I'm guessing Django doesn't populate connection.queries when it isn't in debug mode? This would definitely work for production, but what other options do I have for development? It would be a huge step up for us to be able to work in an interactive shell and see what queries were run

Fwd: [Django] Error (EXTERNAL IP): /xml/cat/da-vinci-games

2010-03-02 Thread Alessandro Ronchi
I have a lot of this unicode error I didn't get before use varnish: http://dpaste.com/167139/ ~~~ handler.addQuickElement(u"pubDate", rfc2822_date(item['pubdate']).decode('utf-8')) File "/usr/lib/python2.4/encodings/utf_8.py", line 16, in decode return

Re: Restrict choices in ModelForm for ForeginKey field

2010-03-02 Thread Bill Freeman
Good stuff. I take it that not specifying queryset on the ModelChoiceField constructor doesn't work? If you really need an empty one by default, then the none() method seems ideal. The documentation says that this provides an EmptyQuerySet, so you don't have to worry about it changing. There's

Re: Serializing objects with a many-to-many reference

2010-03-02 Thread Russell Keith-Magee
On Wed, Mar 3, 2010 at 12:46 AM, Jim N wrote: > Hi, > > I am writing a question-and-answer app which serializes data in JSON. > I have Question, User, and Asking models.  Asking is the many-to-many > relationship table for Question and User, because the Asking >

Re: Django custom types / DjangoUnicodeDecodeError:

2010-03-02 Thread Karen Tracey
What happens if you try running with debug off? Karen -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to

Re: LDAP/AD Persistent authentication

2010-03-02 Thread Eric Chamberlain
On Mar 1, 2010, at 8:05 PM, valhalla wrote: > Hi All, > > I am looking for a relatively secure way to allow a logged in user > (currently auth via ldap to AD) to use their AD credentials to search > AD. > > I have plenty of code for how to search AD but no way that I can see > of running that

Django custom types / DjangoUnicodeDecodeError:

2010-03-02 Thread Brandon
Greetings, My organization is evaluating Django as a possible frontend to a legacy IBM Db2 Database. I've successfully connected the Django 1.2 beta with our database, but ran into an issue with a DB2 specific column. Our tables all have primary keys defined as `CHAR(13) FOR BIT DATA`, which is

Re: Fill in form + user first time

2010-03-02 Thread James Pic
Hello everybody, On Tue, Mar 2, 2010 at 11:14 PM, GoSantoni wrote: > Is it reasonable easy to achieve a form for users with in the end the > opportunity to register or login? I'd like to let users who visit the > site for the first time be able to choose a password and

Re: Just deployed to 1.2 w/mod-wsgi, app works, admin's busted

2010-03-02 Thread ssteinerX
On Mar 2, 12:36 pm, Karen Tracey wrote: > On Tue, Mar 2, 2010 at 10:25 AM, Alex Robbins > > wrote: > > I think the problem is that you are using the old admin.site.root. You > > should use the include(admin.site.urls) form instead. > >

Fill in form + user first time

2010-03-02 Thread GoSantoni
Hi group, Is it reasonable easy to achieve a form for users with in the end the opportunity to register or login? I'd like to let users who visit the site for the first time be able to choose a password and name. This needs to registered first and temporarily the data of the form itself needs to

Re: How Can I Create a User Group?

2010-03-02 Thread MauroCam
Hi, we have an init.py script that sets up all the baseline data. In it we create the necessary groups and assign the core admin users to the groups. from django.contrib.auth.models import Group as DjangoGroup gUsers = DjangoGroup(name='Users') gUsers.save()

Re: auth issue on Windows

2010-03-02 Thread Stefan Berglund
I have tried Firefox 3.6 and Internet Explorer 8, same thing in both. And it's Python 2.5.4. And I use manage.py runserver against localhost so the hostname is the same before and after login (http://localhost/...). After login, I redirect to "/indexview/" like this; [...] return

Re: Get id attribute in a form

2010-03-02 Thread Atamert Ölçgen
On Tuesday 02 March 2010 17:19:46 leoz01 wrote: > Nobody could answer me? Maybe I haven't ask well? > > > i have a simple question, how can i get the id attribute (which > > correspond to html id) from a form's field ? AFAIK you can't. But check the sources just to be sure. > > When i use my

Re: Creating fancier views

2010-03-02 Thread Richard
On Mar 1, 10:35 pm, Jirka Vejrazka wrote: > > customising templates.  I am wondering if there is an easy way to > > spice up certain things, such as tables, in a similar way to the admin > > interface does.  Specifically I'd like sortable/filterable columns at > > this

Re: buildout and fixtures

2010-03-02 Thread trappedIntoCode
Did you come across: http://pypi.python.org/pypi/pb.recipes.pydev ? Also, add the /bin folder to your path (or pythonpath) to get access to the scripts. If you are using Virtualenv, select virtualenv's python script as interpreter in Preferences-> Pydev->Interpreters. On Feb 26, 11:26 pm,

insert satement do not work, django can not find the column

2010-03-02 Thread gintare statkute
Hello. to summarize the question is which lines has to be changed when the database file i.e, referenc.db is deleted and later created manually as empty database? The problem is that i created whole project a week before. Later i modified modules, added new tables and new fields (Rrest column

Re: Efficient way to Display Comments with Threaded Replies

2010-03-02 Thread Merrick
I forgot to change out the name of the node to be path, which is what it is. That's why I can sort on it. Thank you, I'll give it a try. On Mar 2, 12:04 am, Mihail Lukin wrote: > I'm not sure what "node" is, but maybe you're looking for something > like this: > >

Re: ImageField and built-in filesystem storage

2010-03-02 Thread thanos
You take a look at how I did things in http://code.google.com/p/django-googledata/ Thanos On Mar 2, 4:44 am, Xavier Ordoquy wrote: > Hi, > > I'm currently working on Django for a website on a legacy database but I'm > facing an issue on getting ImageField working with it

Re: Modeling question

2010-03-02 Thread Mark (Nosrednakram)
Hello Jeff, Not sure of your implementation but you should be able to adapt: http://projects.django-development.com/trac/dd_devel/wiki/recursive_groups_of_groups to work. You could replace department with navigation-collection and employee with menu item I believe. If nothing else the tests

Re: Modeling question

2010-03-02 Thread Mark (Nosrednakram)
Hello Jeff, Not sure of your implementation but you should be able to adapt: http://projects.django-development.com/trac/dd_devel/wiki/recursive_groups_of_groups to work. You could replace department with navigation-collection and employee with menu item I believe. If nothing else the tests

Re: How do I get "date.strftime" in the language set by "/i18n/setlang/"

2010-03-02 Thread jul
Perfect. Thanks. On Mar 2, 6:47 pm, James Bennett wrote: > On Tue, Mar 2, 2010 at 11:19 AM, jul wrote: > > I have a multilingual site and I'd like to get some date in the > > current language. With date.strftime, I get the date in english > > only... > >

Re: How do I get "date.strftime" in the language set by "/i18n/setlang/"

2010-03-02 Thread James Bennett
On Tue, Mar 2, 2010 at 11:19 AM, jul wrote: > I have a multilingual site and I'd like to get some date in the > current language. With date.strftime, I get the date in english > only... > The language is set by "/i18n/setlang/". > How can I do that? For simple formatting, you

Re: Storing API Passwords

2010-03-02 Thread Dougal Matthews
On 2 March 2010 14:11, hcarvalhoalves wrote: > Sorry, I just saw Twitpic's documentation now [1]. > > What I can say, is that their implementation is a joke. > It's not that simple. Twitpic is usually used by 3rd party programs - not directly. So for example with

Re: Just deployed to 1.2 w/mod-wsgi, app works, admin's busted

2010-03-02 Thread Karen Tracey
On Tue, Mar 2, 2010 at 10:25 AM, Alex Robbins wrote: > I think the problem is that you are using the old admin.site.root. You > should use the include(admin.site.urls) form instead. > > admin.site.root still works, I just tried current trunk running under mod_wsgi

Serializing objects with a many-to-many reference

2010-03-02 Thread Jim N
Hi, I am writing a question-and-answer app which serializes data in JSON. I have Question, User, and Asking models. Asking is the many-to-many relationship table for Question and User, because the Asking relationship may be more complicated than it seems. (Several users may ask, and re-ask the

Re: Storing API Passwords

2010-03-02 Thread hcarvalhoalves
Sorry, I just saw Twitpic's documentation now [1]. What I can say, is that their implementation is a joke. Twitter is already supporting 3rd party apps authorization the proper way, there's no reason for Twitpic to ask user's passwords. While their implementation is wrong and they need to fix it,

How do I get "date.strftime" in the language set by "/i18n/setlang/"

2010-03-02 Thread jul
hi, I have a multilingual site and I'd like to get some date in the current language. With date.strftime, I get the date in english only... The language is set by "/i18n/setlang/". How can I do that? thanks jul -- You received this message because you are subscribed to the Google Groups

Re: Template Form Field Styles

2010-03-02 Thread Prabhu
{% if field.errors %} {% else %} {% endif %} This could be written as On Feb 25, 5:21 am, jbergantine wrote: > Yeah, no problem. This is a snippet I've used before. If there aren't > errors it just wraps a

Re: RadioSelect Widget : Incorrect/Wrong Mark-up?

2010-03-02 Thread Tom Evans
On Tue, Mar 2, 2010 at 5:05 PM, Prabhu wrote: > I think the browser would forgive for these mistakes. See if you can > file a bug and submit a patch to django. > > On Mar 1, 2:03 am, "czamb...@gmail.com" wrote: >> It looks like the mark-up used

Re: auth issue on Windows

2010-03-02 Thread Prabhu
What browser are you using? Is the hostname remaining the same before and after login? On Mar 1, 11:34 pm, boffen wrote: > Hi, I'm trying out python+django 1.1.1 on Windows 7 and I have trouble > getting django-registration working. > After logging in, request.user is

Re: RadioSelect Widget : Incorrect/Wrong Mark-up?

2010-03-02 Thread Prabhu
I think the browser would forgive for these mistakes. See if you can file a bug and submit a patch to django. On Mar 1, 2:03 am, "czamb...@gmail.com" wrote: > It looks like the mark-up used for the RadioSelect widget is > incorrect. > > For example: > from django import forms

Modeling question

2010-03-02 Thread Jeffrey Taggarty
Hi Guys, I have a website (go figure!) where there is a main navigation, there is going to need to be sub pages for each main nav item, but this sub page can belong to more than 1 main nav, typically in the past I used a self referencing FK to handle this, but this time it's a m2m, any tips on

Re: Permissions to see a view

2010-03-02 Thread Sander
Oops. must have overread that :S Sorry, On Mar 2, 5:18 pm, Shawn Milochik wrote: > Step 1: docs.djangoproject.com > > Step 2: mailing list. > > You skipped step > 1:http://docs.djangoproject.com/en/1.1/topics/auth/#limiting-access-to-... > > Shawn -- You received this

Re: Template Form Field Styles

2010-03-02 Thread kkerbel
Thanks! On Feb 24, 11:21 pm, jbergantine wrote: > Yeah, no problem. This is a snippet I've used before. If there aren't > errors it just wraps a div around the label and input element. If > there are errors it appends a class of 'error' to the div. > > {% for field in form

Re: Permissions to see a view

2010-03-02 Thread Shawn Milochik
Step 1: docs.djangoproject.com Step 2: mailing list. You skipped step 1: http://docs.djangoproject.com/en/1.1/topics/auth/#limiting-access-to-logged-in-users-that-pass-a-test Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Permissions to see a view

2010-03-02 Thread Sander
Hi everybody! In my project I have 3 kind of users. During registration I create a user object and add them to the right group. In the admin site it's possible to add some permissions to the different groups but I'm not sure this is the right way to do what I want. For example I have an app

Re: Restrict choices in ModelForm for ForeginKey field

2010-03-02 Thread AlienBaby
Hi, thanks for the pointers, I followed through Bill's suggestion, and while I could understand the approach I did indeed have problems with ''access to data from the request'' as this was all happening in the models.py in a class definition. But, reading around it and a little more google I

Re: Help with Date Functions

2010-03-02 Thread Masklinn
On 2 Mar 2010, at 16:55 , Chris McComas wrote: > > One more question...I'm trying in my view to say if the deadline has > passed to make that field as True, if not False > > I have this view: http://dpaste.com/166951/ > > This is the error I get: > > http://dpaste.com/166952/ > > On Mar 2,

Re: Help with Date Functions

2010-03-02 Thread Chris McComas
One more question...I'm trying in my view to say if the deadline has passed to make that field as True, if not False I have this view: http://dpaste.com/166951/ This is the error I get: http://dpaste.com/166952/ On Mar 2, 10:12 am, Chris McComas wrote: > Crap my bad,

Re: Restrict choices in ModelForm for ForeginKey field

2010-03-02 Thread Alex Robbins
If you set limit_choices_to on the underlying foreign key, I think that shows up in any modelform derived from it too. http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ForeignKey.limit_choices_to Hope that helps, Alex On Mar 1, 8:24 am, AlienBaby

Re: Just deployed to 1.2 w/mod-wsgi, app works, admin's busted

2010-03-02 Thread Alex Robbins
I think the problem is that you are using the old admin.site.root. You should use the include(admin.site.urls) form instead. http://docs.djangoproject.com/en/dev/ref/contrib/admin/#hooking-adminsite-instances-into-your-urlconf Hope that helps! Alex On Mar 2, 12:01 am, ssteinerX

Re: Get id attribute in a form

2010-03-02 Thread leoz01
Nobody could answer me? Maybe I haven't ask well? On 24 fév, 21:05, leoz01 wrote: > Hello, > > i have a simple question, how can i get the id attribute (which > correspond to html id) from a form's field ? > > example : > class MyModel(...): >    test = CharField(...) > >

Re: How Can I Create a User Group?

2010-03-02 Thread Matt McCants
To add a group from the API, you can do this: from django.contrib.auth.models import User,Group # Get or Create the Group (I <3 this method) mygroup, created = Group.objects.get_or_create(name='Web Design') # Add fakeuser to group myuser = User.objects.get(username='fakeuser')

Re: Help with Date Functions

2010-03-02 Thread Chris McComas
Crap my bad, just under the gun to get this done and I overlook easy stuff. Sorry guys, thanks so much for your help! On Mar 2, 10:11 am, raj wrote: > Now that's a pure python typo. You must add(+) datetime.timedelta to > read_receipt. > > On Mar 2, 8:01 pm, Chris McComas

Re: Help with Date Functions

2010-03-02 Thread raj
Now that's a pure python typo. You must add(+) datetime.timedelta to read_receipt. On Mar 2, 8:01 pm, Chris McComas wrote: > I tried this: > > new_admit.read_receipt.datetime.timedelta(days=7) > > and I got this error: > > http://dpaste.com/166919/ -- You received this

Re: Help with Date Functions

2010-03-02 Thread Matt McCants
timedelta is an object in the datetime module. Much like date is an object in the datetime module. You would want to do something similar to this: from datetime import date, timedelta new_admit.tuition_deadline = new_admit.read_receipt + timedelta(days=7) Matt On Tue, Mar 2, 2010 at 10:01 AM,

Re: About response.status_code on testing

2010-03-02 Thread raj
You're Right. The problem is that my attempt at client.login() has failed somehow. Rajeesh. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group,

Re: Help with Date Functions

2010-03-02 Thread Chris McComas
I tried this: new_admit.read_receipt.datetime.timedelta(days=7) and I got this error: http://dpaste.com/166919/ On Mar 2, 9:51 am, Masklinn wrote: > On 2 Mar 2010, at 15:45 , Chris McComas wrote: > > > > > These are my models:http://dpaste.com/166906/ > > > I have a

Re: About response.status_code on testing

2010-03-02 Thread raj
Had tried with login using client.login() and the above result was after that. Will try with printing out response.content. Thanks for the time spent. Rajeesh. On Mar 2, 7:03 pm, Daniel Roseman wrote: > Doing "print response.content" before the assertion should show

Re: Help with Date Functions

2010-03-02 Thread Masklinn
On 2 Mar 2010, at 15:45 , Chris McComas wrote: > > These are my models: http://dpaste.com/166906/ > > I have a ModelForm setup, nothing special, just excluding a couple > fields: application, tuition_deadline, and deadline_passed > > What I'm trying to do in my view is if a value is entered in

Help with Date Functions

2010-03-02 Thread Chris McComas
These are my models: http://dpaste.com/166906/ I have a ModelForm setup, nothing special, just excluding a couple fields: application, tuition_deadline, and deadline_passed What I'm trying to do in my view is if a value is entered in read_receipt then it automatically sets tuition_deadline to be

Re: How Can I Create a User Group?

2010-03-02 Thread stherrien
Hi b14ck, To create a group you must go into the admin under the Auth section there you can create groups for each of the three models your using by selecting the proper permissions and then go into the user edit page and assign the group on the user you want to have that specific group. hope

Re: About response.status_code on testing

2010-03-02 Thread Daniel Roseman
On Mar 2, 12:34 pm, raj wrote: > Hi all, > > Since my model admin.change_view raises an exception, I'm expecting > the response_code to be 500 on requesting for the url, '/admin/myApp/ > myModel/1/'. This happens to be so when accessed through browser. But > my unit test

Re: Storing API Passwords

2010-03-02 Thread hcarvalhoalves
If I'm not wrong, you *should not* be storing the user's password on your database. All you need to store is the API key, and it's useless if stolen because most webservices generate the key to match your host/ domain. The process to get an API key is, generally, 1-2-3, so you just pass around

Re: Accessing foreign columns

2010-03-02 Thread Karen Tracey
On Tue, Mar 2, 2010 at 8:27 AM, codethief wrote: > Finally, is there a better to achieve these kinds of joins? > Yes: http://docs.djangoproject.com/en/dev/ref/models/querysets/#id4 Karen -- You received this message because you are subscribed to the Google Groups

Accessing foreign columns

2010-03-02 Thread codethief
Hello dear Django community, I'm currently working on an application which loads and finally displays large table data, which, internally, is spread over several SQL tables. More precisely, there's a table "devices" which is supposed to be displayed together with some information attached to it

Re: ViewDoesNotExist

2010-03-02 Thread Karen Tracey
On Tue, Mar 2, 2010 at 3:32 AM, Ayush Sharma wrote: > i am getting the following error on the url > http://127.0.0.1:8000/addartist/ > > ViewDoesNotExist at /uploadalbum/ > > Tried upload in module mysite.MusicFun.views. Error was: 'module' > object has no attribute