LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 11-20-2011, 12:09 PM   #1
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Rep: Reputation: 83
Django: how to narrow the options in a ManyToManyField of a ModelForm?


I have a Model that has a ManyToManyField related to User (that'd be djando users).

So, I want to present a form to a user so that the list of users is available so they can pe picked... and it does show up (the beauties of django). Just extended ModelForm, provided the model in Meta and it's done.

What I'd like to do now is restrict the list of users that show up instead of all the users. Is that possible without much hassle? Is there a hook/method that I could use when the list of users is retrieved that I could override?
 
Old 11-20-2011, 01:18 PM   #2
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
As a workaround, I placed the removal of the unwanted users from the form on JS... I'd like to get it right from the form, though.
 
Old 11-20-2011, 01:38 PM   #3
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
Oh... and the check is performed on form validation again, so no crap will be allowed to drop in :-)
 
  


Reply

Tags
django, forms, manytomanyfield, modelform


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Bash question -- Narrow output of 'debootstrap --print-debs' to package names only Kenny_Strawn Linux - General 4 01-22-2011 07:58 PM
Mumble, murmur, django and mumble-django. Linux.tar.gz Linux - Software 2 02-10-2009 02:47 AM
DDR Memory: Mixed Manufacturers? Or Straight and Narrow? JazzItSelf Linux - Hardware 2 10-12-2007 11:19 PM
Narrow font for AbiWord Gnute Linux - Software 1 08-21-2005 12:06 AM
narrow lil' boxes acid_kewpie LQ Suggestions & Feedback 8 02-10-2002 12:16 PM


All times are GMT -5. The time now is 05:48 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration