Re: rendering values from ManyToMany fields

2009-04-13 Thread Adam Fraser
display_value = ''.join([unicode(x) for x in getattr(obj, field_name).get_query_set()]) except: display_value = None # -- self.fields[field_name].widget = ReadOnlyWidget(getattr (

Re: rendering values from ManyToMany fields

2009-04-13 Thread Adam Fraser
nnick wrote: > On Fri, 2009-04-10 at 12:16 -0700, Adam Fraser wrote: > > [...] > > > The problem I'm running into is that the value that comes into render > > for the ManyToManyField is a list of the id's for the selected stains > > and not t

rendering values from ManyToMany fields

2009-04-10 Thread Adam Fraser
Hello, I'm using a ManyToManyField to model a relationship where a "Project" object may have many different "Stain" objects. The code is working successfully and looks like this class Stain(models.Model): def __unicode__(self): return unicode(self.name) name = models.CharField(m

Re: need a multiselect list box for a static list of options

2009-04-07 Thread Adam Fraser
Yup: >>> django.get_version() u'0.97-pre-SVN-unknown' On Apr 6, 1:45 pm, Alex Gaynor wrote: > On Mon, Apr 6, 2009 at 1:40 PM, Adam Fraser wrote: > > > Yeah, I just realized I'm running django 0.97 > > > On Apr 6, 1:32 pm, Karen Tracey wrote: >

Re: need a multiselect list box for a static list of options

2009-04-06 Thread Adam Fraser
Yeah, I just realized I'm running django 0.97 On Apr 6, 1:32 pm, Karen Tracey wrote: > On Mon, Apr 6, 2009 at 11:57 AM, Adam Fraser wrote: > > > > > Does anyone have a clue why I can't access ModelAdmin in > > django.contrib.admin? > > > >>>

Re: need a multiselect list box for a static list of options

2009-04-06 Thread Adam Fraser
rm admin.site.register(Project, ProjectAdmin) class ProjectForm(forms.ModelForm): class Meta: model = Project stains = forms.CommaSeparatedIntegerField (widget=forms.SelectMultiple(choices=STAINS_CHOICES)) but I can't figure out what I'm doing wrong. -Adam On Mar 26,

Re: need a multiselect list box for a static list of options

2009-03-26 Thread Adam Fraser
184 ... In template /home/radon01/afraser/projectprofiler/templates/admin/ base.html, error at line 28 28{% trans 'Change password' %} ...I can't figure out what the password_change view as to do with the commaseparatedintegerfield. Thanks again :] Adam On Mar 26, 11:39 am, B

Re: need a multiselect list box for a static list of options

2009-03-26 Thread Adam Fraser
..or can I? You suggested something like this earlier only referred to forms.CommaSeparatedIntegerField rather than models.CommaSeparatedIntegerField. hrm On Mar 24, 10:59 am, Brian Neal wrote: > On Mar 24, 8:55 am, Adam Fraser wrote: > > > > > Still doesn't work.

Re: need a multiselect list box for a static list of options

2009-03-24 Thread Adam Fraser
at input the data in the admin pages on the site... they are just automatic. What confuses me to death is how all I need to do is add "from django import forms" to the above code to make it break. -Adam Brian Neal wrote: > On Mar 23, 3:36 pm, Adam Fraser wrote: > >

Re: need a multiselect list box for a static list of options

2009-03-23 Thread Adam Fraser
I found the SelectMultiple widget here: http://docs.djangoproject.com/en/dev/ref/forms/widgets/ But I still don't know how to hook that up to a model like CommaSeparatedIntegerField. help? On Mar 23, 3:25 pm, Adam Fraser wrote: > I don't see anything called SelectMultiple on

Re: need a multiselect list box for a static list of options

2009-03-23 Thread Adam Fraser
choices. > You can find something about it > athttp://docs.djangoproject.com/en/dev/topics/forms/modelforms/ > > ~Jakob > > On 23 Mar., 19:49, Adam Fraser wrote: > > > Hello, > > > This should be a pretty simple question.  I have a list of options: > > > S

need a multiselect list box for a static list of options

2009-03-23 Thread Adam Fraser
Hello, This should be a pretty simple question. I have a list of options: STAIN_CHOICES = ( (1, 'DNA - DAPI'), (2, 'DNA - Hoechst'), (3, 'DNA - other'), (4, 'Actin - Phalloidin'), (5, 'Tubulin'), ) I would like users to be able to select more than one of these things at a t

elusive Post error

2008-07-08 Thread Adam Fraser
I was wondering if anyone else has ever run into this problem... When filling out a form, I click submit and get a POST error claiming that the page does not support POST. However, if I refresh the error page, the request goes through, and all is happy. I don't have much experience with web app

typing in django

2008-06-20 Thread Adam Fraser
In the code snip below, I am overriding the save() method of my "Project" object so that I can record the modification to that project by creating and saving a "ProjectModification" object. The idea is simple, but note that I have to convert the project field values to strings before comparing th

Re: Implementing a new idea

2008-06-19 Thread Adam Fraser
ntioned in my first ref. above, but it turns out I couldn't have models importing signals while signals imported models. Otherwise it would have made more sense for me to use signaling for scalability and elegance. -adam On Jun 18, 11:35 am, Adam Fraser <[EMAIL PROTECTED]> wrote: >

Re: Implementing a new idea

2008-06-18 Thread Adam Fraser
I didn't, but you can bet I will now. Thanks for the lead! -Adam On Jun 17, 4:22 pm, Dan <[EMAIL PROTECTED]> wrote: > Did you take a look at Django Signals? You can intercept pre-save and > post-save objects with them. You can use that to grab the data you > want and fill your ProjectModificatio

Implementing a new idea

2008-06-17 Thread Adam Fraser
Hello, I am currently using Django to keep track of "Timecards" submitted towards work on different "Projects". What I would like to do, is to track when "Modifications" are made on projects (via the project admin page). (I'm quoting words that are represented literally in the data model.) For

Re: User matching query does not exist.

2008-06-17 Thread Adam Fraser
Got it... noticed that there was a single invalid user_id in my timecard table in the database. Not sure how this could have happened. -Adam On Jun 17, 2:43 pm, Adam Fraser <[EMAIL PROTECTED]> wrote: > Suddenly, I am getting the following error when I try to look at my > Timecard

User matching query does not exist.

2008-06-17 Thread Adam Fraser
Suddenly, I am getting the following error when I try to look at my Timecard objects, via Timecard.objects.all() >>> Timecard.objects.all() Traceback (most recent call last): File "", line 1, in File "/imaging/analysis/People/imageweb/python-packages/django/db/ models/query.py", line 108, in

Re: can't find media

2008-06-12 Thread Adam Fraser
Correction, winter.css is loading... just not base.css. Turns out this is in ./projectprofiler/meda/admin/css That solves it. On Jun 12, 1:36 pm, Adam Fraser <[EMAIL PROTECTED]> wrote: > Hrm, well now the URL resolves and I can see the contents of the file > by going > hereh

Re: can't find media

2008-06-12 Thread Adam Fraser
ideas what's causing this? -Adam On Jun 12, 1:10 pm, Jeff Anderson <[EMAIL PROTECTED]> wrote: > Adam Fraser wrote: > > Hi, > > > I'm testing Django locally and I've added the line: > > (r'^projectprofiler/media/(?P.*)$', 'django.views.

can't find media

2008-06-12 Thread Adam Fraser
Hi, I'm testing Django locally and I've added the line: (r'^projectprofiler/media/(?P.*)$', 'django.views.static.serve', {'document_root': '/projectprofiler/media/'}), to urls.py as it is mentioned to do so here (http:// www.djangoproject.com/documentation/static_files/). Note: The path to the f

trying to modify admin

2008-06-09 Thread Adam Fraser
Hello, I'm using Django to keep track hours spent working on "projects". The data model includes classes "Project" (name, description,...), "Timecard" (user, date) , and "TimecardHours" (timecard, project, hours). With these models plugged in, I get a nice admin page for changing/ reviewing pro