Re: ManyToMany field creation problem

2013-12-09 Thread Mrinmoy Das

Hi,

Sorry Daniel for bothering, my understanding of many to many field was 
pretty shaky :)

On Monday, December 9, 2013 5:02:13 PM UTC+5:30, Tom Evans wrote:
>
> On Fri, Dec 6, 2013 at 9:42 AM, Mrinmoy Das 
>  
> wrote: 
> > I cant get the field 
> > 
> > 
> > unit_price = models.ManyToManyField(UnitType,through=UnitPrice, 
> blank=True, 
> > null=True) 
> > 
> > in Property table. 
> > 
> > After adding the field, I tried doing a schemamigration, but output says 
> > "No change has been done" 
> > 
>
> This is because adding that field results in no change - no columns 
> need to be added to any tables, no columns need to be removed from any 
> tables and no tables need to be created. 
>
> Adding the unit_price field to Property simply informs Django to 
> create the appropriate properties on the python models so that you can 
> access the related models, and so South, being a tool for managing 
> database schema changes, has nothing to do. 
>
> Cheers 
>
> Tom 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/92ef6686-d643-4a23-8edb-8c7727f7b6c4%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ManyToMany field creation problem

2013-12-09 Thread Tom Evans
On Fri, Dec 6, 2013 at 9:42 AM, Mrinmoy Das  wrote:
> I cant get the field
>
>
> unit_price = models.ManyToManyField(UnitType,through=UnitPrice, blank=True,
> null=True)
>
> in Property table.
>
> After adding the field, I tried doing a schemamigration, but output says
> "No change has been done"
>

This is because adding that field results in no change - no columns
need to be added to any tables, no columns need to be removed from any
tables and no tables need to be created.

Adding the unit_price field to Property simply informs Django to
create the appropriate properties on the python models so that you can
access the related models, and so South, being a tool for managing
database schema changes, has nothing to do.

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1L4WqfCmhEZK4%2BqGVAbNOFdkfqqXqJ3HOqA567d1sRqxA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ManyToMany field creation problem

2013-12-06 Thread Daniel Roseman
On Friday, 6 December 2013 19:15:32 UTC, Mrinmoy Das wrote:
>
> Hi Daniel,
>
> I can always add a field manually, question is why does not south does it. 
> :)
>
> Mrinmoy Das
> http://goromlagche.in/
>

Sigh. One last time, then.

There is no other field. A many-to-many relationship is *only* a through 
table. Nothing else needs to be created, and nothing else will be created.
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/88fee9e9-4e88-4937-99b2-c5261fffb0ba%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ManyToMany field creation problem

2013-12-06 Thread Mrinmoy Das
Hi Daniel,

I can always add a field manually, question is why does not south does it.
:)

Mrinmoy Das
http://goromlagche.in/


On Sat, Dec 7, 2013 at 12:09 AM, Daniel Roseman wrote:

> As I've already said, you don't need any help. If the through table is
> created, *that is all you need*.
> --
> DR.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/8ef938a7-13f2-4b4f-9a2d-43c809f8eacb%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFWA-MOUp2Zview8Uk%3DRafxhEF737cknLggPh7s7D76zOCtUtw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ManyToMany field creation problem

2013-12-06 Thread Daniel Roseman
As I've already said, you don't need any help. If the through table is created, 
*that is all you need*.
-- 
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8ef938a7-13f2-4b4f-9a2d-43c809f8eacb%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ManyToMany field creation problem

2013-12-06 Thread Mrinmoy Das
Any help guys??

Mrinmoy Das
http://goromlagche.in/


On Fri, Dec 6, 2013 at 8:21 PM, Chi Tak Lam  wrote:

> I think you should do a
>
> python manage.py migrate property
>
> after
>
> python manage.py schemamigration property --auto?
>
>
> On Friday, December 6, 2013 3:44:27 PM UTC+8, Mrinmoy Das wrote:
>>
>> Hi,
>>
>> I have these tables
>>
>>
>> on apps/common/models.py
>>
>>
>> class UnitType(models.Model):
>> title = models.CharField(max_length=50)
>>
>> def __unicode__(self):
>> return u'%s' % self.title
>>
>> class UnitPrice(models.Model):
>> project = models.ForeignKey('property.Property')
>> unit_type = models.ForeignKey(UnitType)
>>
>> five_year_target_price = models.CharField(max_length=50, blank=True,
>> null=True)
>> per_sqft_price = models.CharField(max_length=50, blank=True,
>> null=True)
>> total_price = models.CharField(max_length=50, blank=True, null=True)
>>
>> total_area = models.CharField(max_length=140, blank=True, null=True)
>> carpet_area = models.CharField(max_length=140, blank=True, null=True)
>>
>>  def __unicode__(self):
>> return u'%s' % self.title
>>
>>
>>
>> and on apps/property/models.py
>>
>>
>> class Property(Base):
>> .
>> .
>> unit_price = models.ManyToManyField(UnitType,through=UnitPrice,
>> blank=True, null=True)
>>
>> .
>> .
>>
>>
>>
>> after adding the unit price field I did  a migration
>>
>>   python manage.py schemamigration property --auto
>>
>> I am getting this output
>>
>>Nothing seems to have changed.
>>
>> the through table is created,  i have checked that.
>>
>>
>>  Table "public.common_unitprice"
>>  Column |  Type
>> |   Modifiers
>> ++--
>> -
>>  id | integer| not null default
>> nextval('common_unitprice_id_seq'::regclass)
>>  project_id | integer| not null
>>  unit_type_id   | integer| not null
>>  five_year_target_price | character varying(50)  |
>>  per_sqft_price | character varying(50)  |
>>  total_price| character varying(50)  |
>>  total_area | character varying(140) |
>>  carpet_area| character varying(140) |
>> Indexes:
>> "common_unitprice_pkey" PRIMARY KEY, btree (id)
>> "common_unitprice_project_id" btree (project_id)
>> "common_unitprice_unit_type_id" btree (unit_type_id)
>> Foreign-key constraints:
>> "project_id_refs_id_7c43d44c" FOREIGN KEY (project_id) REFERENCES
>> property_property(id) DEFERRABLE INITIALLY DEFERRED
>> "unit_type_id_refs_id_1a1f3765" FOREIGN KEY (unit_type_id)
>> REFERENCES common_unittype(id) DEFERRABLE INITIALLY DEFERRED
>>
>>
>>
>>
>>
>>
>> Any help??
>>
>>
>> Mrinmoy Das
>> http://goromlagche.in/
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/96bce83f-11bf-453b-b6d9-db2b8644c6c4%40googlegroups.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFWA-MMsFzLvpAZpB0YgZ3L7RijXvKTz6cYR7g4bVdR%2BdzHJEg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ManyToMany field creation problem

2013-12-06 Thread Chi Tak Lam
I think you should do a 

python manage.py migrate property 

after 

python manage.py schemamigration property --auto?

On Friday, December 6, 2013 3:44:27 PM UTC+8, Mrinmoy Das wrote:
>
> Hi,
>
> I have these tables
>
>
> on apps/common/models.py
>
>
> class UnitType(models.Model):
> title = models.CharField(max_length=50)
>
> def __unicode__(self):
> return u'%s' % self.title
>
> class UnitPrice(models.Model):
> project = models.ForeignKey('property.Property')
> unit_type = models.ForeignKey(UnitType)
>
> five_year_target_price = models.CharField(max_length=50, blank=True, 
> null=True)
> per_sqft_price = models.CharField(max_length=50, blank=True, null=True)
> total_price = models.CharField(max_length=50, blank=True, null=True)
> 
> total_area = models.CharField(max_length=140, blank=True, null=True)
> carpet_area = models.CharField(max_length=140, blank=True, null=True)
>
>  def __unicode__(self):
> return u'%s' % self.title
>
>
>
> and on apps/property/models.py
>
>
> class Property(Base):
> .
> .
> unit_price = models.ManyToManyField(UnitType,through=UnitPrice, 
> blank=True, null=True)
>
> .
> .
>
>
>
> after adding the unit price field I did  a migration
>
>   python manage.py schemamigration property --auto
>
> I am getting this output
>
>Nothing seems to have changed.
>
> the through table is created,  i have checked that.
>
>
>  Table "public.common_unitprice"
>  Column |  Type  
> |   Modifiers   
>
> ++---
>  id | integer| not null default 
> nextval('common_unitprice_id_seq'::regclass)
>  project_id | integer| not null
>  unit_type_id   | integer| not null
>  five_year_target_price | character varying(50)  | 
>  per_sqft_price | character varying(50)  | 
>  total_price| character varying(50)  | 
>  total_area | character varying(140) | 
>  carpet_area| character varying(140) | 
> Indexes:
> "common_unitprice_pkey" PRIMARY KEY, btree (id)
> "common_unitprice_project_id" btree (project_id)
> "common_unitprice_unit_type_id" btree (unit_type_id)
> Foreign-key constraints:
> "project_id_refs_id_7c43d44c" FOREIGN KEY (project_id) REFERENCES 
> property_property(id) DEFERRABLE INITIALLY DEFERRED
> "unit_type_id_refs_id_1a1f3765" FOREIGN KEY (unit_type_id) REFERENCES 
> common_unittype(id) DEFERRABLE INITIALLY DEFERRED
>
>
>
>
>
>
> Any help??
>
>
> Mrinmoy Das
> http://goromlagche.in/
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/96bce83f-11bf-453b-b6d9-db2b8644c6c4%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ManyToMany field creation problem

2013-12-06 Thread Mrinmoy Das
I cant get the field

unit_price = models.ManyToManyField(UnitType,through=UnitPrice, blank=True,
null=True)

in Property table.

After adding the field, I tried doing a schemamigration, but output says
"No change has been done"



Mrinmoy Das
http://goromlagche.in/


On Fri, Dec 6, 2013 at 3:04 PM, Daniel Roseman wrote:

> On Friday, 6 December 2013 07:44:27 UTC, Mrinmoy Das wrote:
>>
>> Hi,
>>
>> I have these tables
>>
>>
>> on apps/common/models.py
>>
>>
>> class UnitType(models.Model):
>> title = models.CharField(max_length=50)
>>
>> def __unicode__(self):
>> return u'%s' % self.title
>>
>> class UnitPrice(models.Model):
>> project = models.ForeignKey('property.Property')
>> unit_type = models.ForeignKey(UnitType)
>>
>> five_year_target_price = models.CharField(max_length=50, blank=True,
>> null=True)
>> per_sqft_price = models.CharField(max_length=50, blank=True,
>> null=True)
>> total_price = models.CharField(max_length=50, blank=True, null=True)
>>
>> total_area = models.CharField(max_length=140, blank=True, null=True)
>> carpet_area = models.CharField(max_length=140, blank=True, null=True)
>>
>>  def __unicode__(self):
>> return u'%s' % self.title
>>
>>
>>
>> and on apps/property/models.py
>>
>>
>> class Property(Base):
>> .
>> .
>> unit_price = models.ManyToManyField(UnitType,through=UnitPrice,
>> blank=True, null=True)
>>
>> .
>> .
>>
>>
>>
>> after adding the unit price field I did  a migration
>>
>>   python manage.py schemamigration property --auto
>>
>> I am getting this output
>>
>>Nothing seems to have changed.
>>
>> the through table is created,  i have checked that.
>>
>>
>>  Table "public.common_unitprice"
>>  Column |  Type
>> |   Modifiers
>> ++--
>> -
>>  id | integer| not null default
>> nextval('common_unitprice_id_seq'::regclass)
>>  project_id | integer| not null
>>  unit_type_id   | integer| not null
>>  five_year_target_price | character varying(50)  |
>>  per_sqft_price | character varying(50)  |
>>  total_price| character varying(50)  |
>>  total_area | character varying(140) |
>>  carpet_area| character varying(140) |
>> Indexes:
>> "common_unitprice_pkey" PRIMARY KEY, btree (id)
>> "common_unitprice_project_id" btree (project_id)
>> "common_unitprice_unit_type_id" btree (unit_type_id)
>> Foreign-key constraints:
>> "project_id_refs_id_7c43d44c" FOREIGN KEY (project_id) REFERENCES
>> property_property(id) DEFERRABLE INITIALLY DEFERRED
>> "unit_type_id_refs_id_1a1f3765" FOREIGN KEY (unit_type_id)
>> REFERENCES common_unittype(id) DEFERRABLE INITIALLY DEFERRED
>>
>>
>>
>>
>>
>>
>> Any help??
>>
>>
>> Mrinmoy Das
>> http://goromlagche.in/
>>
>
>
> What else are you expecting? If the through table is created, that's all
> you need.
> --
> DR.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0b766e73-adf4-42a9-9085-524687de9f50%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFWA-MNzc%2B4N1aqLEOwp81w-aNftuRivag_strKjMonRHSAj8Q%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ManyToMany field creation problem

2013-12-06 Thread Daniel Roseman
On Friday, 6 December 2013 07:44:27 UTC, Mrinmoy Das wrote:
>
> Hi,
>
> I have these tables
>
>
> on apps/common/models.py
>
>
> class UnitType(models.Model):
> title = models.CharField(max_length=50)
>
> def __unicode__(self):
> return u'%s' % self.title
>
> class UnitPrice(models.Model):
> project = models.ForeignKey('property.Property')
> unit_type = models.ForeignKey(UnitType)
>
> five_year_target_price = models.CharField(max_length=50, blank=True, 
> null=True)
> per_sqft_price = models.CharField(max_length=50, blank=True, null=True)
> total_price = models.CharField(max_length=50, blank=True, null=True)
> 
> total_area = models.CharField(max_length=140, blank=True, null=True)
> carpet_area = models.CharField(max_length=140, blank=True, null=True)
>
>  def __unicode__(self):
> return u'%s' % self.title
>
>
>
> and on apps/property/models.py
>
>
> class Property(Base):
> .
> .
> unit_price = models.ManyToManyField(UnitType,through=UnitPrice, 
> blank=True, null=True)
>
> .
> .
>
>
>
> after adding the unit price field I did  a migration
>
>   python manage.py schemamigration property --auto
>
> I am getting this output
>
>Nothing seems to have changed.
>
> the through table is created,  i have checked that.
>
>
>  Table "public.common_unitprice"
>  Column |  Type  
> |   Modifiers   
>
> ++---
>  id | integer| not null default 
> nextval('common_unitprice_id_seq'::regclass)
>  project_id | integer| not null
>  unit_type_id   | integer| not null
>  five_year_target_price | character varying(50)  | 
>  per_sqft_price | character varying(50)  | 
>  total_price| character varying(50)  | 
>  total_area | character varying(140) | 
>  carpet_area| character varying(140) | 
> Indexes:
> "common_unitprice_pkey" PRIMARY KEY, btree (id)
> "common_unitprice_project_id" btree (project_id)
> "common_unitprice_unit_type_id" btree (unit_type_id)
> Foreign-key constraints:
> "project_id_refs_id_7c43d44c" FOREIGN KEY (project_id) REFERENCES 
> property_property(id) DEFERRABLE INITIALLY DEFERRED
> "unit_type_id_refs_id_1a1f3765" FOREIGN KEY (unit_type_id) REFERENCES 
> common_unittype(id) DEFERRABLE INITIALLY DEFERRED
>
>
>
>
>
>
> Any help??
>
>
> Mrinmoy Das
> http://goromlagche.in/
>


What else are you expecting? If the through table is created, that's all 
you need.
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0b766e73-adf4-42a9-9085-524687de9f50%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


ManyToMany field creation problem

2013-12-05 Thread Mrinmoy Das
Hi,

I have these tables


on apps/common/models.py


class UnitType(models.Model):
title = models.CharField(max_length=50)

def __unicode__(self):
return u'%s' % self.title

class UnitPrice(models.Model):
project = models.ForeignKey('property.Property')
unit_type = models.ForeignKey(UnitType)

five_year_target_price = models.CharField(max_length=50, blank=True,
null=True)
per_sqft_price = models.CharField(max_length=50, blank=True, null=True)
total_price = models.CharField(max_length=50, blank=True, null=True)

total_area = models.CharField(max_length=140, blank=True, null=True)
carpet_area = models.CharField(max_length=140, blank=True, null=True)

 def __unicode__(self):
return u'%s' % self.title



and on apps/property/models.py


class Property(Base):
.
.
unit_price = models.ManyToManyField(UnitType,through=UnitPrice,
blank=True, null=True)

.
.



after adding the unit price field I did  a migration

  python manage.py schemamigration property --auto

I am getting this output

   Nothing seems to have changed.

the through table is created,  i have checked that.


 Table "public.common_unitprice"
 Column |  Type
|   Modifiers
++---
 id | integer| not null default
nextval('common_unitprice_id_seq'::regclass)
 project_id | integer| not null
 unit_type_id   | integer| not null
 five_year_target_price | character varying(50)  |
 per_sqft_price | character varying(50)  |
 total_price| character varying(50)  |
 total_area | character varying(140) |
 carpet_area| character varying(140) |
Indexes:
"common_unitprice_pkey" PRIMARY KEY, btree (id)
"common_unitprice_project_id" btree (project_id)
"common_unitprice_unit_type_id" btree (unit_type_id)
Foreign-key constraints:
"project_id_refs_id_7c43d44c" FOREIGN KEY (project_id) REFERENCES
property_property(id) DEFERRABLE INITIALLY DEFERRED
"unit_type_id_refs_id_1a1f3765" FOREIGN KEY (unit_type_id) REFERENCES
common_unittype(id) DEFERRABLE INITIALLY DEFERRED






Any help??


Mrinmoy Das
http://goromlagche.in/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFWA-MOdDbRDc5m-pj07J1cUaKo4MvFc8nfbx1Fz6rbC%2B7m_3A%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.