Re: How to list all parents and their children if any?

2009-11-29 Thread adelaide_mike
must be declared before the other, and the other is therefore invalid at that time Perhaps there is a work around? Mike On Nov 29, 2:56 pm, Karen Tracey <kmtra...@gmail.com> wrote: > On Sat, Nov 28, 2009 at 11:50 PM, adelaide_mike <mike.ro...@internode.on.net > > > > >

How to list all parents and their children if any?

2009-11-28 Thread adelaide_mike
I have three models: class Connector(models.Model): connectorname = models.CharField(max_length=32) class Cable(models.Model): cablename = models.CharField(max_length=32) class Node(models.Model): connector = models.ForeignKey(Connector) cable = models.ForeignKey(Cable)

Setting a fontName in a style

2009-11-26 Thread adelaide_mike
One final question if I may (well I hope its the last). In my standard report generating view I need to use Arial font (for example). I have studied the reportlab docs (Paragraphs chapter) for hours and tried all sorts of guesses as to how to do it. Nothing I have tried works. My fault. Now

Error when generating PDF

2009-11-26 Thread adelaide_mike
In my report generating view I have this (snip): if tablename == 'Area': areas = Area.objects.all() data.append(['Code','Name','Description']) for area in areas: data.append([ Paragraph(area.area, normalstyle, bulletText=None),

Re: How best to display a report?

2009-11-22 Thread adelaide_mike
Nevermind. Found the solution in a post from abrightwell. Thanks. Mike On Nov 22, 8:40 pm, adelaide_mike <mike.ro...@internode.on.net> wrote: > Hi Kenneth, and thanks for the reference.  I must admin I did not > think of looking int he Django docs for ReportLab related stuff. &

Re: How best to display a report?

2009-11-22 Thread adelaide_mike
able to prodice the pdf I want. I do not see how to incorporate this technology into the given example. Perhaps someone has done this and can give me the next pointer? Mike On Nov 22, 9:30 am, Kenneth Gonsalves <law...@au-kbc.org> wrote: > On Sunday 22 Nov 2009 3:38:24 am adelaide_m

How best to display a report?

2009-11-21 Thread adelaide_mike
Please excuse my lack of knowledge about the following. (If I knew the answer, I would not be asking...) Django 1.0.2 being used to create, manage and report on data in tables. I am using ReportLab to generate a .pdf which I store with a known name in a sub-directory. I have seen websites

Django and reportlab table question

2009-11-16 Thread adelaide_mike
I am attempting to user ReportLab with Django to make a report displaying my data in a tabular format. An example model is: class Vehicle(models.Model): ve_name = models.CharField(max_length=20) ve_type = models.CharField(max_length=20) My report generating view a copy of the example in

coercing to Unicode: need string or buffer, Connector found

2009-11-04 Thread adelaide_mike
Hi. Still learning, slowly. This is Django 1.0.2 The relevant models are Unit, Connector and Cable class Cable(models.Model): cable = models.CharField(max_length=8, blank=False) desc = models.CharField(max_length=128, blank=True) cabletype = models.ForeignKey(Cabletype, blank=True,

Re: How to get a queryset?

2009-10-19 Thread adelaide_mike
, allow me to achieve this. I will investigate your itertools suggestion. Mike On Oct 20, 8:38 am, Max Battcher <m...@worldmaker.net> wrote: > adelaide_mike wrote: > > Hi > > My models are, essentially : > > class Cable(models.Model): > >     cable = models.Ch

How to get a queryset?

2009-10-19 Thread adelaide_mike
Hi My models are, essentially : class Cable(models.Model): cable = models.CharField(max_length=8) class Connector(models.Model): connector = models.CharField(max_length=8) class Node(models.Model): cable = models.ForeignKey(Cable) connector = models ForeignKey(Connector) So, a

Re: How to change name for model in Admin?

2009-10-03 Thread adelaide_mike
On Oct 4, 2:11 am, Nan <ringe...@gmail.com> wrote: > Yes. > > class Foo(models.Model): >     # field definitions here >     class Meta: >         verbose_name = 'Bar' > > See > also:http://docs.djangoproject.com/en/dev/ref/models/options/#ref-models-o... > >

How to change name for model in Admin?

2009-10-03 Thread adelaide_mike
Hi again. I have made a couple of confusing choices for table names in my database. I do not really want to change them in the PostgreSQL database. Can I change the labels given to them in the Admin. For example in the list of administratable tables and the pages that follow when doing add or

Re: How to pass values between views/templates

2009-10-02 Thread adelaide_mike
My only dissatisfaction is that other contributors to this list seem to do almost anything with very few lines of code, whereas I am using many. And, being a newbie I naturally worry that I am on the wrong pathway, having missed the turning. Thanks to both for your reassurance. Mike On Oct 3,

How to pass values between views/templates

2009-10-02 Thread adelaide_mike
Hi In my app the user needs to drill down through a series of templates and their views to identify a house. We start with the city, then the street and finally the house, in each case chosen from a rendering of the possible values selected from the relevant database table. I have all this

Re: How to refer to a data item?

2009-09-19 Thread adelaide_mike
Django itself uses the term "column" as witnessed by an exception I just raised reading: no such column. Mike On Sep 17, 11:34 pm, Javier Guerra <jav...@guerrag.com> wrote: > On Thu, Sep 17, 2009 at 9:04 AM, adelaide_mike > > <mike.ro...@internode.on.net> wro

Order_by on greatgrandparent.name

2009-09-19 Thread adelaide_mike
I have a multi-table model, each table related to the next by a one to many foreign key. I wish to do: q = Child.objects.filter(date__gte=startdate).order_by ('parent.grandparent.greatgrandparent__name') This raises an exception no such column: parent.grandparent.greatgrandparent__name Is

Foreign Key selector on page does not preset

2009-09-19 Thread adelaide_mike
Hi. In my Django 1.0.2 app I have a parent and a child table. On my child ModelForm a selector field for the parent is automatically provided. The form also displays a "date" field representing a column in the child model. In my view I have: form = MyForm(initial={'date':

Re: How to refer to a data item?

2009-09-17 Thread adelaide_mike
or not certain fields depending on whether their value changed or did not, in each successive "row". Thanks for your clear explanation. It helped greatly. Mike On Sep 17, 10:26 pm, Daniel Roseman <dan...@roseman.org.uk> wrote: > On Sep 17, 1:48 pm, adelaide_mike <mike.ro...@i

How to refer to a data item?

2009-09-17 Thread adelaide_mike
Hello I, a newbie to Django and Python, have a model thus: class Person(model.Models): first_name = models.CharField(max_length=32) last_name = models.CharField(max_length=32) In my view.py can do this, to illustrate my question: def testing(request): persons = Person.objects.all()

Make a bold row in a table

2009-09-12 Thread adelaide_mike
Django 1.0.2 In the following template I intend to make rows that have an empty second column bold. Hence trying 2 in row. My syntax is wrong due to inexperience with Python, and possibly my methodology also. {% extends "base.html" %} {% block content %} Agent summary report The most

Re: Confused ForeignKey ?

2009-09-10 Thread adelaide_mike
Oops - my mistake within admin.py. Sorry to waste bandwidtrh. Mike On Sep 11, 10:36 am, adelaide_mike <mike.ro...@internode.on.net> wrote: > Hi > I am just getting into my second project/app but have run into a > problem I have not seen before.  My models.py has the follo

Confused ForeignKey ?

2009-09-10 Thread adelaide_mike
Hi I am just getting into my second project/app but have run into a problem I have not seen before. My models.py has the following: class Cabletype(models.Model): cabletype = models.CharField(max_length=16, blank=False, unique=True) desc = models.TextField() def __unicode__(self):

Django, Blueprintcss and a data array

2009-09-04 Thread adelaide_mike
I (newbie) am looking at using Blueprintcss to display a 7 column array of data. The data is passed to the template in "dataarray". I have tested the code below without the section and the column headings display correctly. Adding the section to the code causes an error at {% for row in

Re: Django 1.0.2 + CSS how to?

2009-08-30 Thread adelaide_mike
Thank you Mike Ramirez. [1] makes a difference. I now see the css taking effect. Mike On Aug 30, 8:55 am, Mike Ramirez <gufym...@gmail.com> wrote: > On Saturday 29 August 2009 04:35:11 pm adelaide_mike wrote: > > > > > As a very newbie I am struggling to understand

Django 1.0.2 + CSS how to?

2009-08-29 Thread adelaide_mike
As a very newbie I am struggling to understand how to use CSS. I read in http://docs.djangoproject.com/en/dev/topics/forms/media/#paths-in-media-definitions that I need to write: class Media: css = { 'screen': ('pretty.css',), 'print': ('newspaper.css',) } for

Change my model names - consequences?

2009-08-26 Thread adelaide_mike
After adding a model to my Django 1.0.2 app I would like to change the names of two models. Will the syncdb take care of this for me? I anticipate I will need to change the table names in PostgreSQL. Any caveats? Any hints? TIA Mike --~--~-~--~~~---~--~~ You

How to get DATABASE_NAME

2009-08-16 Thread adelaide_mike
In my reporting function I need to have: If DATABASE_NAME = x: #do this Else: #do the other How can I obtain that name, which is established in settings.py? Mike --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: How to tidy up data returned by raw sql has u'blahblah'

2009-08-15 Thread adelaide_mike
indicators. I have not found more than a paragraph or two concerning the use of raw sql. Any pointers would be appreciated. Thanks Mike On Aug 15, 5:37 pm, Daniel Roseman <dan...@roseman.org.uk> wrote: > On Aug 15, 5:23 am, adelaide_mike <mike.ro...@internode.on.net> wrote: > >

How to tidy up data returned by raw sql has u'blahblah'

2009-08-14 Thread adelaide_mike
My raw sql returns a list of data very nicely, except that character cols have data surrounded by u'', and dates have datetime.date (2009-01-01) etc. In my newbie innocence I have not discovered how to remove these extras. Any clues? Thanks Mike

raw sql Operational Error

2009-08-12 Thread adelaide_mike
Working in Django 1.0.2 with PostgreSQL backend the following produces an error: Operational Error at /report/agent_summary/ near "ON": syntax error The SQL works if run in pgadminIII but with %s replaced by "2009-01-01". Must be a newbie error somewhere. def agent_summary(request):

Calculating a date

2009-08-05 Thread adelaide_mike
This should really be a Python enquiry, but I am sure someone will know: I need to calculate the date 12 weeks before today. What is the best way? TIA Mike --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django

Django 1.0.2 ordering fireign keys

2009-07-22 Thread adelaide_mike
Hi Lets say I have two models Street and House, related by a foreign key thus: class House(models.Model): house_number = models.CharField(max_length=16) street = models.ForeignKey(Street) In the admin area, the Change House page displays a list widget by which to select the street. I

'str' object not callable

2009-07-18 Thread adelaide_mike
Hi Can some kind soul tell me what, in principle, this means: 'str' object not callable ? It seems to be associated with urls.py Newbie just needs some additional words to help. Have looked at the history of this, which did not help. I do not want to know why the error is arising, I simply

Re: Add extra field to ModelForm

2009-07-11 Thread adelaide_mike
009 at 10:08 AM, adelaide_mike <mike.ro...@internode.on.net > > > > > wrote: > > > Django 1.0.2.  My ModelForm concerns (and is based on the table for) > > advertisements for houses placed by real estate agents. > > > I need the agent widget (which by defaul

Add extra field to ModelForm

2009-07-11 Thread adelaide_mike
Django 1.0.2. My ModelForm concerns (and is based on the table for) advertisements for houses placed by real estate agents. I need the agent widget (which by default is a pick list of all agents), to be modified on the form to be either (depending on circumstances) a non-editable preset display

Re: duplicate primary key problem

2009-07-10 Thread adelaide_mike
Very cool, Rajesh D. Thanks. Mike On Jul 11, 12:31 am, Rajesh D <rajesh.dha...@gmail.com> wrote: > On Jul 10, 11:06 am, adelaide_mike <mike.ro...@internode.on.net> > wrote: > > > > > I suspect this is a question more for a PostgreSQL list, but please > &

duplicate primary key problem

2009-07-10 Thread adelaide_mike
I suspect this is a question more for a PostgreSQL list, but please bear with me. In Django 1.0.2 working with PostgreSQL 8.3 I have a model with an implied pkey. PostgreSQL syas this: CREATE TABLE wha_property ( id serial NOT NULL, propnum character varying(16) NOT NULL, beds integer,

Re: Django 1.0.2 foreign key display puzzle

2009-06-23 Thread adelaide_mike
(that I know is set). Thanks for your reply. Mike On Jun 23, 1:08 pm, Kenneth Gonsalves <law...@thenilgiris.com> wrote: > On Tuesday 23 June 2009 09:14:01 adelaide_mike wrote: > > > form = MyModelForm(initial={'myforeignkeyfieldname': myvalue}) > > assuming the foreignkey valu

Django 1.0.2 foreign key display puzzle

2009-06-22 Thread adelaide_mike
Having failed to get any takers to my earlier posts on this, I will keep it v. short: How do I preset a foreign key value in a Model Form? form = MyModelForm(initial={'myforeignkeyfieldname': myvalue}) does not do it. Surely this can be done? Mike

Preset foreign key in Model Form

2009-06-18 Thread adelaide_mike
Try again. I am new to Django and the web, so I do not know all the right vocabulary. Sorry. I need my ModelForm to be displayed, for creation of a new record, with a date field and a foreign key (pointing to the Source table) selector list aleady populated. I am doing this: form =

Re: How to preset a foreign key choice field in a ModelaaForm?

2009-06-17 Thread adelaide_mike
Oops werong action - incomplete message. I have a ModelForm: class ListingForm(ModelForm): class Meta: model = Listing that has a method that, for a new record, should set the ForeighKey field "source" to an object identified in the UserProfile. The "date" value is

How to preset a foreign key choice field in a ModelaaForm?

2009-06-17 Thread adelaide_mike
if request.method == 'GET': if listing_id > '0': listing=Listing.objects.get(pk=listing_id) form = ListingForm(instance=listing) else: print "In listings GET source=",

How to preset a value to a field on a ModelForm

2009-06-15 Thread adelaide_mike
Hi Newbie trying to preset a field on a form where the object is to be inserted. The snippet below does not do it. class FooForm(ModelForm): class Meta: model = Foo if request.method == 'GET': if foo_id > '0':

Re: Searching posts to this group

2009-06-09 Thread adelaide_mike
Hmm. Sorry. I see it, for this list. But is there a way for the Snippets? On Jun 10, 6:12 am, adelaide_mike <mike.ro...@internode.on.net> wrote: > Is there a way to search for a word in the Subject line or the text of > posts to this group?  Same with the list of snippets.  Sca

Searching posts to this group

2009-06-09 Thread adelaide_mike
Is there a way to search for a word in the Subject line or the text of posts to this group? Same with the list of snippets. Scanning twenty at a time (out of 1500 or more) seems a long way to see what exists. Mke --~--~-~--~~~---~--~~ You received this message

Newb - Link users_extra_data table to built-in Users table - how?

2009-06-09 Thread adelaide_mike
Hi I need to store additional info about my users. The following in models.py raises a name error due to User. Have tried auth_users and Users as well. No joy. class User_settings(models.Model): user = models.ForeignKey(User,unique=True) current_date =

Re: Newbie - record parent ID in child data entered by ModelForm

2009-06-05 Thread adelaide_mike
different thinking c/w "normal" desktop apps. Still heaps to learn. Thanks again. Mike On Jun 5, 6:15 pm, TiNo <tin...@gmail.com> wrote: > On Fri, Jun 5, 2009 at 11:04, adelaide_mike > <mike.ro...@internode.on.net>wrote: > > >  Exception Value: 'Prope

Re: Newbie - record parent ID in child data entered by ModelForm

2009-06-05 Thread adelaide_mike
' object does not support item assignment On Jun 5, 5:15 pm, Daniel Roseman <roseman.dan...@googlemail.com> wrote: > On Jun 5, 5:33 am, adelaide_mike <mike.ro...@internode.on.net> wrote: > > > > > Another "in principle" question.  My Street model is the par

Newbie - record parent ID in child data entered by ModelForm

2009-06-04 Thread adelaide_mike
Another "in principle" question. My Street model is the parent of my Property model, many to one via foreign key. User selects the street and I store it in request.session. User then gets to enter the property details in this form: class PropertyForm(ModelForm): class Meta:

Newb - how to remember the main course while we select the dessert

2009-06-04 Thread adelaide_mike
My latest problem can be illustrated thus: In the first form we select the main course - spam or eggs. In the next form we select the dessert - ice cream or mud cake, and in the third form we select the after-dimmer drink - tea or coffee. How is the proper way to remember the choice made in

Newb problem with form wizard

2009-06-03 Thread adelaide_mike
My non-wizard templates are in this directory, all working as expected: my_wha_templates/wha/ I have built a form wizard in my whasite.wha.forms.py exactly as per the docs. I have pasted the suggested template HTML into a file: my_wha_templates/wha/contact/forms/wizard.html My urls.py is

Re: Newbie pls help with stored values

2009-06-03 Thread adelaide_mike
zard/ > I guess > > On Jun 3, 8:04 am, adelaide_mike <mike.ro...@internode.on.net> wrote: > > > I am a newbie with Django and web stuff, but have long experience with > > desktop databases. > > > In Django my user runs through a series of template.htmls choosing a

Newbie pls help with stored values

2009-06-03 Thread adelaide_mike
I am a newbie with Django and web stuff, but have long experience with desktop databases. In Django my user runs through a series of template.htmls choosing a particular great great grandchild object, a house. Then she must select a sales agent object. Just in general, how do I arrange for the

Re: Newbie Django 1.0 help with create object, uopdate object

2009-06-01 Thread adelaide_mike
uot;if request is a POST" check, so that if the form.is_valid() check fails, >   # we go back and show the HTML again with the form containing errors. >   return render__to_response('contests/edit_result.html', >                                 {'form': form}) > > Hope that helps! > > Ti

Re: Newbie Django 1.0 help with create object, uopdate object

2009-06-01 Thread adelaide_mike
data" labels. I conclude the line: form = PropertyForm(request.POST) does not populate the validation form. What have I got wrong here? TIA Mike On Jun 1, 8:14 pm, Tim Sawyer <list.dja...@calidris.co.uk> wrote: > On Monday 01 June 2009 01:38:30 adelaide_mike wrote: > &g

Newbie Django 1.0 help with create object, uopdate object

2009-05-31 Thread adelaide_mike
I found a really clear explanation of creating and updating database objects in SAMS TeachYourself Django, but it appears to be for v 0.96. I have looked at "Creating forms from models" in the documentation, and about one-third the way down it shows the following: # Create a form instance from

Re: Newbie, hierarchical models, url.py problem

2009-05-30 Thread adelaide_mike
Thanks Gabriel. I think it would be good if the tutorial included a three-level hierarchy sowing how to handle the url.py and views.py for the third layer. Anyway, I now understandone step more. Thanks and regards On May 31, 11:46 am, Gabriel <gabriel@gmail.com> wrote: > adel

Newbie, hierarchical models, url.py problem

2009-05-30 Thread adelaide_mike
I have model classes Suburb, Street ,Property and Event. Each has a name , a foreign key to the model above, and the id provided by default. In the admin everything is fine. The template address.html has a search field and returns a startswith query that generates streets. Clicking a line in

Re: How to include parent name in list of children?

2009-05-27 Thread adelaide_mike
Thank you Tom and Daniel. Starting to see some light here. Mike On May 28, 1:25 am, Daniel Roseman <roseman.dan...@googlemail.com> wrote: > On May 27, 2:59 pm, Tom Evans <tevans...@googlemail.com> wrote: > > > > > On Wed, 2009-05-27 at 06:27 -0700, adelaide_mike w

How to include parent name in list of children?

2009-05-27 Thread adelaide_mike
Very beginner here. My model has two classes, Suburb, the parent, and Street, the child: class Suburb(models.Model): suburb_name = models.CharField(max_length=72) postcode = models.CharField(max_length=4) def __unicode__(self):

Field xyz that is missing from the form

2009-05-25 Thread adelaide_mike
Hi Be gentle with me. I am on my 7th day with Django. I have completed the tutorial for 1.0.2 and have started building an app that has three models in a hierarchy, Suburb, Street and Property. All are available in the basic Admin, working very well. Now I emulated the tutorial by building a

Re: Django 1.0.2 show grandparent in admin

2009-05-23 Thread adelaide_mike
Spot on. Thanks Karen On May 24, 11:08 am, Karen Tracey <kmtra...@gmail.com> wrote: > On Sat, May 23, 2009 at 9:57 PM, adelaide_mike > <mike.ro...@internode.on.net>wrote: > > > > > > > First, please forgive my post to the Django developers group.  I mis-

Django 1.0.2 show grandparent in admin

2009-05-23 Thread adelaide_mike
First, please forgive my post to the Django developers group. I mis- understood the terminology. I am a total beginner in Django but have long experience with Omnis. My data stores addresses in three tables named Suburb, (columns are id, name) Street, (columns are id, name, suburb_id) Property