I already have a database called "mydb", where I have a table called "AERODROME".
My models.py looks like this:
from django.db import models class Aerodrome(models.Model): Name = models.CharField(max_length=48) Latitude = models.DecimalField(decimal_places=4, max_digits=7) Longitude = models.DecimalField(decimal_places=4, max_digits=7)
And I have this method on views.py:
from django.shortcuts import render from helloworld.models import Aerodrome def aerodromes(request): return render(request, 'aerodromes.html', {'aerodromes': Aerodrome.objects.all()})
In my templates folder, I have aerodromes.html, which is also pretty simple:
<!doctype html> <html> <head> </head> <body> <table> {% for aerodrome in aerodromes %} <tr> <td>{{ aerodrome.Name }}</td> <td>{{ aerodrome.Longitude }}</td> <td>{{ aerodrome.Latitude }}</td> </tr> {% endfor %} </table> </body> </html>
When I test my browser, I get an error message because it looks like it is accessing a table with the wrong name. My application is called "helloworld" because it is a test, and instead of accessing mydb.AERODROMES it accesses mydb.helloworld_aerodrome (also note the case-sensitive problem).
Since I already had a database, I did not run syncdb (I realized that this was not necessary, but maybe this is a problem).
So, the problem is that I don’t know why it adds “helloworld_” to the name of the table, and also that I still don’t know exactly where I am correcting the name of the table (and from there comes a case-sensitive problem having “airfield ", not" AERODROMS ").
Any help here?