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 <
[email protected]> 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 451Python 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/#>
>    - /Library/Python/2.7/site-packages/django/template/loader_tags.py in
>    render
>    1.
>
>                   result = block.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/defaulttags.py in
>    render
>    1.
>
>               len_values = len(values)
>
>       ...
>    ▶ Local vars <http://127.0.0.1:8000/addressbook/#>
>    - /Library/Python/2.7/site-packages/django/db/models/query.py in
>    __len__
>    1.
>
>               self._fetch_all()
>
>       ...
>    ▶ Local vars <http://127.0.0.1:8000/addressbook/#>
>    - /Library/Python/2.7/site-packages/django/db/models/query.py in
>    _fetch_all
>    1.
>
>                   self._result_cache = list(self.iterator())
>
>       ...
>    ▶ Local vars <http://127.0.0.1:8000/addressbook/#>
>    - /Library/Python/2.7/site-packages/django/db/models/query.py in
>    iterator
>    1.
>
>               for row in compiler.results_iter():
>
>       ...
>    ▶ Local vars <http://127.0.0.1:8000/addressbook/#>
>    - /Library/Python/2.7/site-packages/django/db/models/sql/compiler.py
>     in results_iter
>    1.
>
>               for rows in self.execute_sql(MULTI):
>
>       ...
>    ▶ Local vars <http://127.0.0.1:8000/addressbook/#>
>    - /Library/Python/2.7/site-packages/django/db/models/sql/compiler.py
>     in execute_sql
>    1.
>
>               cursor.execute(sql, params)
>
>       ...
>    ▶ Local vars <http://127.0.0.1:8000/addressbook/#>
>    - /Library/Python/2.7/site-packages/django/db/backends/util.py in
>    execute
>    1.
>
>                   return super(CursorDebugWrapper, self).execute(sql, params)
>
>       ...
>    ▶ Local vars <http://127.0.0.1:8000/addressbook/#>
>    - /Library/Python/2.7/site-packages/django/db/backends/util.py in
>    execute
>    1.
>
>                       return self.cursor.execute(sql, params)
>
>       ...
>    ▶ Local vars <http://127.0.0.1:8000/addressbook/#>
>    - /Library/Python/2.7/site-packages/django/db/utils.py in __exit__
>    1.
>
>                       six.reraise(dj_exc_type, dj_exc_value, traceback)
>
>       ...
>    ▶ Local vars <http://127.0.0.1:8000/addressbook/#>
>    - /Library/Python/2.7/site-packages/django/db/backends/util.py in
>    execute
>    1.
>
>                       return self.cursor.execute(sql, params)
>
>       ...
>    ▶ Local vars <http://127.0.0.1:8000/addressbook/#>
>    - /Library/Python/2.7/site-packages/django/db/backends/sqlite3/base.py
>     in execute
>    1.
>
>               return Database.Cursor.execute(self, query, params)
>
>       ...
>    ▶ Local vars <http://127.0.0.1:8000/addressbook/#>
>
>
>
>
>
> some guys on stack over flow were suggesting to resync the database or use
> south so, I tried both but it didn't work.
>
> when I tried to migrate(though I don't know what it is) the database using
> south it gave me an error below
>
> error message
>
> django.db.utils.OperationalError: table "contacts_contact" already exists
>
>
> OK so there is a table but no colums in it.what does that suppose to mean
> and what can I do to solve this problem?
>
> Please help me
>
>
>
>
>  --
> 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/f695c7f8-29b7-4f49-8497-807627775497%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/f695c7f8-29b7-4f49-8497-807627775497%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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 [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/CAM-7rO06Tm%3DfAZKUooAD3g%3D%3DikBi%2B3dpmsx9M2jAvRxvXwrnaQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to