I made two models on models.py

they are Contacts and Address

along with this http://effectivedjango.com/tutorial/related.html page I 
tried to use the both of this models.
Which means Address model under the Contact model.

The authentication stuff that I had problem with went well after I 
commented out all codes related to Address model.

So I guessed that the error came out of this and tried to fix things out of 
it but nothing went well


quite a dead end for me  hmmm


2014年6月7日土曜日 20時00分49秒 UTC+9 yutaka kobayashi:
>
> hmmm
>
> I tried that but the first error i saw came back on terminal
>
>
> django.db.utils.OperationalError: table "contacts_contact" already exists
>
>
> this is weird.
>
> 2014年6月7日土曜日 19時30分49秒 UTC+9 Andromeda Yelton:
>
> It sounds to me like south has not been fully configured yet, so the 
> migrations aren't working right.  Have you done a manage.py syncdb?  You 
> need to do that to create the south_migrationhistory table before manage.py 
> migrate will be effective: 
> http://south.readthedocs.org/en/latest/installation.html#configuring-your-django-installation
>  
> .
>
> south can be a little finicky to get started with but once you've got the 
> hang of it it will be your best friend; do spend some quality time reading 
> its docs if you haven't yet.  If you've found yourself in a state where 
> your database and south's beliefs about your database are out of sync, 
> you'll be happiest just dropping your database and starting over with it.
>
>
> On Sat, Jun 7, 2014 at 5:58 AM, yutaka kobayashi <
> yutaka.k...@todai-dream-net.com> wrote:
>
> thank you so much for your advice!!
>
> i tried the number1 option but it didn't work
>
> when i try to migrate it gave me an error
>
>
> ---------
>
> $ python manage.py migrate
>
> Traceback (most recent call last):
>
>   File "manage.py", line 10, in <module>
>
>     execute_from_command_line(sys.argv)
>
>   File 
> "/Library/Python/2.7/site-packages/django/core/management/__init__.py", 
> line 399, in execute_from_command_line
>
>     utility.execute()
>
>   File 
> "/Library/Python/2.7/site-packages/django/core/management/__init__.py", 
> line 392, in execute
>
>     self.fetch_command(subcommand).run_from_argv(self.argv)
>
>   File "/Library/Python/2.7/site-packages/django/core/management/base.py", 
> line 242, in run_from_argv
>
>     self.execute(*args, **options.__dict__)
>
>   File "/Library/Python/2.7/site-packages/django/core/management/base.py", 
> line 285, in execute
>
>     output = self.handle(*args, **options)
>
>   File 
> "/Library/Python/2.7/site-packages/South-0.8.4-py2.7.egg/south/management/commands/migrate.py",
>  
> line 111, in handle
>
>     ignore_ghosts = ignore_ghosts,
>
>   File 
> "/Library/Python/2.7/site-packages/South-0.8.4-py2.7.egg/south/migration/__init__.py",
>  
> line 200, in migrate_app
>
>     applied_all = check_migration_histories(applied_all, delete_ghosts, 
> ignore_ghosts)
>
>   File 
> "/Library/Python/2.7/site-packages/South-0.8.4-py2.7.egg/south/migration/__init__.py",
>  
> line 79, in check_migration_histories
>
>     for h in histories:
>
>   File "/Library/Python/2.7/site-packages/django/db/models/query.py", line 
> 96, in __iter__
>
>     self._fetch_all()
>
>   File "/Library/Python/2.7/site-packages/django/db/models/query.py", line 
> 857, in _fetch_all
>
>     self._result_cache = list(self.iterator())
>
>   File "/Library/Python/2.7/site-packages/django/db/models/query.py", line 
> 220, in iterator
>
>     for row in compiler.results_iter():
>
>   File 
> "/Library/Python/2.7/site-packages/django/db/models/sql/compiler.py", line 
> 713, in results_iter
>
>     for rows in self.execute_sql(MULTI):
>
>   File 
> "/Library/Python/2.7/site-packages/django/db/models/sql/compiler.py", line 
> 786, in execute_sql
>
>     cursor.execute(sql, params)
>
>   File "/Library/Python/2.7/site-packages/django/db/backends/util.py", 
> line 69, in execute
>
>     return super(CursorDebugWrapper, self).execute(sql, params)
>
>   File "/Library/Python/2.7/site-packages/django/db/backends/util.py", 
> line 53, in execute
>
>     return self.cursor.execute(sql, params)
>
>   File "/Library/Python/2.7/site-packages/django/db/utils.py", line 99, in 
> __exit__
>
>     six.reraise(dj_exc_type, dj_exc_value, traceback)
>
>   File "/Library/Python/2.7/site-packages/django/db/backends/util.py", 
> line 53, in execute
>
>     return self.cursor.execute(sql, params)
>
>   File 
> "/Library/Python/2.7/site-packages/django/db/backends/sqlite3/base.py", 
> line 451, in execute
>
>     return Database.Cursor.execute(self, query, params)
>
> django.db.utils.OperationalError: no such table: south_migrationhistory
>
> ---------
>
> this whole error message is completely alian to me..
>
>
> as for option number2 I didn't have enough knowledge to comprehend but is 
> it possible to create field from terminal?
>
> I don't know how..
>
> thanks for your help in advance
>
>
>
> 2014年6月6日金曜日 23時52分07秒 UTC+9 sacrac:
>
> Hi, 2 choice 
>
> 1. erase de database y create again the migration:
>  
> $rm database && rm -r addressbook/migrations
> $./manage.py schemamigration addressbook --initial
> $./manage.py migrate
>
> 2. create manually fields owner_id enter terminal or console i see you 
> use sqlite3
>
> i recomended install this addons in firefox for managed database sqlite3 
> if you no like use console
> https://addons.mozilla.org/es/firefox/addon/sqlite-manager/
>
> Cheers
>
>
> On Fri, Jun 6, 2014 at 1:57 AM, yutaka kobayashi <yutaka.k...@todai-dream-
> net.com> wrote:
>
>
> hello I'm quite new to django and I'm working on it through following 
> tutorials and stuff.
>
> I'm currently working on this tutorial 
>
> http://effectivedjango.com/tutorial/authzn.html
>
> I'm following the exact code on this page (this page was written for 
> django1.5 so actually I amended a few things to match for django1.6)
>
> It goes perfectly well untill making login page and giving authentication 
> to the user.
> But when it comes to giving authorization like below it gives an error
>
> from django.contrib.auth.decorators import login_requiredfrom 
> django.utils.decorators import method_decoratorclass LoggedInMixin(object):
>
>     @method_decorator(login_required)
>     def dispatch(self, *args, **kwargs):
>         return super(LoggedInMixin, self).dispatch(*args, **kwargs)
>
>
>
>
> class ListContactView(LoggedInMixin, ListView):
>
>     model = Contact
>     template_name = 'contact_list.html'
>
>     def get_queryset(self):
>
>         return Contact.objects.filter(owner=self.request.user)
>
> the error message is like this
>
> OperationalError at /addressbook/
>
> no such column: contacts_contact.owner_id
>
>  Request Method:GET Request URL:http://127.0.0.1:8000/addressbook/ Django 
> Version:1.6.5Exception Type: OperationalErrorException Value:
>
> no such column: contacts_contact.owner_id
>
> Exception Location: 
> /Library/Python/2.7/site-packages/django/db/backends/sqlite3/base.py 
> in execute, line 451 Python Executable: /usr/bin/pythonPython Version: 
> 2.7.5Python Path:
>
> ['/Users/kobayashiyutaka/Documents/shannonlab/addressbook',
>  '/Library/Python/2.7/site-packages/openpyxl-1.6.2-py2.7.egg',
>  '/Library/Python/2.7/site-packages/setuptools-1.1.6-py2.7.egg',
>  '/Library/Python/2.7/site-packages/httplib2-0.8-py2.7.egg',
>  '/Library/Python/2.7/site-packages/oauth2-1.5.211-py2.7.egg',
>  '/Library/Python/2.7/site-packages/python_twitter-1.1-py2.7.egg',
>  '/Library/Python/2.7/site-packages/requests_oauthlib-0.4.0-py2.7.egg',
>  '/Library/Python/2.7/site-packages/requests-2.0.0-py2.7.egg',
>  '/Library/Python/2.7/site-packages/oauthlib-0.6.0-py2.7.egg',
>  '/Library/Python/2.7/site-packages/South-0.8.4-py2.7.egg',
>  '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
>  '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
>  '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
>  
> '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC',
>  '/Library/Python/2.7/site-packages']
>
> Server time: Wed, 4 Jun 2014 14:55:13 +0000
> Error during template rendering
>
> In template /Users/kobayashiyutaka/Documents/shannonlab/addressbook/
> contacts/templates/contacts/contact_list.html, error at line *7*
> no such column: contacts_contact.owner_id 1{% extends "base.html" %} 2 3 
> {% block content %} 4 <h1>contact list</h1> 5 6 <ul 
> style="list-style-type: none"> 7 {% for contact in object_list %} 8 <li 
> class="contact"> 9 <a href="{{ contact.get_absolute_url }}">{{ contact 
> }}</a> 10 (<a href="{% url "contacts-edit" pk=contact.id %}">edit</a>) 11 
> </li> 12 {% endfor %} 13 </ul> 14 15 <a href="{% url "contacts-new" 
> %}">add contact</a> 16 {% endblock %} 17 
> Traceback Switch to copy-and-paste view 
> <http://127.0.0.1:8000/addressbook/#> 
>
>    - /Library/Python/2.7/site-packages/django/core/handlers/base.py in 
>    get_response
>    1. 
>       
>                       response = response.render()
>       
>       ...
>    ▶ Local vars <http://127.0.0.1:8000/addressbook/#>
>    - /Library/Python/2.7/site-packages/django/template/response.py in 
>    render
>    1. 
>       
>                   self.content = self.rendered_content
>       
>       ...
>    ▶ Local vars <http://127.0.0.1:8000/addressbook/#>
>    - /Library/Python/2.7/site-packages/django/template/response.py in 
>    rendered_content
>    1. 
>       
>               content = template.render(context)
>       
>       ...
>    ▶ Local vars <http://127.0.0.1:8000/addressbook/#>
>    - /Library/Python/2.7/site-packages/django/template/base.py in render
>    1. 
>       
>                   return self._render(context)
>       
>       ...
>    ▶ Local vars <http://127.0.0.1:8000/addressbook/#>
>    - /Library/Python/2.7/site-packages/django/template/base.py in _render
>    1. 
>       
>               return self.nodelist.render(context)
>       
>       ...
>    ▶ Local vars <http://127.0.0.1:8000/addressbook/#>
>    - /Library/Python/2.7/site-packages/django/template/base.py in render
>    1. 
>       
>                       bit = self.render_node(node, context)
>       
>       ...
>    ▶ Local vars <http://127.0.0.1:8000/addressbook/#>
>    - /Library/Python/2.7/site-packages/django/template/debug.py in 
>    render_node
>    1. 
>       
>                   return node.render(context)
>       
>       ...
>    ▶ Local vars <http://127.0.0.1:8000/addressbook/#>
>    - /Library/Python/2.7/site-packages/django/template/loader_tags.py in 
>    render
>    1. 
>       
>               return compiled_parent._render(context)
>       
>       ...
>    ▶ Local vars <http://127.0.0.1:8000/addressbook/#>
>    - /Library/Python/2.7/site-packages/django/template/base.py in _render
>    1. 
>       
>               return self.nodelist.render(context)
>       
>       ...
>    ▶ Local vars <http://127.0.0.1:8000/addressbook/#>
>    - /Library/Python/2.7/site-packages/django/template/base.py in render
>    1. 
>       
>                       bit = self.render_node(node, context)
>       
>       ...
>    ▶ Local vars <http://127.0.0.1:8000/addressbook/#>
>    - /Library/Python/2.7/site-packages/django/template/debug.py in 
>    render_node
>    1. 
>       
>                   return node.render(context)
>       
>       ...
>    ▶ Local vars <http://127.0.0.1:8000/addressbook/#>
>    <li style="padding:0px 0px 1em;marg
>
> ...

-- 
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/da9b53ea-ebd0-428e-a2d3-a4bad35d7a11%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to