I might be wrong here, but this is what I understand:
Let's say you have something like this:
class Recipe(models.Model):
name = models.CharField(max_length=255)
description = models.TextField()
class Step(models.Model):
step_number = models.IntegerField()
description =
You could do something like this:
def detail(request, pk):
recipe = Recipe.objects.get(id=pk)
steps = Steps.objects.filter(recipe_id=pk)
template = loader.get_template('recipe/recipe_detail.html')
context = {
'recipe': recipe,
'steps': steps
}
return
You could do something like this:
Instead of
recipe['steps'] = Steps.objects.filter(recipe_id=pk)
Do this:
steps = Steps.objects.filter(recipe_id=pk)
context = {
'recipe': recipe,
}
On Monday, February 29, 2016 at 1:00:25 AM UTC+5:30, Simon Gunacker wrote:
>
> Dear Django
I haven't had a look at the github link, but if all you want to do is to
display plots (I'm assuming these are images) and text files, then all you
need to do is to serve these files from the views to the templates.
You can store these plots/text files in a directory which is accessible to
4 matches
Mail list logo