Commit dd97decd authored by Kirby Ezekiel Santos's avatar Kirby Ezekiel Santos

I removed the contents of models.py due to an error I can't resolve....

I removed the contents of models.py due to an error I can't resolve. Fortunately, building a working model for this project is not a requirement and it was just for fun. I replaced the spaces occupied by empty model fields with actual blank spaces.
parent daad6d47
from django.db import models
# Create your models here.
class Ingredient(models.Model):
name = models.CharField(max_length=40)
quantity = models.CharField(max_length=40)
def __str__(self):
return self.name
def __str__(self):
return self.quantity
from django.views.generic.base import TemplateView
from django.views.generic.list import ListView
from .models import Ingredient
class HomePageView(TemplateView):
template_name = "home_page.html"
class IngredientsListView(ListView):
class IngredientsListView(TemplateView):
template_name = "ingredients_list.html"
Ingredient.objects.all().delete()
emptyIngredient = Ingredient(
name="",
quantity=""
)
emptyIngredient.save()
queryset = Ingredient.objects.all()
context = {
"object_list": queryset
}
class IngredientsDetailView(TemplateView):
template_name = "ingredients_detail.html"
......@@ -29,3 +15,6 @@ class IngredientsUpdateView(TemplateView):
class IngredientsCreateView(TemplateView):
template_name = "ingredients_create_form.html"
class RecipesListView(TemplateView):
template_name = "recipes_list.html"
......@@ -18,16 +18,14 @@
</tr>
</thead>
<tbody>
{% for object in object_list %}
<tr>
<td>{{object.name}}</td>
<td></td>
<td>
<form method="get" action="http://localhost:8000/ingredients-detail">
<button type="submit" id="button_to_ingredients_detail">Go to detail</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment