Re: passing multiple query sets into a url pattern

2012-02-19 Thread Alfredo Alessandrini
Hi Stanwn, try this: def get_keyword(): return Keyword.objects.all() UserProfile_info = { "queryset" : UserProfile.objects.all(), "extra_context" : {"keyword_list" : get_keyword } } Now you can use the variable {{ keyword_list }} to populate the template. Alfredo 2012/2/19 Stan

registration forms.py

2012-02-19 Thread Stanwin Siow
Hello, The below method is an excerpt taken from the default registration forms.py with a few additional inputs. class RegistrationForm(forms.Form): keywords = forms.ModelMultipleChoiceField(queryset=Keyword.objects.all()) def save(self, profile_callback=None): new_user

Re: passing multiple query sets into a url pattern

2012-02-19 Thread Bill Freeman
Yes, you can, as part of the extra context, by whatever name doesn't collide. Then you could use it in your template, in a "for" tag. You could also pass another one, by a name other than "queryset" at the same level as the first one, but that becomes an argument to the view, so don't expect it t

Re: passing multiple query sets into a url pattern

2012-02-19 Thread Stanwin Siow
Cheers bill! Figured it out already. However i'm stuck on the database problem which i wrote in a separate email. Stan Best Regards, Stanwin Siow On Feb 19, 2012, at 9:34 PM, Bill Freeman wrote: > Yes, you can, as part of the extra context, by whatever name doesn't > collide. Then you > co

Adding Of Users

2012-02-19 Thread coded kid
Hi guys, I'm trying to make the below script let users follow each other. Just like adding friends up.So that users will be able to follow each other. When I click the 'follow' button in a user profile, instead of it to take me to the users wall, it will only redirect me to the same page(user prof

Related Objects

2012-02-19 Thread Jason Elliott
I have a case in which I need to return only 1 field from the related object (table). The docs give an example where I can return the related object in a query, but I need only one field from the related object. For Example: I retrieve all the customers from the 'Customers' table. Each customer

Request Context problem

2012-02-19 Thread dummyman dummyman
Hi , I am newbie to django Here is my code {% csrf_token %} # some code. here is my view function def ProcessVideo(request): if request.method == "POST": form = U

handling multiple parallel request

2012-02-19 Thread rafiee.nima
hi I want to develop a VIEW for cashier system which my receives multiple parallel form as request from deferent clients I want to know how can I handle these request ...is there any thing like queue in django tnx -- You received this message because you are subscribed to the Google Groups "Dj

templates not updating when i change things please help

2012-02-19 Thread Rich
Hi I am pretty new to django and I feel like I either have some kind of configuration wrong or maybe im not understanding how something works. Whats happening is when I make a small change in one of my templates, the change is not reflected on my site. I have noticed that if I make significant ch

Re: templates not updating when i change things please help

2012-02-19 Thread Furbee
When you make a change to a module (.py) file, you may need to restart your web server service (Apache2, IIS Service, etc). For template files (.htm/html) I have never had to restart my server for those changes to be reflected, so that may be local cache in the browser. Perhaps try using a new brow

Re: templates not updating when i change things please help

2012-02-19 Thread Rich
I found my problem... I had 2 different templates created with the same code and I was using the wrong one On Feb 19, 9:53 am, Rich wrote: > Hi I am pretty new to django and I feel like I either have some kind > of configuration wrong or maybe im not understanding how something > works. > > Whats

Re: Related Objects

2012-02-19 Thread Shawn Milochik
I think what you're looking for is annotate(): https://docs.djangoproject.com/en/1.3/topics/db/aggregation/ -- 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

Division within django templates

2012-02-19 Thread Jason
Hi there, i'm currently using the widthratio tag for division within a django template as detailed here: http://slacy.com/blog/2010/07/using-djangos-widthratio-template-tag-for-multiplication-division/. However, it only returns integer values. Is there something equally smart I can use to ret

Re: Division within django templates

2012-02-19 Thread Bill Freeman
Yes. Use a model method. Don't do serious calculation in templates. On Sun, Feb 19, 2012 at 11:03 AM, Jason <1jason.whatf...@gmail.com> wrote: > Hi there, > > i'm currently using the widthratio tag for division within a django template > as detailed > here: http://slacy.com/blog/2010/07/using-dj

Re: registration forms.py

2012-02-19 Thread akaariai
On Feb 19, 1:42 pm, Stanwin Siow wrote: > Hello, > > The below method is an excerpt taken from the default registration forms.py > with a few additional inputs. > > class RegistrationForm(forms.Form): > >     keywords = forms.ModelMultipleChoiceField(queryset=Keyword.objects.all()) > >     def sa

django-typed-models - sane single-table model inheritance

2012-02-19 Thread Craig de Stigter
In May last year I posted this topicon django-developers. We wanted a way to do proxy-model inheritance, while preserving the type of each object when it goes in and out of the database. Unable to find anything that di

Re: Request Context problem

2012-02-19 Thread Reinout van Rees
On 19-02-12 14:16, dummyman dummyman wrote: I am getting the following eror on posting the form CSRF verification failed. Request aborted. Reason given for failure: CSRF token missing or incorrect. It is already on the first go into your view that Django complains about a missing CSRF t

Re: Testing: Fixtures vs Factories vs ???

2012-02-19 Thread Steve Bywater
I work on a complex django project -- our test suite is over 1000 tests. We've begun converting them from fixtures to factories. Here's why: - Factories were measurably faster. At least in my local environment, which may be more IO bound than others, but I was looking at the results of tests and s

Associating Form Data with Users

2012-02-19 Thread ds39
Hi All, I was wondering if someone could tell me the correct method for associating submitted form data with a user. I would like to access user-submitted form information with the API (or a template) via user identification. I'm making use of a ModelForm in a forms.py file which corresponds to a

Re: Associating Form Data with Users

2012-02-19 Thread Shawn Milochik
When you process the form in your view, you'll have access to request.user. Just use that. -- 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

Re: Associating Form Data with Users

2012-02-19 Thread ds39
Thanks for your response. But, would you mind expanding on it a little bit ? On Feb 19, 9:21 pm, Shawn Milochik wrote: > When you process the form in your view, you'll have access to > request.user. Just use that. -- You received this message because you are subscribed to the Google Groups "Dj

Re: Associating Form Data with Users

2012-02-19 Thread Shawn Milochik
On 02/19/2012 09:29 PM, ds39 wrote: Thanks for your response. But, would you mind expanding on it a little bit ? How about you give it a try and see what you can figure out? In your view, request.user will return the currently logged-in user (or an AnonymousUser if they're not logged in). Si

template tag that iterates over list with for loop

2012-02-19 Thread brian
Is it possible to create a template tag that will create a list that a for loop can loop over? I know I can create a template tag that will store the list in a variable and then iterate over that variable. I want to do it in one step. For example the template tag with be “list_print” that will cr

How to show the template reserved keyword on html.

2012-02-19 Thread Morris
Hi all, I would like to write some django note via template. I tried to show ""{{ sample }}"" on my website, but it's empty. I think django think it's a variable name. So, how to show {{ sample }} ? On the other hand, how to show template reserved word? Thanks a lot. -- You received t

Re: How to show the template reserved keyword on html.

2012-02-19 Thread Karen Tracey
On Mon, Feb 20, 2012 at 2:00 AM, Morris wrote: > Hi all, > > I would like to write some django note via template. I tried to > show ""{{ sample }}"" on my website, but it's empty. I think django > think it's a variable name. > > So, how to show {{ sample }} ? On the other hand, how to show >

Re: How to show the template reserved keyword on html.

2012-02-19 Thread Morris
Hi Karen, Thanks a lot, I tried the method. {% openvariable %} sample {% closevariable %} But , I got error message as below: Invalid block tag: 'openvariable' Request Method: GET Request URL:http://10.7.40.190/document/doc/ Django Version: 1.3.1 Exception Type: TemplateSyntaxError Exceptio