Re: Re: django/core/meta

2006-09-01 Thread James Bennett

On 9/1/06, brian corrigan <[EMAIL PROTECTED]> wrote:
> the unique fields are not created.
> the same happens for unique_together=(("distribution_list",
> "subscriber"),)

I think the confusion here is over the word 'meta'.

Once upon a time, you defined models by starting out with:

from django.core import meta

But *within* the model itself, you specified extra options by adding
an inner class called 'META', like so:

from django.core import meta

class MyModel(meta.Model):
name = meta.CharField(maxlength=250)
blurb = meta.TextField()

class META:
unique_together = (('name', 'blurb'),)

'META', here, has nothing whatsoever to do with the class 'django.core.meta'.

Now, you do this:

from django.db import models

class MyModel(models.Model):
name = models.CharField(maxlength=250)
blurb = models.TextField()

Class Meta:
unique_together = (('name', 'blurb'),)

In other words, inside the model you define a class called 'Meta'.
This isn't an imported class, and there is no 'meta' class anywhere in
Django that you need to pull in -- it's a class that *you* create,
*inside* your model class.

-- 
"May the forces of evil become confused on the way to your house."
  -- George Carlin

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: django/core/meta

2006-09-01 Thread brian corrigan

Cheers Chris,

Finally saw that but I have tried it and have the following problem...

The code:

distribution_list = models.ForeignKey(DistributionList)
subscriber = models.CharField(maxlength=30)
unique_together=((distribution_list, subscriber),)

gives the following sql

"id" serial NOT NULL PRIMARY KEY,
"distribution_list_id" integer NOT NULL REFERENCES
"textnotifier_distributionlist" ("id"),
"subscriber" varchar(30) NOT NULL

the unique fields are not created.
the same happens for unique_together=(("distribution_list",
"subscriber"),)

Is there something I need to do or am leaving out?

Thanks again

Brian


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: django/core/meta

2006-09-01 Thread Chris Long

See:
http://www.djangoproject.com/documentation/model_api/#unique-together

Cheers,

Chris


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Re: django/core/meta

2006-09-01 Thread James Bennett

On 9/1/06, brian corrigan <[EMAIL PROTECTED]> wrote:
> Oops... Sorry about that, airhead moment. Is there a similar function
> to unique_together now that can be used?

Take a look at the model documentation[1]; most of the names of the
'meta' and 'admin' options on models haven't changed, they've just
moved -- now when you're defining a model you start with 'from
django.db import models' instead of 'from django.core import meta'.

[1] http://www.djangoproject.com/documentation/model_api/

-- 
"May the forces of evil become confused on the way to your house."
  -- George Carlin

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: django/core/meta

2006-09-01 Thread brian corrigan


Jacob Kaplan-Moss wrote:
> On Sep 1, 2006, at 9:17 AM, brian corrigan wrote:
> > However with the project I'm working on, I can't change the Django
> > version I'm working on. I have tried doing an SVN update on the core
> > directory but meta was not included in it. Is there anyway I can
> > download the relevant files/folders?
>
> What I was trying to say -- sorry if it wasn't clear -- is that in
> Django trunk django.core.meta no longer exists; it's been replaced
> (as explained in those pages I linked to).

Oops... Sorry about that, airhead moment. Is there a similar function
to unique_together now that can be used?


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: django/core/meta

2006-09-01 Thread Jacob Kaplan-Moss

On Sep 1, 2006, at 9:17 AM, brian corrigan wrote:
> However with the project I'm working on, I can't change the Django
> version I'm working on. I have tried doing an SVN update on the core
> directory but meta was not included in it. Is there anyway I can
> download the relevant files/folders?

What I was trying to say -- sorry if it wasn't clear -- is that in  
Django trunk django.core.meta no longer exists; it's been replaced  
(as explained in those pages I linked to).

If you want to stick with an older version of Django, check out the  
sidebar at http://www.djangoproject.com/download/ to download a  
previous release.

Jacob

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: django/core/meta

2006-09-01 Thread Adrian Holovaty

On 9/1/06, brian corrigan <[EMAIL PROTECTED]> wrote:
> However with the project I'm working on, I can't change the Django
> version I'm working on. I have tried doing an SVN update on the core
> directory but meta was not included in it. Is there anyway I can
> download the relevant files/folders?

Hey Brian,

A "svn update" won't do you any good, because that gets you the
*latest* version of Django, which no longer uses django.core.meta.
What you want to do is one of these two things:

  * Get version 0.91 from http://www.djangoproject.com/download/ .

  * Get the latest "0.91-bugfixes" release from
http://code.djangoproject.com/svn/django/branches/0.91-bugfixes/ .
This is a branch devoted to maintaining the 0.91 version of code
(which is what you're using), purely to fix big bugs.

Adrian

-- 
Adrian Holovaty
holovaty.com | djangoproject.com

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: django/core/meta

2006-09-01 Thread brian corrigan

Also...

I have downloaded the .tar.gz file from the django site and browsed to
django/core and again there is no mention of meta.

Is there something I'm missing?

If there is no work around this for me, is there any other way I can
implement the following code...

distribution_list = meta.ForeignKey(DistributionList)
subscriber = meta.CharField(maxlength=30)
class META:
unique_together=(("distribution_list", "subscriber"),)

?

It is the unique_together that I need to implement.


Thanks in advance 

Brian


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: django/core/meta

2006-09-01 Thread brian corrigan

Thanks Jacob,

However with the project I'm working on, I can't change the Django
version I'm working on. I have tried doing an SVN update on the core
directory but meta was not included in it. Is there anyway I can
download the relevant files/folders? 

Thanks again,


Brian


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: django/core/meta

2006-09-01 Thread Jacob Kaplan-Moss

Hi Brian --

Django's actually undergone some pretty sweeping changes since you  
last played with it.  Probably the best place to start is by reading  
the 0.95 release notes (http://www.djangoproject.com/documentation/ 
095_release_notes/) for an overview of what's changed.

That page will eventually lead you to http://code.djangoproject.com/ 
wiki/RemovingTheMagic, which describes is gory details all the  
changes since last time you checked out Django.

Jacob

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



django/core/meta

2006-09-01 Thread [EMAIL PROTECTED]

Hi all,

I dowloaded django for the first time about a month and a half ago and
today tried this line:

from django.core import meta

but keep getting this error:

Error: cannot import name meta. Are you sure your INSTALLED_APPS
setting is correct?

When I browsed the directory I found that the meta folder does not
exist in my django/core. Do I have to download this from somewhere or
move it from another location?

Any help you can give me would be great.

Cheers

Brian Corrigan


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---