Django 1.7 tutorial: Use generic views

2014-08-30 Thread Pitchblack


I need to use Jython instead of Python, I found that jython2.7b2 works with 
DJango 1.7. So, I am stuck using the beta version. I am trying to follow 
the current Django tutorial and I have ran into a problem. I am not sure if 
I am using generic views properly. When I try to change the urls.py (polls) 
file. I see that pydev complains that views.IndexView, views.DetailView, 
and ResultsView don't exist. Am I doing something wrong? Or did they change 
the way generics work in version 1.7?

My System:

   - Windows 7
   - jython2.7b2
   - Django-1.7c3
   - postgresql-9.3.5-1-windows-x64
   - postgresql-9.3-1102.jdbc41.jar

Here is the url for the tutorial, go to the section "Use generic views: 
Less code is better"
https://docs.djangoproject.com/en/dev/intro/tutorial04/






-- 
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/5be54cfd-ed53-40ca-b7e1-297814c1727d%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

Django 1.7 has issues rendering pages on laptop

2014-09-11 Thread Pitchblack
Hello,

I have installed Debian 7, Jython 2.7b3 and Django 1.7.  After installing 
everything, I ran jython manage.py runserver.  If I have css files and js 
files referenced in the html, the pages don't render.  But the pages use to 
render in the older version of Django.  Does anyone have any ideas?

-- 
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/2e632f5b-4af8-4045-a3b4-242a7af9cf50%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


What's the best way to track created by and modified by in Django 1.7?

2014-09-15 Thread Pitchblack
Hello,

I am sure that I am not the first person to ask this question, but I want 
to know the best way to track who created or modified a record in my 
settings defined within models.py.  Is there something new and great added 
to 1.7 or something that already exists in older versions?


Thank you in advance

-- 
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/a2105ac8-283c-4428-bced-d534857b0c82%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: User Created Objects (models)

2014-09-15 Thread Pitchblack
Is there a way to add the user to the data model, so it knows who created 
the record and who updated it last?

On Sunday, October 20, 2013 5:24:22 PM UTC-7, Ideo Rex wrote:
>
> Hello,
> I'm relatively new to Django. So I have a working (local) web application. 
> I can create new model objects from the admin site, but I would like my 
> users to be able to create their own objects and save them to the database. 
> I'm really confused on the over arching process on how this is down and I 
> would appreciate it if someone could lead me in the correct direction.
>
> I want to allow my users:
> 1. fill in information on a page
> 2. submit this page to the database
> 3. redirect them to a page that reflects their input ("You successfully 
> submitted this {{title}}")
>
> Thanks
>

-- 
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/e5e91694-3637-4fd9-8c3e-0edb4606477e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.