I hoping that you can help me out. I currently have Django1.7 running on
windows7/Java7/Jython2.7/Postgresql9.3/postgresql-9.3-1102.jdbc41/django_jython-1.7.0b2-py2.7.
egg
I learned today that on Django 1.7 has makemigrations and migrate commands
built in. But even so when I try to apply those commands in that order I am
getting some sort of error. How can I resolve this error?
For more information on django migrations. Django 1.7 Migrations
<https://docs.djangoproject.com/en/1.7/topics/migrations/>
For more details about django on jython and the database settings. postgresql
on jython-django
<https://pythonhosted.org/django-jython/database-backends.html#postgresql>
After creating a project in Django and setting it all up and have
everything running, I began to start creating models.
What steps will reproduce the problem?
1. I first created a model in django with some fields
from django.db import models
# Create your models here.
class Join(models.Model):
email = models.EmailField(unique=True)
ip_address = models.CharField(max_length=
120, default="ABC")
#auto_now means when it was added, auto_now means when it is updated
timestamp = models.DateTimeField(auto_now_add = True, auto_now=False)
updated = models.DateTimeField(auto_now_add = False, auto_now=True)
def __unicode__(self):
return "%s" %(self.email)
2. I then run jython manage.py makemigrations joins
3. I then run jython manage.py migrate joins
4. Tables are created in database
5. I forgot to add a field using modeling, so I add it see ref_id below
from django.db import models
# Create your models here.
class Join(models.Model):
email = models.EmailField(unique=True)
ref_id = models.CharField(max_length=120, null=True)
ip_address = models.CharField(max_length=120, default="ABC")
#auto_now means when it was added, auto_now means when it is updated
timestamp = models.DateTimeField(auto_now_add = True, auto_now=False)
updated = models.DateTimeField(auto_now_add = False, auto_now=True)
def __unicode__(self):
return "%s" %(self.email)
6. I then run jython manage.py makemigrations joins
7. I then run jython manage.py migrate joins
What is the expected output?
I was expecting the new field to produce a new column for the existing
table and the column to have default values of "ABC".
What do you see instead?
It errors out badly.
File
"C:\jython2.7b2\Lib\site-packages\django_jython-1.7.0b2-py2.7.egg\doj\db\
backends\__init__.py", line 180, in execute
self.cursor.execute(sql, params)
django.db.utils.Error: ERROR: could not determine data type of parameter $1
[SQL
Code: 0], [SQLState: 42P18]
I have attached the entire error in a file to this post.
What version of the product are you using? On what operating system?
I currently have Django1.7c3 running on windows7, Java7, Jython2.7b2,
Postgresql 9.3, postgresql-9.3-1102.jdbc41, and the
django_jython-1.7.0b2-py2.7.egg
--
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 [email protected].
To post to this group, send email to [email protected].
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/db7a8702-ae47-4bb9-a58d-474c3efb8b19%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
C:\Users\michmar3\workspace\lwc>jython manage.py migrate
←[36;1mOperations to perform:←[0m
←[1m Apply all migrations: ←[0madmin, sessions, joins, auth, contenttypes
←[36;1mRunning migrations:←[0m
Applying joins.0003_join_ip_address...Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\jython2.7b2\Lib\site-packages\django-1.7c3-py2.7.egg\django\core\mana
gement\__init__.py", line 385, in execute_from_command_line
utility.execute()
File "C:\jython2.7b2\Lib\site-packages\django-1.7c3-py2.7.egg\django\core\mana
gement\__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\jython2.7b2\Lib\site-packages\django-1.7c3-py2.7.egg\django\core\mana
gement\base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\jython2.7b2\Lib\site-packages\django-1.7c3-py2.7.egg\django\core\mana
gement\base.py", line 338, in execute
output = self.handle(*args, **options)
File "C:\jython2.7b2\Lib\site-packages\django-1.7c3-py2.7.egg\django\core\mana
gement\commands\migrate.py", line 160, in handle
executor.migrate(targets, plan, fake=options.get("fake", False))
File "C:\jython2.7b2\Lib\site-packages\django-1.7c3-py2.7.egg\django\db\migrat
ions\executor.py", line 63, in migrate
self.apply_migration(migration, fake=fake)
File "C:\jython2.7b2\Lib\site-packages\django-1.7c3-py2.7.egg\django\db\migrat
ions\executor.py", line 97, in apply_migration
migration.apply(project_state, schema_editor)
File "C:\jython2.7b2\Lib\site-packages\django-1.7c3-py2.7.egg\django\db\migrat
ions\migration.py", line 107, in apply
operation.database_forwards(self.app_label, schema_editor, project_state, ne
w_state)
File "C:\jython2.7b2\Lib\site-packages\django-1.7c3-py2.7.egg\django\db\migrat
ions\operations\fields.py", line 35, in database_forwards
schema_editor.add_field(
File "C:\jython2.7b2\Lib\site-packages\django-1.7c3-py2.7.egg\django\db\backen
ds\schema.py", line 411, in add_field
self.execute(sql, params)
File "C:\jython2.7b2\Lib\site-packages\django-1.7c3-py2.7.egg\django\db\backen
ds\schema.py", line 98, in execute
cursor.execute(sql, params)
File "C:\jython2.7b2\Lib\site-packages\django-1.7c3-py2.7.egg\django\db\backen
ds\utils.py", line 81, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "C:\jython2.7b2\Lib\site-packages\django-1.7c3-py2.7.egg\django\db\backen
ds\utils.py", line 65, in execute
return self.cursor.execute(sql, params)
File "C:\jython2.7b2\Lib\site-packages\django-1.7c3-py2.7.egg\django\db\utils.
py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "C:\jython2.7b2\Lib\site-packages\django-1.7c3-py2.7.egg\django\db\backen
ds\utils.py", line 65, in execute
return self.cursor.execute(sql, params)
File "C:\jython2.7b2\Lib\site-packages\django_jython-1.7.0b2-py2.7.egg\doj\db\
backends\__init__.py", line 180, in execute
self.cursor.execute(sql, params)
django.db.utils.Error: ERROR: could not determine data type of parameter $1 [SQL
Code: 0], [SQLState: 42P18]