2

I am making a DMS(Document Management System). So, I need to upload various files. I followed the process as provided in this link.

But unfortunately i am getting an error

Exception Type:DatabaseError

Exception Value: no such table: login_document

It shows that there is an error in template :-

Error during template rendering

In template E:\java\prafuldms\templates\login\list.html, error at line 9

The line 9 is

{% if documents  %}      ///in list.html

What could possibly go wrong? Any suggestions.

Community
  • 1
  • 1
Praful Bagai
  • 16,684
  • 50
  • 136
  • 267

3 Answers3

2

look at documentation examples here

MineScript
  • 291
  • 1
  • 4
  • Everything is working fine now except when it uploads the documents it does not reverts back to the list of documents uploaded, instead it throws an error NoReverseMatch Exception Value: Reverse for 'login.views.list' with arguments '()' and keyword arguments '{}' not found. Any idea on the same? – Praful Bagai Jun 24 '13 at 00:07
2

I got it.

In django advanced versions, we need to import differently, ie by providing the relative path.

In views.py use relative url to import modules

Replace

from myproject.myapp.models import Document
from myproject.myapp.forms import DocumentForm

By

from models import Document
from apps.login.forms import DocumentForm
Praful Bagai
  • 16,684
  • 50
  • 136
  • 267
1

documents apparently is a QuerySet. That queryset is evaluated lazily, during template rendering. Unfortunately, it maps to a database table that does not exist.

Here's what happens:

At template rendering time, Django needs to know whether documents is empty or not.

To know that information, Django needs to access the database.

Django makes a query to the database, but the table does not exist.

Solution

You need to create the database table. Did you create models.py? Did you run ./manage.py syncdb?

Thomas Orozco
  • 53,284
  • 11
  • 113
  • 116
  • Yaa I know that django is querying the database for documents. I did run the syncdb command. But it still shows the same error. – Praful Bagai Jun 23 '13 at 23:33
  • Any suggestions... I cant see any error in the code, but still not being able to run it. – Praful Bagai Jun 23 '13 at 23:41
  • I got it. In django advanced versions, we need to import differently, ie by providing the relative path. In views.py import models and forms using relative url. – Praful Bagai Jun 23 '13 at 23:52
  • Everything is working fine except when it uploads the documents it does not reverts back to the list of documents uploaded, instead it throws an error NoReverseMatch Exception Value: Reverse for 'login.views.list' with arguments '()' and keyword arguments '{}' not found. Any idea on the same? – Praful Bagai Jun 24 '13 at 00:06