Django 1.2b multidatabase + manytomany relationship

2010-03-24 Thread mbdtsmh
Hi All, still trying to get my head around the multi db stuff in 1.2 release. Here is my problem that I have hit upon. I have a model in my default db... class Set1(models.Model): create_date = models.DateTimeField(auto_now_add='True') last_update = models.DateTimeField(auto_now='True',

Re: Multi Database Question

2010-03-19 Thread mbdtsmh
to sync to db_2 - how would I go about this? Thanks, Martin On Mar 19, 9:11 am, Daniel Roseman <dan...@roseman.org.uk> wrote: > On Mar 19, 8:44 am, mbdtsmh <martin.harri...@astrazeneca.com> wrote: > > > > > Hi all - I'm trying out the multi database options in django

Multi Database Question

2010-03-19 Thread mbdtsmh
Hi all - I'm trying out the multi database options in django 1.2 beta on a new project. I can connect to two databases which is great. However, I'm not sure what to do in my models.py file??? I have a single class in models.py that points to a table on a different database (existing table of

speed of calculations - combining query improves speed?

2009-12-11 Thread mbdtsmh
Hi all - can someone put me out of my misery on this one please? I have a piece of code that uses the request.GET keys in the url to produce the following in my views.py objects = Issue.objects.all() objects = objects.filter (designset__project__RA__RA=request.GET.__getitem__('RA')).distinct()

Re: ifequal with a tuple value?

2009-05-29 Thread mbdtsmh
. MMMmmm... On May 29, 12:50 pm, Rama Vadakattu <rama.vadaka...@gmail.com> wrote: > i hope you are encountering the problem as request.GET.subseries  is > string and id is integer and they are not matching. > > On May 29, 3:52 pm, mbdtsmh <martin.harri...@astrazeneca.com

ifequal with a tuple value?

2009-05-29 Thread mbdtsmh
I have the problem below when I use a tuple to try and match a request item; i.e., it never matches. I can do the same thing with a list rather than a tuple value and it works fine? I have tried to convert the tuple to a string but no joy - is there something obvious I'm missing???

MySQL to Oracle db engine

2008-10-21 Thread mbdtsmh
Hi All - I'm having trouble going from using a mysql database to an oracle database. The MySQL db settings work fine and I can validate & syncdb my tables into the database. However, when I change my settings.py to point to an oracle database then I get the following error (I have cx_Oracle

Re: Change form - populating selected item from a ForeignKey field?

2008-07-16 Thread mbdtsmh
, Martin On Jul 14, 8:48 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote: > Hi Martin, > > On Jul 14, 12:14 pm,mbdtsmh<[EMAIL PROTECTED]> wrote: > > > > > Hi everyone - wondering if someone could point me in the right > > direction with this one? > > >

Change form - populating selected item from a ForeignKey field?

2008-07-14 Thread mbdtsmh
Hi everyone - wondering if someone could point me in the right direction with this one? I am trying to populate fields in a form with data from the database (i.e., a change form rather than an add new form). It works fine for populating Char/Date Fields but when I do the same for ForeignKey or

Distinct values from a manytomany field?

2008-06-24 Thread mbdtsmh
How do I get a distinct list of values from a manytomany field Using a foreign key it is straightforward: RA_CHOICES = DesignSet.objects.values('project__RA').distinct() project is a foreignkey field. but trying the same on a m2m field raises an error: Designer_CHOICES =

Re: Object list with values to ForeignKey and ManyToMany

2008-06-24 Thread mbdtsmh
I'm also coming up against this problem; i.e., how to get a distinct list of values from a manytomany field Using a foreign key it is straightforward: RA_CHOICES = designsets.values('project__RA').distinct() project is a many2one field. but trying the same on a m2m field raises an error:

Limiting the choices of ForeignKey objects in the admin filters

2008-06-17 Thread mbdtsmh
Hello everyone, I have a question for you all that has been discussed before but I cannot figure out the best way to go about implementing. I have the following model: class DesignSet(models.Model): priority=models.ForeignKey(Priority) status=models.ForeignKey(Status,

Getting ForeignKey values into admin filters

2008-05-28 Thread mbdtsmh
Hi all, I have a ForeignKey object (designset) as part of a model class and can get the project value associated with foreignkey object using... def project(self): project = self.designset.project return project I can then use this created field in the list_display options

Values from a ForeignKey object?

2008-05-20 Thread mbdtsmh
Hi all, I assume there a way of accessing associated values from a ForeignKey object in the fieldset.html template that comes with the newforms- admin branch? I cannot for the life of me figure it out - HELP! example: {% if fieldset.name %}{{ fieldset.name }}{% endif %} {% if

newforms-admin: {{ original.exemplar_text }} Object Error

2008-05-15 Thread mbdtsmh
Hi all, I'm using the newforms-admin branch and have come across this annoyance. When I am trying to add a custom form value to the form text; i.e., {{ original.exemplar_text }} it gives me an Object expected error. This causes certain javascript elements that are also on the page not to

Value from bound_field objects

2008-05-12 Thread mbdtsmh
Hi all, How would you go about extracting the value from a bound_field object? (within the admin change_form.html template) At the moment I am using {{ bound_field.original|get_value_x }} {{ bound_field.original|get_value_y }} this pulls back the values from the model as described in the def

getting a value from bound_field in field_line.html template

2008-05-06 Thread mbdtsmh
Hi All, Appologies if this is a stupid question but before I go any further I'm new to Django! I have modified the field_line.html template (from within the change_form.html admin template) so it looks like this: {% load admin_modify %} {% load designset_extras %} {% for bound_field in

admin page html link tags defined as

2008-04-25 Thread mbdtsmh
Hi all - In the standard admin page for the latest svn release I'm having problems rendering html correctly in the table. Some of my text fields contain html markup: link to google for example. However, when I render these fields (using the change_list.html admin template) i get , for some of

form.fieldname.value ?

2008-04-21 Thread mbdtsmh
Hi all - being new to Django I've started to define my first template. The issue that I am having is when I simply want to get a value from a form object (rather than the whole string). I can get around this by passing in extra values in the render_to_response command in the views.py file