Re: Django .91 issue

2007-07-24 Thread [EMAIL PROTECTED]

Awwh, Yes! Brainfart! Thank you so much.  I'm glad new django doesn't
use this method anymore.

Thanks again.


On Jul 24, 2:22 pm, oggie rob <[EMAIL PROTECTED]> wrote:
> With 0.91, you use the "magic" name for db-api operations, rather than
> the model name. For example:
>
> from django.models import my_model_module
> my_model_module.somemodels.get_object(...)
>
> I think sometime before 0.91 was finished, the directory structure
> changed, so you might access your models slightly differently, but you
> will still need a lower-case, pluralized name for the lookup.
>
>  -rob
>
> On Jul 24, 10:52 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > Hi I have a csv file that I am reading in and I want to test to make
> > sure that there are no duplicate records so I do something like this:
>
> > # My Checker
>
> > from csv import reader
> > import datetime
> > import re
> > import time
> > from time import strptime
> > from django.models.somemodel import SomeModel
> > from some_site import settings
>
> > data = '../data/somefile.csv'
> > table = reader(open(data))
> > header = table.next()
>
> > for row in table:
>
> > company_name = len(row) > 3 and row[3] or ''
> > mailing_address = len(row) > 4 and row[4] or ''
> > print company_name
>
> > test = SomeModel.get_object(company_name__exact=company_name,
> > mailing_address__exact=mailing_address)
>
> > It crashes on the last line with this error:
>
> > AttributeError: 'module' object has no attribute 'get_object'
>
> > from what it look like to me is that it is trying to associate the
> > get_object with an attribute in the model class.
>
> > Is there an easier way to  test for existing attribute names on the
> > database.  There can be more than one company name but only one
> > address per company name is allowed in the table.
>
> > Any suggestions? Solutions?


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django .91 issue

2007-07-24 Thread oggie rob

With 0.91, you use the "magic" name for db-api operations, rather than
the model name. For example:

from django.models import my_model_module
my_model_module.somemodels.get_object(...)

I think sometime before 0.91 was finished, the directory structure
changed, so you might access your models slightly differently, but you
will still need a lower-case, pluralized name for the lookup.

 -rob

On Jul 24, 10:52 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Hi I have a csv file that I am reading in and I want to test to make
> sure that there are no duplicate records so I do something like this:
>
> # My Checker
>
> from csv import reader
> import datetime
> import re
> import time
> from time import strptime
> from django.models.somemodel import SomeModel
> from some_site import settings
>
> data = '../data/somefile.csv'
> table = reader(open(data))
> header = table.next()
>
> for row in table:
>
> company_name = len(row) > 3 and row[3] or ''
> mailing_address = len(row) > 4 and row[4] or ''
> print company_name
>
> test = SomeModel.get_object(company_name__exact=company_name,
> mailing_address__exact=mailing_address)
>
> It crashes on the last line with this error:
>
> AttributeError: 'module' object has no attribute 'get_object'
>
> from what it look like to me is that it is trying to associate the
> get_object with an attribute in the model class.
>
> Is there an easier way to  test for existing attribute names on the
> database.  There can be more than one company name but only one
> address per company name is allowed in the table.
>
> Any suggestions? Solutions?


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---