WHERE TO PLACE BUSINESS LOGIC IN DJANGOS' MTV

2014-09-07 Thread Eddilbert Macharia
Hi All,

I have been to post like this 
https://groups.google.com/forum/#!topic/django-users/Ykppb4uELJ4 and other 
places and i'm even more confused than when i started.

Where should the business logic be placed in django, and what should go 
where in the following suggestions below ?

i'm aware of the following suggestions of placing the business logic:

   1.  in the model.py module as custom methods to models to be used in the 
   instances of the model, this i have seen that using the http request and 
   response is a security issue.also placing this business logic here makes 
   this module extreme big.
   2.  custom managers the manager affects the entire database table of the 
   specified model,
   3.  separate module to hold the business logic e.g service.py,


What i have seen in complete unity from the posts is that the business 
logic should not be in the view.py module, as of my understanding its 
supposed to handle http requests and response and delegating templates to 
use.also it becomes hard to do unit testing.

Regards,
Eddilbert Macharia.

-- 
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/77e1a498-8d5f-4f75-bd15-03815b83d51d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Save data from form

2014-09-07 Thread Eddilbert Macharia
Hi Aptem,

Your questions is not clearly what exactly do you want, where are you 
stuck, specifically,
Check this it might assist you 
https://docs.djangoproject.com/en/1.7/topics/forms/

this is a very basic example if you have an organization mode below

models.py

> class Organization(models.Model):
>
name = models.CharField(max_length=25) 

create a forms module and add this
form.py
class NameForm(form.Form):
name = forms.CharField(max_length=25)
 

>  view.py

import the model and form to you view

> def organization_save(request):
> # if this is a POST request we need to process the form data
> if request.method == 'POST':
> # create a form instance and populate it with data from the request:
> form = NameForm(request.POST)
> # check whether it's valid:
> if form.is_valid():
> # process the data in form.cleaned_data as required
>
> cleaned_name = form.cleaned_data['name'] 

> # save form if its new organization creation
>
>  organization = Organization.objects.create(name=cleaned_name)
# if its an existing organizanization
organization = Organization.objects.get(id='the id of the organization')
organization .name = cleaned_name
organization .save()

> # redirect to a new URL:
> return HttpResponseRedirect('/thanks/')
>
> # if a GET (or any other method) we'll create a blank form
> else:
> form = NameForm()
>
> return render(request, 'name.html', {'form': form})
>
>

there is an easier way of doing this by use of modelforms check this out  
https://docs.djangoproject.com/en/1.7/topics/forms/modelforms/

Hope it assists you.

Regards,
Eddilbert Macharia.

-- 
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/29ee3516-d1a2-4840-85e7-018c1c7d8c1e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django.models problem

2014-09-07 Thread Shangui Ren
os:win7 64bit
database:mysql

I use django mdoels to create imagefield field in a table,but when i use 
"python manage.py sqlall books" command it print the fllowing error:

Traceback (most recent call last):
  File "manage.py", line 10, in 
execute_from_command_line(sys.argv)
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", 
line
399, in execute_from_command_line
utility.execute()
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", 
line
392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 
242,
 in run_from_argv
self.execute(*args, **options.__dict__)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 
284,
 in execute
self.validate()
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 
310,
 in validate
num_errors = get_validation_errors(s, app)
  File 
"C:\Python27\lib\site-packages\django\core\management\validation.py", lin
e 113, in get_validation_errors
from django.utils.image import Image
  File "C:\Python27\lib\site-packages\django\utils\image.py", line 154, in 

Image, _imaging, ImageFile = _detect_image_library()
  File "C:\Python27\lib\site-packages\django\utils\image.py", line 108, in 
_dete
ct_image_library
_("Neither Pillow nor PIL could be imported: %s") % err
django.core.exceptions.ImproperlyConfigured: Neither Pillow nor PIL could 
be imp
orted: No module named Image

-- 
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/592ad0ea-47ed-4f8f-9514-5295d4e01238%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Save data from form

2014-09-07 Thread Артём Мутерко
Thank you a lot for reply. I thought I could cover Django on fly, but it 
seems like I have to read some books before. Anyway thank you very much!

воскресенье, 7 сентября 2014 г., 10:50:55 UTC+3 пользователь Eddilbert 
Macharia написал:
>
> Hi Aptem,
>
> Your questions is not clearly what exactly do you want, where are you 
> stuck, specifically,
> Check this it might assist you 
> https://docs.djangoproject.com/en/1.7/topics/forms/
>
> this is a very basic example if you have an organization mode below
>
> models.py
>
>> class Organization(models.Model):
>>
> name = models.CharField(max_length=25) 
>
> create a forms module and add this
> form.py
> class NameForm(form.Form):
> name = forms.CharField(max_length=25)
>  
>
>>  view.py
>
> import the model and form to you view
>
>> def organization_save(request):
>> # if this is a POST request we need to process the form data
>> if request.method == 'POST':
>> # create a form instance and populate it with data from the request:
>> form = NameForm(request.POST)
>> # check whether it's valid:
>> if form.is_valid():
>> # process the data in form.cleaned_data as required
>>
>> cleaned_name = form.cleaned_data['name'] 
>
>> # save form if its new organization creation
>>
>>  organization = Organization.objects.create(name=cleaned_name)
> # if its an existing organizanization
> organization = Organization.objects.get(id='the id of the organization')
> organization .name = cleaned_name
> organization .save()
>
>> # redirect to a new URL:
>> return HttpResponseRedirect('/thanks/')
>>
>> # if a GET (or any other method) we'll create a blank form
>> else:
>> form = NameForm()
>>
>> return render(request, 'name.html', {'form': form})
>>
>>
>
> there is an easier way of doing this by use of modelforms check this out  
> https://docs.djangoproject.com/en/1.7/topics/forms/modelforms/
>
> Hope it assists you.
>
> Regards,
> Eddilbert Macharia.
>
>

-- 
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/61b0994b-5d25-4ef1-bac7-23475e33f745%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django.models problem

2014-09-07 Thread youngershen
easy_install PIL may be solve your problem
在 2014年9月7日,下午4:41,Shangui Ren  写道:

> os:win7 64bit
> database:mysql
> 
> I use django mdoels to create imagefield field in a table,but when i use 
> "python manage.py sqlall books" command it print the fllowing error:
> 
> Traceback (most recent call last):
>   File "manage.py", line 10, in 
> execute_from_command_line(sys.argv)
>   File "C:\Python27\lib\site-packages\django\core\management\__init__.py", 
> line
> 399, in execute_from_command_line
> utility.execute()
>   File "C:\Python27\lib\site-packages\django\core\management\__init__.py", 
> line
> 392, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "C:\Python27\lib\site-packages\django\core\management\base.py", line 
> 242,
>  in run_from_argv
> self.execute(*args, **options.__dict__)
>   File "C:\Python27\lib\site-packages\django\core\management\base.py", line 
> 284,
>  in execute
> self.validate()
>   File "C:\Python27\lib\site-packages\django\core\management\base.py", line 
> 310,
>  in validate
> num_errors = get_validation_errors(s, app)
>   File "C:\Python27\lib\site-packages\django\core\management\validation.py", 
> lin
> e 113, in get_validation_errors
> from django.utils.image import Image
>   File "C:\Python27\lib\site-packages\django\utils\image.py", line 154, in 
>  le>
> Image, _imaging, ImageFile = _detect_image_library()
>   File "C:\Python27\lib\site-packages\django\utils\image.py", line 108, in 
> _dete
> ct_image_library
> _("Neither Pillow nor PIL could be imported: %s") % err
> django.core.exceptions.ImproperlyConfigured: Neither Pillow nor PIL could be 
> imp
> orted: No module named Image
> 
> -- 
> 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/592ad0ea-47ed-4f8f-9514-5295d4e01238%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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/19A50F0D-A307-4429-9E87-1C0084E7E68F%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django.models problem

2014-09-07 Thread Martin Spasov
or easy_install pip
and then pip install pillow

why use pip instead of easy_install can be seen here 


Martin!

-- 
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/8b8d74b3-ce59-41bf-bc80-7c0c1dfa8a4d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Does Django detect changes in models Meta ?

2014-09-07 Thread Malik Rumi
Django 1.7rc2 here. Same question, same hope for an answer. It may be that 
not all possible changes to a model are intended to be picked up. For 
example, I created all my models directly in 1.7rc2, and I have not changed 
any fields. What I have done is changed / added some meta and methods. 
Maybe these changes don't 'count'? 

Your models will be scanned and compared to the versions currently 
> contained in your migration files, and then a new set of migrations will be 
> written out. Make sure to read the output to see what makemigrations thinks 
> you have changed - it’s not perfect, and for complex changes it might not 
> be detecting what you expect.


and

Migrations are Django’s way of propagating changes you make to your models 
(*adding 
> a field, deleting a model,* etc.)


 So it might be that unless you change something that actually hits the 
database, there won't be anything to migrate, and that makes sense, but it 
would be nice if someone with expertise, experience, and inside knowledge 
could confirm and explain that. 

On Tuesday, September 2, 2014 3:16:45 PM UTC-5, David Los wrote:
>
> Very, very good question. I am experiencing the same issues with Django 
> 1.7rc2 and 1.7rc3.
>
> Syncdb and sql statements are intended for Django < 1.7.
>
> Would love to hear a solution!
>
> Op vrijdag 22 augustus 2014 09:32:43 UTC+2 schreef termopro:
>>
>> Hi there,
>>
>> I am using Django 1.7 RC2.
>> I have created models and have run all the migrations so Django created 
>> tables in database.
>> Now i decided to change database table names and have added Meta class to 
>> models containing table name:
>>
>> class SomeModel(models.Model):
>>...
>>class Meta:
>>   db_table = 'newname'
>>
>> Now when i run "makemigrations" Django doesn't detect any changes in 
>> models:
>> "No changes detected in app 'blabla'."
>> As far as i understand the logic, Django should change table names from 
>> 'appname_somemodel" to "newname".
>>
>> Is this an expected behavior or i am missing something?
>>
>

-- 
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/c618d499-a1a0-4cbc-953c-0e14bb8f9d59%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: deploying django on heroku

2014-09-07 Thread Kevin Ndung'u
As it says, just run those commands, setting your username and email, to 
set your git identity (Username and Email address) which is required for 
commits.

On Saturday, September 6, 2014 1:21:09 PM UTC+3, ngangsia akumbo wrote:
>
> i have another error
>
> yems python-getting-started # git commit -m "Demo"
>
> *** Please tell me who you are.
>
> Run
>
>   git config --global user.email "y...@example.com "
>   git config --global user.name "Your Name"
>
> to set your account's default identity.
> Omit --global to set the identity only in this repository.
>
> fatal: unable to auto-detect email address (got 'root@yems.(none)')
>
>
> On Friday, September 5, 2014 4:10:59 PM UTC+1, Koed00 wrote:
>>
>> Looks like Gunicorn can't find your app module hellodjango.wsgi
>> Did you make a wsgi.py in your app folder as described in the Heroku docs?
>>
>> On Friday, September 5, 2014 12:19:25 PM UTC+2, ngangsia akumbo wrote:
>>>
>>> i had a problem trying to deply django on heroku
>>>
>>> yems bphotel # foreman start
>>> 11:13:37 web.1  | started with pid 9269
>>> 11:13:37 web.1  | [2014-09-05 11:13:37 +] [9269] [INFO] Starting 
>>> gunicorn 19.1.1
>>> 11:13:37 web.1  | [2014-09-05 11:13:37 +] [9269] [INFO] Listening 
>>> at: http://0.0.0.0:5000 (9269)
>>> 11:13:37 web.1  | [2014-09-05 11:13:37 +] [9269] [INFO] Using 
>>> worker: sync
>>> 11:13:37 web.1  | [2014-09-05 11:13:37 +] [9276] [INFO] Booting 
>>> worker with pid: 9276
>>> 11:13:37 web.1  | [2014-09-05 11:13:37 +] [9276] [ERROR] Exception 
>>> in worker process:
>>> 11:13:37 web.1  | Traceback (most recent call last):
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 507, in 
>>> spawn_worker
>>> 11:13:37 web.1  | worker.init_process()
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 
>>> 114, in init_process
>>> 11:13:37 web.1  | self.wsgi = self.app.wsgi()
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/app/base.py", line 66, in 
>>> wsgi
>>> 11:13:37 web.1  | self.callable = self.load()
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 65, 
>>> in load
>>> 11:13:37 web.1  | return self.load_wsgiapp()
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 52, 
>>> in load_wsgiapp
>>> 11:13:37 web.1  | return util.import_app(self.app_uri)
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/util.py", line 356, in 
>>> import_app
>>> 11:13:37 web.1  | __import__(module)
>>> 11:13:37 web.1  | ImportError: No module named hellodjango.wsgi
>>> 11:13:37 web.1  | Traceback (most recent call last):
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 507, in 
>>> spawn_worker
>>> 11:13:37 web.1  | worker.init_process()
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 
>>> 114, in init_process
>>> 11:13:37 web.1  | self.wsgi = self.app.wsgi()
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/app/base.py", line 66, in 
>>> wsgi
>>> 11:13:37 web.1  | self.callable = self.load()
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 65, 
>>> in load
>>> 11:13:37 web.1  | return self.load_wsgiapp()
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 52, 
>>> in load_wsgiapp
>>> 11:13:37 web.1  | return util.import_app(self.app_uri)
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/util.py", line 356, in 
>>> import_app
>>> 11:13:37 web.1  | __import__(module)
>>> 11:13:37 web.1  | ImportError: No module named hellodjango.wsgi
>>> 11:13:37 web.1  | [2014-09-05 11:13:37 +] [9276] [INFO] Worker 
>>> exiting (pid: 9276)
>>> 11:13:37 web.1  | Traceback (most recent call last):
>>> 11:13:37 web.1  |   File "/usr/local/bin/gunicorn", line 11, in 
>>> 11:13:37 web.1  | sys.exit(run())
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 74, 
>>> in run
>>> 11:13:37 web.1  | WSGIApplication("%(prog)s [OPTIONS] 
>>> [APP_MODULE]").run()
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/app/base.py", line 185, in 
>>> run
>>> 11:13:37 web.1  | super(Application, self).run()
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/app/base.py", line 71, in 
>>> run
>>> 11:13:37 web.1  | Arbiter(self).run()
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 169, in 
>>> run
>>> 11:13:37 web.1  | self.manage_workers()
>>> 11:13:37 web.1  |   File 
>>> "/usr/local/lib/python2.7/dist-packages/guni

How to express a seemingly straightforward upate in the ORM?

2014-09-07 Thread Benjamin Scherrey
I've got an application that needs to frequently update a boolean value
(ChannelItem.channel_stocks) against a temporary table that gets created
and lives just long enough for this transaction. The table is simply a list
of alpha-num skus and created like this:

cursor.execute("create temporary table skus (sku varchar);")  # Postgres
only
cursor.execute("insert into skus (sku) values %s;" % skus)

This temporary table will hold, at various times, anywhere from 300 to
300,000 items so my preference is a 'join' and not an 'in' filter as that's
not likely to be performant at the higher end of that scale.

The ChannelItem model relates to the Partner, Channel, and Item models and
is filtered for just the specific Partner/Channel pair that we care about
via a for_partner_channel() filter. What I need is to perform the update
for the 'ChannelItem.channel_stocks' value only if the related 'Item.sku'
is one of the 'sku' in temporary table 'skus'. The following is the
cleanest generating SQL I can come up with via the ORM but I can't figure
out how to do a join/limit to only those items that are present in the
temporary table:

ChannelItem.objects().for_partner_channel(mp,mc).select_related('item').select_related('partner').select_related('channel').extra(tables='skus').update(channel_stocks=True)

It seemed that the .extra(join=...) proposal that has been rejected is the
obvious solution. Since that's not an option, what is the correct way to do
this?

This seems to me to be a very common kind of operation that one might
encounter so I'm surprised it's so difficult (or perhaps less surprised
that I just can't figure it out) to represent this operation in the Django
ORM. Appreciate any advice otherwise I have to go full raw with this which
I'd really prefer not to do.

BTW - if I leave out any of those select_related chains from the above
request my number of SQL requests goes up from 1 to hundreds.

thanx,

  -- Ben

-- 
Chief Systems Architect Proteus Technologies 
Chief Fan Biggest Fan Productions 
Personal blog where I am not your demographic
.

This email intended solely for those who have received it. If you have
received this email by accident - well lucky you!!

-- 
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/CAHN%3D9D6GktR1aFX-UbbBQhS5WxScQ%2BG8Wpvm9T0Uh%3D1KujkHzw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Save data from form

2014-09-07 Thread Eddilbert Macharia
Hello,

Your welcome, its not that difficult to wrap head around django though, 
just patience is required

Regards,
Eddilbert Macharia.

-- 
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/f8443d32-849f-4b1f-aacb-b2e261d76372%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django-jython: I am getting an error when I run the migrate command on Jython-Django 1.7

2014-09-07 Thread Pitchblack


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 


For more details about django on jython and the database settings. postgresql 
on jython-django 

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 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/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 
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, f