Okay, so I've written a script that grabs the BBC navigation headers and saves them into a CSV. I was thinking from that I can write them into a database but maybe I have to do that from an outside process. ie, write a new file outside of models.py and reference it...
That is to say write write my model elements so
models.py
storedNav.py
views.py
That is to say write write my model elements so
models.py
class BBCHEaders(models.Model): nBBC = models.CharField(max_length=200)And then have a new module something like:
storedNav.py
from .models import BBCHeaders.nBBC def writeBBC with open('C:\\...app\\Headings\\BBCHeadings.csv') as f: freader = csv.DictReader(f, delimiter=',') for r in freader: nBBC.create(r['Heading'])I am wondering if this would write to the nBBC model database and then I can refer to it with the views.py.
views.py
from .storedNav import writeBBC from .models import BBCHeaders class BBCView(generic.ListView): writeBBC() model = BBCHeaders template_name = 'news/BBCNews.html'