Ok, so I feel a bit silly, but it was because I had a column name in
my db called Discount% and I am assuming the % is screwing it up.

Now the question becomes how do I escape the % or do I have to rename
my db column (please god not the latter as that would entail a whole
mess of rewriting stuff). I already tried some unicode stuff but I'm
fairly untrained in that area. Any ideas?

Thanks

Greg

On Jun 18, 4:41 pm, geraldcor <gregco...@gmail.com> wrote:
> Hello all,
>
> I am trying to work with a legacy database and I ran inspectdb and
> have a model with the 2 tables that I want to use. The first table,
> the main table is not working at all. The second table which is
> related via a foreign key seems to be working just fine. Here are the
> symptoms:
>
> In the shell I import my tables, to c=Customers.objects.all()
> c
> [] which is an empty dictionary or tuple (sorry for the confusion)
>
> however if I do t=Tblcontacts.objects.all()
> t
> [big long list of Tblcontacts objects] and I can even utilize this
> data in a template via a view.
>
> I can't figure out why one would work while the other does not.
>
> here are the first view field definitions in my model in case that
> offers any insight.
>
> #The customers table that doesn't work.
> class Customers(models.Model):
>     idflcustomernum = models.AutoField(primary_key=True,
> db_column='IDFLCustomerNum') # Field name made lowercase.
>     typenum = models.IntegerField(null=True, db_column='TypeNum',
> blank=True) # Field name made lowercase.
>     type = models.CharField(max_length=255, db_column='Type',
> blank=True) # Field name made lowercase.
>     billto = models.IntegerField(null=True, db_column='BillTo',
> blank=True) # Field name made lowercase.
>
> #The contacts table that works
> class Tblcontacts(models.Model):
>     contactnumber = models.AutoField(primary_key=True,
> db_column='ContactNumber') # Field name made lowercase.
>     clientid = models.ForeignKey(Customers, db_column='ClientID') #
> Field name made lowercase.
>     contactname = models.CharField(max_length=50,
> db_column='ContactName', blank=True) # Field name made lowercase.
>     title = models.CharField(max_length=50, db_column='Title',
> blank=True) # Field name made lowercase.
>     salutation = models.CharField(max_length=50,
> db_column='Salutation', blank=True) # Field name made lowercase.
>
> Thank you for all past and future help
>
> Greg
--~--~---------~--~----~------------~-------~--~----~
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 email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to