Absolute beginner question -- recipes

2016-02-28 Thread Simon Gunacker
Dear Django Community, as a first django project I tried to write a site to manage cooking recipes. My model is quite simple: * 1 recipe has n steps * 1 step has a description and n ingredients, each of a certain amount defined by a certain unit all in all, I have 5 tables (Recipe, Step, In

Re: Absolute beginner question -- recipes

2016-02-28 Thread Simon Gunacker
Thank you Rahul, I actually tried that an this is possible for the relationship between a recipe and its steps. But when it comes to the ingredients for a single step, I cannot do this any more since the ingredients depend on steps again. After reading your suggestion I thought about it once mo

Re: Absolute beginner question -- recipes

2016-02-29 Thread Simon Gunacker
Hey everybody, thank you very much for your answers. I think I have already learned a lot from you! Well - there is quite a difference between stepping through a tutorial and trying to do something on my own. Regarding Mikes question whether a step of a recipe should be a sub-recipe. Well, as f

Re: Absolute beginner question -- recipes

2016-02-29 Thread Simon Gunacker
Ok ... but how can I access the additional information stored in StepIngredient then? And - to ask more general - is there a way to find all the "nested objects" attached to my current objects? Something to enter in the shell to see __all__ attributes; not just _meta.fields? -- You received t

Re: Absolute beginner question -- recipes

2016-02-29 Thread Simon Gunacker
@Mike: the attempts (at least the ones I have seen) to store hierarchical data in relations [1] don't seem very intuitive to me. At least when it comes to query the data. Anyway: I would appreciate to be convinced by something else. However, I am afraid to kick off a completely different (yet i

Re: Absolute beginner question -- recipes

2016-02-29 Thread Simon Gunacker
Thank you Florian. After James pointed out that I can access my steps (and the ingredients in some way) by just passing the recipe object to the templates context, I thought of reducing the view to a DetailView again. But I have to somehow access the ingredients from my template for now ... --

Re: Absolute beginner question -- recipes

2016-03-02 Thread Simon Gunacker
Thank you James. Taking your suggestion, I solved it! -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this

Re: Absolute beginner question -- recipes

2016-03-02 Thread Simon Gunacker
Inspired by Mike Dewhirsts suggestion on building hierachical structures, I've made up another model: class Part(models.Model): parts = models.ForeignKey('Part', null=True, blank=True, default=None, related_name='pieces') name = models.CharField(max_length=200) Then I made my view: class

Single Page Application in Django

2016-03-06 Thread Simon Gunacker
Hey everbody, I am new to django and I try to build a single page application. It consists of different sections (header, portfolio, contact, ...). As far as I understand the django philosophy, each of these sections could be a separate app (having its own model, view and template). But: How do