0

I have a django south created table "tablename", I want to acess it from django views, like this.

from myapp.models import*
def function(request):
    a=Tablename.objects.all()
    return

but this shaows an error "global name 'Tablename' is not defined" can anyone help me to access south created table from django views. thanks

vipin
  • 670
  • 2
  • 9
  • 25
  • What do you mean "south created"? If there is no model for this table you have to make sql queries yourself else be sure that `from myapp.models import*` imports `Tablename` – iskorum Jun 17 '14 at 09:10
  • south created means there is no model in models.py but table is created using django south – vipin Jun 17 '14 at 09:17
  • if there is no relation between table and django, so you have to make queries yourself; http://stackoverflow.com/questions/372885/how-do-i-connect-to-a-mysql-database-in-python – iskorum Jun 17 '14 at 09:26
  • its postgres i'm using – vipin Jun 17 '14 at 09:31
  • :D I haven't use it so far but maybe this helps; https://wiki.postgresql.org/wiki/Python – iskorum Jun 17 '14 at 09:49

0 Answers0