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 from django.db import models
# Create your models here. # 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.base import TemplateView
from django.views.generic.list import ListView from django.views.generic.list import ListView
from .models import Ingredient
class HomePageView(TemplateView): class HomePageView(TemplateView):
template_name = "home_page.html" template_name = "home_page.html"
class IngredientsListView(ListView): class IngredientsListView(TemplateView):
template_name = "ingredients_list.html" 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): class IngredientsDetailView(TemplateView):
template_name = "ingredients_detail.html" template_name = "ingredients_detail.html"
...@@ -29,3 +15,6 @@ class IngredientsUpdateView(TemplateView): ...@@ -29,3 +15,6 @@ class IngredientsUpdateView(TemplateView):
class IngredientsCreateView(TemplateView): class IngredientsCreateView(TemplateView):
template_name = "ingredients_create_form.html" template_name = "ingredients_create_form.html"
class RecipesListView(TemplateView):
template_name = "recipes_list.html"
...@@ -18,16 +18,14 @@ ...@@ -18,16 +18,14 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for object in object_list %}
<tr> <tr>
<td>{{object.name}}</td> <td></td>
<td> <td>
<form method="get" action="http://localhost:8000/ingredients-detail"> <form method="get" action="http://localhost:8000/ingredients-detail">
<button type="submit" id="button_to_ingredients_detail">Go to detail</button> <button type="submit" id="button_to_ingredients_detail">Go to detail</button>
</form> </form>
</td> </td>
</tr> </tr>
{% endfor %}
</tbody> </tbody>
</table> </table>
</div> </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