Re: migrate error in manage.py

2019-10-11 Thread Suraj Thapa FC
Use python3

On Fri, 11 Oct, 2019, 11:01 PM Ralph Barhydt,  wrote:

> When I try to run "python manage.py migrate" I get an error "invalid
> syntax" that points to ")  from exc". How can I fix this?
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6843a8cb-be93-4fef-a6f2-f49d6f7a1c98%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPjsHcH3G-JDp1g5ivCrC%3D8PXc78DVZzYfrO4KoLGWZbtyCYNw%40mail.gmail.com.


Re: migrate error

2019-09-10 Thread Desh Deepak
Show me your view.py code.

On Tue, 10 Sep 2019, 20:03 Chukwuka,  wrote:

> Might help if you post the migration file 0027.. for testapp
>
> On Mon, Sep 9, 2019 at 9:29 PM Pradeep Singh 
> wrote:
>
>> from django.db import models
>> from django import forms
>> from django.core import validators
>> from django.core.urlresolvers import reverse
>> from django.contrib.auth.models import User
>> from django.db.models.signals import post_save
>> from django.dispatch import receiver
>> from django.utils import timezone
>> from datetime import datetime
>> # Create your models here.
>> class Contact(models.Model):
>>   name = models.CharField(max_length=200)
>>   email = models.CharField(max_length=100)
>>   phone = models.CharField(max_length=100)
>>   message = models.TextField(blank=True)
>>   contact_date = models.DateTimeField(default=datetime.now, blank=True)
>>
>>   def __str__(self):
>> return self.name
>>
>> class Profile(models.Model):
>> user = models.OneToOneField(User, on_delete=models.CASCADE)
>> bio = models.TextField(max_length=500, blank=True)
>> location = models.CharField(max_length=30, blank=True)
>> #sbirth_date = models.DateField(null=True, blank=True)
>>
>> @receiver(post_save, sender=User)
>> def update_user_profile(sender, instance, created, **kwargs):
>> if created:
>> Profile.objects.create(user=instance)
>> instance.profile.save()
>>
>> class Realtor(models.Model):
>>   name = models.CharField(max_length=200)
>>   photo = models.ImageField(upload_to='media/images/')
>>   description = models.TextField(blank=True)
>>   phone = models.CharField(max_length=20)
>>   email = models.CharField(max_length=50)
>>   is_mvp = models.BooleanField(default=False)
>>   hire_date = models.DateTimeField(default=datetime.now, blank=True)
>>   def __str__(self):
>> return self.name
>>
>> PROPERTY_TYPE = (('Select Property Type','Select Property
>> Type'),('Appartment', 'Appartment'),('DDA Appartment', 'DDA Appartment'),
>> ('Builder Floor', 'Builder Floor'), ('Indepedent house', 'Indepedent
>> house'),('Residental Land','Residental Land'))
>> TYPE = (('Select Type','Select Type'),('1 BHK', '1 BHK'), ('2 BHK', '2
>> BHK'), ('3 BHK', '3 BHK'),('4 BHK','4 BHK'),('LAND','Land'),('Janta
>> Flat','Janta Flat'),('LIG Flat','LIG Flat'),('MIG Flat','MIG Flat'),('HIG
>> Flat','HIG Flat'))
>> CITY=(('Select City','Select City'),('West Delhi', 'West Delhi'), ('South
>> Delhi', 'South Delhi'), ('North Delhi', 'North Delhi'),('East Delhi','East
>> Delhi'))
>>
>> class Property(models.Model):
>> realtor= models.ForeignKey(Realtor,  on_delete=models.DO_NOTHING)
>> #image=models.ImageField(upload_to='media/images/',blank=True,
>> null=True)
>> house_name=models.CharField(max_length=30)
>> #PROPERTY_TYPE = (('Select Property Type','Select Property
>> Type'),('Appartment', 'Appartment'),('DDA Appartment', 'DDA Appartment'),
>> ('Builder Floor', 'Builder Floor'), ('Indepedent house', 'Indepedent
>> house'),('Residental Land','Residental Land'))
>> property_type=models.CharField(max_length=20,
>> choices=PROPERTY_TYPE,default='Select Property Type')
>> #TYPE = (('Select Type','Select Type'),('1 BHK', '1 BHK'), ('2 BHK',
>> '2 BHK'), ('3 BHK', '3 BHK'),('4 BHK','4 BHK'),('LAND','Land'),('Janta
>> Flat','Janta Flat'),('LIG Flat','LIG Flat'),('MIG Flat','MIG Flat'),('HIG
>> Flat','HIG Flat'))
>> type=models.CharField(max_length=10,choices=TYPE,default='Select
>> Type')
>> area=models.CharField(max_length=10,blank=False)
>> #CITY=(('Select City','Select City'),('West Delhi', 'West Delhi'),
>> ('South Delhi', 'South Delhi'), ('North Delhi', 'North Delhi'),('East
>> Delhi','East Delhi'))
>> city=models.CharField(max_length=20,choices=CITY,default='Select
>> city')
>> location=models.CharField(max_length=30)
>> price=models.CharField(max_length=20)
>> description=models.TextField(blank=True)
>> publish_date = models.DateTimeField(default=datetime.now, blank=True)
>> publish_date = models.DateTimeField(default=datetime.now, blank=True)
>> image= models.ImageField(upload_to='media/images/',blank=True,
>> null=True )
>> image_1 = models.ImageField(upload_to='media/images/', blank=True ,
>> null=True)
>> image_2 = models.ImageField(upload_to='media/images/', blank=True ,
>> null=True)
>> image_3 = models.ImageField(upload_to='media/images/', blank=True ,
>> null=True)
>> image_4 = models.ImageField(upload_to='media/images/', blank=True ,
>> null=True)
>> image_5 = models.ImageField(upload_to='media/images/', blank=True ,
>> null=True)
>> image_6 = models.ImageField(upload_to='media/images/', blank=True ,
>> null=True)
>> #submitted = models.DateField(auto_now_add=True)
>>
>> class Meta:
>> abstract=True
>>
>>
>>
>>
>> class Buy(Property):
>>
>> def __str__(self):
>> return self.house_name
>>
>>
>> class Rent(Property):
>>
>> def __str__(self):
>> return self.house_name

Re: migrate error

2019-09-10 Thread Chukwuka
Might help if you post the migration file 0027.. for testapp

On Mon, Sep 9, 2019 at 9:29 PM Pradeep Singh  wrote:

> from django.db import models
> from django import forms
> from django.core import validators
> from django.core.urlresolvers import reverse
> from django.contrib.auth.models import User
> from django.db.models.signals import post_save
> from django.dispatch import receiver
> from django.utils import timezone
> from datetime import datetime
> # Create your models here.
> class Contact(models.Model):
>   name = models.CharField(max_length=200)
>   email = models.CharField(max_length=100)
>   phone = models.CharField(max_length=100)
>   message = models.TextField(blank=True)
>   contact_date = models.DateTimeField(default=datetime.now, blank=True)
>
>   def __str__(self):
> return self.name
>
> class Profile(models.Model):
> user = models.OneToOneField(User, on_delete=models.CASCADE)
> bio = models.TextField(max_length=500, blank=True)
> location = models.CharField(max_length=30, blank=True)
> #sbirth_date = models.DateField(null=True, blank=True)
>
> @receiver(post_save, sender=User)
> def update_user_profile(sender, instance, created, **kwargs):
> if created:
> Profile.objects.create(user=instance)
> instance.profile.save()
>
> class Realtor(models.Model):
>   name = models.CharField(max_length=200)
>   photo = models.ImageField(upload_to='media/images/')
>   description = models.TextField(blank=True)
>   phone = models.CharField(max_length=20)
>   email = models.CharField(max_length=50)
>   is_mvp = models.BooleanField(default=False)
>   hire_date = models.DateTimeField(default=datetime.now, blank=True)
>   def __str__(self):
> return self.name
>
> PROPERTY_TYPE = (('Select Property Type','Select Property
> Type'),('Appartment', 'Appartment'),('DDA Appartment', 'DDA Appartment'),
> ('Builder Floor', 'Builder Floor'), ('Indepedent house', 'Indepedent
> house'),('Residental Land','Residental Land'))
> TYPE = (('Select Type','Select Type'),('1 BHK', '1 BHK'), ('2 BHK', '2
> BHK'), ('3 BHK', '3 BHK'),('4 BHK','4 BHK'),('LAND','Land'),('Janta
> Flat','Janta Flat'),('LIG Flat','LIG Flat'),('MIG Flat','MIG Flat'),('HIG
> Flat','HIG Flat'))
> CITY=(('Select City','Select City'),('West Delhi', 'West Delhi'), ('South
> Delhi', 'South Delhi'), ('North Delhi', 'North Delhi'),('East Delhi','East
> Delhi'))
>
> class Property(models.Model):
> realtor= models.ForeignKey(Realtor,  on_delete=models.DO_NOTHING)
> #image=models.ImageField(upload_to='media/images/',blank=True,
> null=True)
> house_name=models.CharField(max_length=30)
> #PROPERTY_TYPE = (('Select Property Type','Select Property
> Type'),('Appartment', 'Appartment'),('DDA Appartment', 'DDA Appartment'),
> ('Builder Floor', 'Builder Floor'), ('Indepedent house', 'Indepedent
> house'),('Residental Land','Residental Land'))
> property_type=models.CharField(max_length=20,
> choices=PROPERTY_TYPE,default='Select Property Type')
> #TYPE = (('Select Type','Select Type'),('1 BHK', '1 BHK'), ('2 BHK',
> '2 BHK'), ('3 BHK', '3 BHK'),('4 BHK','4 BHK'),('LAND','Land'),('Janta
> Flat','Janta Flat'),('LIG Flat','LIG Flat'),('MIG Flat','MIG Flat'),('HIG
> Flat','HIG Flat'))
> type=models.CharField(max_length=10,choices=TYPE,default='Select Type')
> area=models.CharField(max_length=10,blank=False)
> #CITY=(('Select City','Select City'),('West Delhi', 'West Delhi'),
> ('South Delhi', 'South Delhi'), ('North Delhi', 'North Delhi'),('East
> Delhi','East Delhi'))
> city=models.CharField(max_length=20,choices=CITY,default='Select city')
> location=models.CharField(max_length=30)
> price=models.CharField(max_length=20)
> description=models.TextField(blank=True)
> publish_date = models.DateTimeField(default=datetime.now, blank=True)
> publish_date = models.DateTimeField(default=datetime.now, blank=True)
> image= models.ImageField(upload_to='media/images/',blank=True,
> null=True )
> image_1 = models.ImageField(upload_to='media/images/', blank=True ,
> null=True)
> image_2 = models.ImageField(upload_to='media/images/', blank=True ,
> null=True)
> image_3 = models.ImageField(upload_to='media/images/', blank=True ,
> null=True)
> image_4 = models.ImageField(upload_to='media/images/', blank=True ,
> null=True)
> image_5 = models.ImageField(upload_to='media/images/', blank=True ,
> null=True)
> image_6 = models.ImageField(upload_to='media/images/', blank=True ,
> null=True)
> #submitted = models.DateField(auto_now_add=True)
>
> class Meta:
> abstract=True
>
>
>
>
> class Buy(Property):
>
> def __str__(self):
> return self.house_name
>
>
> class Rent(Property):
>
> def __str__(self):
> return self.house_name
>
> class PG(Property):
> def __str__(self):
> return self.house_name
>
>
> YOU_ARE=(('Select','Select'),('Owner', 'Owner'), ('Dealer', 'Dealer'),
> ('Agent', 'Agent'))
> PROPERTY_FOR=(('S

Re: migrate error

2019-09-10 Thread Rahul Roshan
First you can cleanup all migrations files in /migrations/*. And then try
to provide *default=" " *for contact_no. Try to migrate all these changes !

On Tue, Sep 10, 2019 at 1:42 PM Pradeep Singh  wrote:

> okay . yes i did but problem are same
>
> On Tue, 10 Sep 2019 at 12:49, Rahul Roshan 
> wrote:
>
>> Can you try contact_date default=" " !
>>
>> On Tue, Sep 10, 2019, 12:22 PM ANi  wrote:
>>
>>>
>>>  Another piece of advice, please prettify your code or take a screenshot
>>> , not just paste it directly.
>>>  It is not easy to read to you as well, right?
>>>
>>>
>>>
>>> what had you done in this migration?
>>> Was the original value in that column a datetime and you want to change
>>> it into another data format?
>>>
>>>
>>> Pradeep Singh於 2019年9月10日星期二 UTC+8上午10時44分28秒寫道:

  I didnot get why i am getting this error .please help to fix it

>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/8540486f-2bbf-4f39-aa81-82e26cfb352c%40googlegroups.com
>>> 
>>> .
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAN%2BO0S4yH%3DoiU5hYfKQK2T-1nSAFF3djqECKADeAXRgf-mPDWw%40mail.gmail.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CANwgZcaVsdbUFagqLC-is802jjvLM91SGiZ270Y2sRNXkSNx5A%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN%2BO0S6UqD99%3D33qJtjj8CNCJo1fRrWJuciYthToUhSUY7g5TQ%40mail.gmail.com.


Re: migrate error

2019-09-10 Thread Pradeep Singh
okay . yes i did but problem are same

On Tue, 10 Sep 2019 at 12:49, Rahul Roshan  wrote:

> Can you try contact_date default=" " !
>
> On Tue, Sep 10, 2019, 12:22 PM ANi  wrote:
>
>>
>>  Another piece of advice, please prettify your code or take a screenshot,
>> not just paste it directly.
>>  It is not easy to read to you as well, right?
>>
>>
>>
>> what had you done in this migration?
>> Was the original value in that column a datetime and you want to change
>> it into another data format?
>>
>>
>> Pradeep Singh於 2019年9月10日星期二 UTC+8上午10時44分28秒寫道:
>>>
>>>  I didnot get why i am getting this error .please help to fix it
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/8540486f-2bbf-4f39-aa81-82e26cfb352c%40googlegroups.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAN%2BO0S4yH%3DoiU5hYfKQK2T-1nSAFF3djqECKADeAXRgf-mPDWw%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANwgZcaVsdbUFagqLC-is802jjvLM91SGiZ270Y2sRNXkSNx5A%40mail.gmail.com.


Re: migrate error

2019-09-10 Thread Rahul Roshan
Can you try contact_date default=" " !

On Tue, Sep 10, 2019, 12:22 PM ANi  wrote:

>
>  Another piece of advice, please prettify your code or take a screenshot,
> not just paste it directly.
>  It is not easy to read to you as well, right?
>
>
>
> what had you done in this migration?
> Was the original value in that column a datetime and you want to change it
> into another data format?
>
>
> Pradeep Singh於 2019年9月10日星期二 UTC+8上午10時44分28秒寫道:
>>
>>  I didnot get why i am getting this error .please help to fix it
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/8540486f-2bbf-4f39-aa81-82e26cfb352c%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN%2BO0S4yH%3DoiU5hYfKQK2T-1nSAFF3djqECKADeAXRgf-mPDWw%40mail.gmail.com.


Re: migrate error

2019-09-09 Thread ANi

 Another piece of advice, please prettify your code or take a screenshot, 
not just paste it directly.
 It is not easy to read to you as well, right?



what had you done in this migration?
Was the original value in that column a datetime and you want to change it 
into another data format?


Pradeep Singh於 2019年9月10日星期二 UTC+8上午10時44分28秒寫道:
>
>  I didnot get why i am getting this error .please help to fix it 
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8540486f-2bbf-4f39-aa81-82e26cfb352c%40googlegroups.com.


Re: migrate error

2019-09-09 Thread Pradeep Singh
from django.db import models
from django import forms
from django.core import validators
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.utils import timezone
from datetime import datetime
# Create your models here.
class Contact(models.Model):
  name = models.CharField(max_length=200)
  email = models.CharField(max_length=100)
  phone = models.CharField(max_length=100)
  message = models.TextField(blank=True)
  contact_date = models.DateTimeField(default=datetime.now, blank=True)

  def __str__(self):
return self.name

class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
bio = models.TextField(max_length=500, blank=True)
location = models.CharField(max_length=30, blank=True)
#sbirth_date = models.DateField(null=True, blank=True)

@receiver(post_save, sender=User)
def update_user_profile(sender, instance, created, **kwargs):
if created:
Profile.objects.create(user=instance)
instance.profile.save()

class Realtor(models.Model):
  name = models.CharField(max_length=200)
  photo = models.ImageField(upload_to='media/images/')
  description = models.TextField(blank=True)
  phone = models.CharField(max_length=20)
  email = models.CharField(max_length=50)
  is_mvp = models.BooleanField(default=False)
  hire_date = models.DateTimeField(default=datetime.now, blank=True)
  def __str__(self):
return self.name

PROPERTY_TYPE = (('Select Property Type','Select Property
Type'),('Appartment', 'Appartment'),('DDA Appartment', 'DDA Appartment'),
('Builder Floor', 'Builder Floor'), ('Indepedent house', 'Indepedent
house'),('Residental Land','Residental Land'))
TYPE = (('Select Type','Select Type'),('1 BHK', '1 BHK'), ('2 BHK', '2
BHK'), ('3 BHK', '3 BHK'),('4 BHK','4 BHK'),('LAND','Land'),('Janta
Flat','Janta Flat'),('LIG Flat','LIG Flat'),('MIG Flat','MIG Flat'),('HIG
Flat','HIG Flat'))
CITY=(('Select City','Select City'),('West Delhi', 'West Delhi'), ('South
Delhi', 'South Delhi'), ('North Delhi', 'North Delhi'),('East Delhi','East
Delhi'))

class Property(models.Model):
realtor= models.ForeignKey(Realtor,  on_delete=models.DO_NOTHING)
#image=models.ImageField(upload_to='media/images/',blank=True,
null=True)
house_name=models.CharField(max_length=30)
#PROPERTY_TYPE = (('Select Property Type','Select Property
Type'),('Appartment', 'Appartment'),('DDA Appartment', 'DDA Appartment'),
('Builder Floor', 'Builder Floor'), ('Indepedent house', 'Indepedent
house'),('Residental Land','Residental Land'))
property_type=models.CharField(max_length=20,
choices=PROPERTY_TYPE,default='Select Property Type')
#TYPE = (('Select Type','Select Type'),('1 BHK', '1 BHK'), ('2 BHK', '2
BHK'), ('3 BHK', '3 BHK'),('4 BHK','4 BHK'),('LAND','Land'),('Janta
Flat','Janta Flat'),('LIG Flat','LIG Flat'),('MIG Flat','MIG Flat'),('HIG
Flat','HIG Flat'))
type=models.CharField(max_length=10,choices=TYPE,default='Select Type')
area=models.CharField(max_length=10,blank=False)
#CITY=(('Select City','Select City'),('West Delhi', 'West Delhi'),
('South Delhi', 'South Delhi'), ('North Delhi', 'North Delhi'),('East
Delhi','East Delhi'))
city=models.CharField(max_length=20,choices=CITY,default='Select city')
location=models.CharField(max_length=30)
price=models.CharField(max_length=20)
description=models.TextField(blank=True)
publish_date = models.DateTimeField(default=datetime.now, blank=True)
publish_date = models.DateTimeField(default=datetime.now, blank=True)
image= models.ImageField(upload_to='media/images/',blank=True,
null=True )
image_1 = models.ImageField(upload_to='media/images/', blank=True ,
null=True)
image_2 = models.ImageField(upload_to='media/images/', blank=True ,
null=True)
image_3 = models.ImageField(upload_to='media/images/', blank=True ,
null=True)
image_4 = models.ImageField(upload_to='media/images/', blank=True ,
null=True)
image_5 = models.ImageField(upload_to='media/images/', blank=True ,
null=True)
image_6 = models.ImageField(upload_to='media/images/', blank=True ,
null=True)
#submitted = models.DateField(auto_now_add=True)

class Meta:
abstract=True




class Buy(Property):

def __str__(self):
return self.house_name


class Rent(Property):

def __str__(self):
return self.house_name

class PG(Property):
def __str__(self):
return self.house_name


YOU_ARE=(('Select','Select'),('Owner', 'Owner'), ('Dealer', 'Dealer'),
('Agent', 'Agent'))
PROPERTY_FOR=(('Select Property For','Select Property For'), ('Sale',
'Sale'), ('Rent', 'Rent'), ('PG', 'PG'))
PROPERTY_TYPE = (('Select Property Type','Select Property
Type'),('Appartment', 'Appartment'),('DDA Appartment', 'DDA Appartment'),
('Builder Floor', 'Builder Floor'), ('Indepedent house', 'Indepedent
house'),('Residental Land','Residental Land'))

Re: migrate error

2019-09-09 Thread Sipum
Show the code where u have used datetime.datetime.

Whenever u are asking something, its better to show code where the error is
arised. So it will be easy for others to find the error otherwise no one
will answer ur question bro.

On Tue, 10 Sep, 2019, 8:14 AM Pradeep Singh,  wrote:

>  I didnot get why i am getting this error .please help to fix it
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CANwgZcYfHyD1UGoG_faXv%3DBDnRVcHOBQoQ%3DovUhtV_14VVXmTw%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGHZBzzkphdgsfhkk95vdTd0ZpW0%3Dx0STd4S9x7_LgxgYFk%2BWg%40mail.gmail.com.


Re: Migrate error

2018-07-18 Thread Mikhailo Keda
show your migration and model

середа, 18 липня 2018 р. 14:44:47 UTC+3 користувач Sophie Obomighie написав:
>
> Hello,
> I attempted to migrate my changes using  " Python manage.py migrate " but 
> I'm getting this error message.
> How can I fix this please?
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/47526442-991a-40ca-871b-468c569cf530%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: migrate error

2015-10-23 Thread Mike Dewhirst

On 23/10/2015 4:23 PM, Christoph Knapp wrote:

Ahh OK, the only explanation I have, is that someone already tried to
use django on the legacy database and the djando tables were already
there. The inspectdb tool put them in the models.py file which caused
the error. I did what you said and it worked. I just looked at the
documentation of the db and those tables were not in there.


Yes. Sounds reasonable. The other way it can happen is that the legacy 
db was actually created by a Django project and both Admin and Auth were 
installed apps.




Thanks

Christoph


On Thursday, October 22, 2015 at 11:31:11 PM UTC+2, Mike Dewhirst wrote:

On 22/10/2015 10:40 PM, Christoph Knapp wrote:
 > Hi,
 > I have a legacy database and used "python manage.py inspectdb >
 > models.py" to create a models.py file. After I modified the file all
 > errors went away when I makemigrations. This step works without
problems
 > on the only app I have in my project. When I go "python manage.py
 > migrate" I get the following error.
 >
 > Operations to perform:
 > Â  Synchronize unmigrated apps: staticfiles, messages
 > Â  Apply all migrations: admin, contenttypes, sessions, auth,
readDatabase
 > Synchronizing apps without migrations:
 > Â  Creating tables...
 > Â Â Â  Running deferred SQL...
 > Â  Installing custom SQL...
 > Running migrations:
 > Â  Rendering model states... DONE
 > Â  Applying readDatabase.0001_initial...Traceback (most recent
call last):
 > Â  File
 >
"/home/christoph_knapp/Bioinformatik/variantendatenbank_tool/manage.py",

 > line 10, in 
 > Â Â Â  execute_from_command_line(sys.argv)
 > Â  File
 >
"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",

 > line 351, in execute_from_command_line
 > Â Â Â  utility.execute()
 > Â  File
 >
"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",

 > line 343, in execute
 > Â Â Â  self.fetch_command(subcommand).run_from_argv(self.argv)
 > Â  File
 >
"/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",

 > line 394, in run_from_argv
 > Â Â Â  self.execute(*args, **cmd_options)
 > Â  File
 >
"/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",

 > line 445, in execute
 > Â Â Â  output = self.handle(*args, **options)
 > Â  File
 >

"/usr/local/lib/python2.7/dist-packages/django/core/management/commands/migrate.py",

 > line 222, in handle
 > Â Â Â  executor.migrate(targets, plan, fake=fake,
fake_initial=fake_initial)
 > Â  File
 >
"/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py",

 > line 110, in migrate
 > Â Â Â  self.apply_migration(states[migration], migration,
fake=fake,
 > fake_initial=fake_initial)
 > Â  File
 >
"/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py",

 > line 148, in apply_migration
 > Â Â Â  state = migration.apply(state, schema_editor)
 > Â  File
 >
"/usr/local/lib/python2.7/dist-packages/django/db/migrations/migration.py",

 > line 115, in apply
 > Â Â Â  operation.database_forwards(self.app_label,
schema_editor,
 > old_state, project_state)
 > Â  File
 >

"/usr/local/lib/python2.7/dist-packages/django/db/migrations/operations/models.py",

 > line 59, in database_forwards
 > Â Â Â  schema_editor.create_model(model)
 > Â  File
 >
"/usr/local/lib/python2.7/dist-packages/django/db/backends/base/schema.py",

 > line 286, in create_model
 > Â Â Â  self.execute(sql, params or None)
 > Â  File
 >
"/usr/local/lib/python2.7/dist-packages/django/db/backends/base/schema.py",

 > line 111, in execute
 > Â Â Â  cursor.execute(sql, params)
 > Â  File
 >
"/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py",
 > line 79, in execute
 > Â Â Â  return super(CursorDebugWrapper, self).execute(sql,
params)
 > Â  File
 >
"/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py",
 > line 64, in execute
 > Â Â Â  return self.cursor.execute(sql, params)
 > Â  File
"/usr/local/lib/python2.7/dist-packages/django/db/utils.py",
 > line 97, in __exit__
 > Â Â Â  six.reraise(dj_exc_type, dj_exc_value, traceback)
 > Â  File
 >
"/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py",
 > line 62, in execute
 > Â Â Â  return self.cursor.execute(sql)
 > django.db.utils.ProgrammingError: FEHLER:Â  Relation
„auth_group“
 > existiert bereits
 >
 > The last line contains a little bit of German which translates into
 > "Relation "auth_group" already exists". T

Re: migrate error

2015-10-22 Thread Christoph Knapp
Ahh OK, the only explanation I have, is that someone already tried to use 
django on the legacy database and the djando tables were already there. The 
inspectdb tool put them in the models.py file which caused the error. I did 
what you said and it worked. I just looked at the documentation of the db 
and those tables were not in there.

Thanks

Christoph


On Thursday, October 22, 2015 at 11:31:11 PM UTC+2, Mike Dewhirst wrote:
>
> On 22/10/2015 10:40 PM, Christoph Knapp wrote: 
> > Hi, 
> > I have a legacy database and used "python manage.py inspectdb > 
> > models.py" to create a models.py file. After I modified the file all 
> > errors went away when I makemigrations. This step works without problems 
> > on the only app I have in my project. When I go "python manage.py 
> > migrate" I get the following error. 
> > 
> > Operations to perform: 
> > Â  Synchronize unmigrated apps: staticfiles, messages 
> > Â  Apply all migrations: admin, contenttypes, sessions, auth, 
> readDatabase 
> > Synchronizing apps without migrations: 
> > Â  Creating tables... 
> > Â Â Â  Running deferred SQL... 
> > Â  Installing custom SQL... 
> > Running migrations: 
> > Â  Rendering model states... DONE 
> > Â  Applying readDatabase.0001_initial...Traceback (most recent call 
> last): 
> > Â  File 
> > "/home/christoph_knapp/Bioinformatik/variantendatenbank_tool/manage.py", 
> > line 10, in  
> > Â Â Â  execute_from_command_line(sys.argv) 
> > Â  File 
> > 
> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", 
>
> > line 351, in execute_from_command_line 
> > Â Â Â  utility.execute() 
> > Â  File 
> > 
> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", 
>
> > line 343, in execute 
> > Â Â Â  self.fetch_command(subcommand).run_from_argv(self.argv) 
> > Â  File 
> > "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", 
> > line 394, in run_from_argv 
> > Â Â Â  self.execute(*args, **cmd_options) 
> > Â  File 
> > "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", 
> > line 445, in execute 
> > Â Â Â  output = self.handle(*args, **options) 
> > Â  File 
> > 
> "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/migrate.py",
>  
>
> > line 222, in handle 
> > Â Â Â  executor.migrate(targets, plan, fake=fake, 
> fake_initial=fake_initial) 
> > Â  File 
> > 
> "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", 
> > line 110, in migrate 
> > Â Â Â  self.apply_migration(states[migration], migration, fake=fake, 
> > fake_initial=fake_initial) 
> > Â  File 
> > 
> "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", 
> > line 148, in apply_migration 
> > Â Â Â  state = migration.apply(state, schema_editor) 
> > Â  File 
> > 
> "/usr/local/lib/python2.7/dist-packages/django/db/migrations/migration.py", 
> > line 115, in apply 
> > Â Â Â  operation.database_forwards(self.app_label, schema_editor, 
> > old_state, project_state) 
> > Â  File 
> > 
> "/usr/local/lib/python2.7/dist-packages/django/db/migrations/operations/models.py",
>  
>
> > line 59, in database_forwards 
> > Â Â Â  schema_editor.create_model(model) 
> > Â  File 
> > 
> "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/schema.py", 
> > line 286, in create_model 
> > Â Â Â  self.execute(sql, params or None) 
> > Â  File 
> > 
> "/usr/local/lib/python2.7/dist-packages/django/db/backends/base/schema.py", 
> > line 111, in execute 
> > Â Â Â  cursor.execute(sql, params) 
> > Â  File 
> > "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", 
> > line 79, in execute 
> > Â Â Â  return super(CursorDebugWrapper, self).execute(sql, params) 
> > Â  File 
> > "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", 
> > line 64, in execute 
> > Â Â Â  return self.cursor.execute(sql, params) 
> > Â  File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", 
> > line 97, in __exit__ 
> > Â Â Â  six.reraise(dj_exc_type, dj_exc_value, traceback) 
> > Â  File 
> > "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", 
> > line 62, in execute 
> > Â Â Â  return self.cursor.execute(sql) 
> > django.db.utils.ProgrammingError: FEHLER:  Relation „auth_group“ 
> > existiert bereits 
> > 
> > The last line contains a little bit of German which translates into 
> > "Relation "auth_group" already exists". The auth_group table was 
> > generated by inspectdb and is none of the tables from the legacy 
> > database. The only change I made at those tables were that I removed the 
> > line "managed=False". When I put this back in I get the same error. The 
> > python code for the auth_group table is below. 
> > 
> > class AuthGroup(models.Model): 
> > Â Â Â  name = models.CharField(unique=True, max_length=80) 
> > 
> > Â Â Â  class Meta: 
> > Â Â Â Â Â Â Â  db_table = 'auth_group' 
>
> auth_group is a Django table which you don't need to install. In your 
> models.py r

Re: migrate error

2015-10-22 Thread Mike Dewhirst

On 22/10/2015 10:40 PM, Christoph Knapp wrote:

Hi,
I have a legacy database and used "python manage.py inspectdb >
models.py" to create a models.py file. After I modified the file all
errors went away when I makemigrations. This step works without problems
on the only app I have in my project. When I go "python manage.py
migrate" I get the following error.

Operations to perform:
  Synchronize unmigrated apps: staticfiles, messages
  Apply all migrations: admin, contenttypes, sessions, auth, readDatabase
Synchronizing apps without migrations:
  Creating tables...
    Running deferred SQL...
  Installing custom SQL...
Running migrations:
  Rendering model states... DONE
  Applying readDatabase.0001_initial...Traceback (most recent call last):
  File
"/home/christoph_knapp/Bioinformatik/variantendatenbank_tool/manage.py",
line 10, in 
    execute_from_command_line(sys.argv)
  File
"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
line 351, in execute_from_command_line
    utility.execute()
  File
"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
line 343, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File
"/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
line 394, in run_from_argv
    self.execute(*args, **cmd_options)
  File
"/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
line 445, in execute
    output = self.handle(*args, **options)
  File
"/usr/local/lib/python2.7/dist-packages/django/core/management/commands/migrate.py",
line 222, in handle
    executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
  File
"/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py",
line 110, in migrate
    self.apply_migration(states[migration], migration, fake=fake,
fake_initial=fake_initial)
  File
"/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py",
line 148, in apply_migration
    state = migration.apply(state, schema_editor)
  File
"/usr/local/lib/python2.7/dist-packages/django/db/migrations/migration.py",
line 115, in apply
    operation.database_forwards(self.app_label, schema_editor,
old_state, project_state)
  File
"/usr/local/lib/python2.7/dist-packages/django/db/migrations/operations/models.py",
line 59, in database_forwards
    schema_editor.create_model(model)
  File
"/usr/local/lib/python2.7/dist-packages/django/db/backends/base/schema.py",
line 286, in create_model
    self.execute(sql, params or None)
  File
"/usr/local/lib/python2.7/dist-packages/django/db/backends/base/schema.py",
line 111, in execute
    cursor.execute(sql, params)
  File
"/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py",
line 79, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File
"/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py",
line 64, in execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py",
line 97, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File
"/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py",
line 62, in execute
    return self.cursor.execute(sql)
django.db.utils.ProgrammingError: FEHLER:  Relation „auth_group“
existiert bereits

The last line contains a little bit of German which translates into
"Relation "auth_group" already exists". The auth_group table was
generated by inspectdb and is none of the tables from the legacy
database. The only change I made at those tables were that I removed the
line "managed=False". When I put this back in I get the same error. The
python code for the auth_group table is below.

class AuthGroup(models.Model):
    name = models.CharField(unique=True, max_length=80)

    class Meta:
        db_table = 'auth_group'


auth_group is a Django table which you don't need to install. In your 
models.py remove all models except your own, drop the database and try 
again. The models/tables created for you by Django and the Admin are ...


auth_group
auth_group_permissions
auth_permission
auth_user
auth_user_groups
auth_user_user_permissions
django_admin_log
django_contenttype
django_migrations
django_session

Cheers

Mike



I just started with django, so let me know whether you need anything else.

Regards

Christoph

--
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/a87703ec-cc25-