Templates and views (accessing field from other model)

2012-07-09 Thread Soviet
I'm trying to access the Theme name and put it in my template. It's been working fine until I set the Theme.name as primary key. Did the primary_key=True break it? How can I use it in template? I need the primary key to make the DetailView. Or am I completely wrong about everything? #Template {

Re: Problem with DetailView

2012-07-08 Thread Soviet
Ha! Thank you and sorry for my stupidity. I was confused by the fact that I didn't had to do this in {for ... in ...}. W dniu niedziela, 8 lipca 2012 19:05:17 UTC+2 użytkownik Tomas Neme napisał: > > Man... > > > (r'^sets/(?P\d+)/$', SetDetailView.as_view( > > model=Set, > > context_ob

Re: Problem with DetailView

2012-07-08 Thread Soviet
That's because of my example. I have a LEGO Set model: class Set(models.Model): lego_id = models.CharField(max_length= 32, primary_key=True, blank=True) #lego_id stores the unique number that's on every Lego box text_name = models.CharField(max_length=64) #... And I resolved my probl

Re: Problem with DetailView

2012-07-08 Thread Soviet
That's because of my example. I have a LEGO Set model: class Set(models.Model): lego_id = models.CharField(max_length=32, primary_key=True, blank=True) #lego_id stores the unique number that's on every Lego box text_name = models.CharField(max_length=64) #... And I resolved my proble

Re: Problem with DetailView

2012-07-08 Thread Soviet
gt; passed to the view? > > Also, are you sure a car exists with the id / pk you're passing? > Le 7 juil. 2012 23:10, "Soviet" a écrit : > >> But the ListView is working fine. And they don't use in the >> documentation, just this, which I modified to fi

Re: Problem with DetailView

2012-07-07 Thread Soviet
gt; > Hope that helps, > Smaran > On Jul 7, 2012 3:36 PM, "Soviet" wrote: > >> Now that I have basic understanding of models, I encountered even more >> confusing subjects - views and urls. Now, the class-generic views are quite >> easy to grasp at bas

Problem with DetailView

2012-07-07 Thread Soviet
Now that I have basic understanding of models, I encountered even more confusing subjects - views and urls. Now, the class-generic views are quite easy to grasp at basic level, but I fail to understand what's wrong with this code: urlpatterns = patterns('', (r'^$', ListView.as_view(

Re: ForeignKey problem

2012-07-06 Thread Soviet
That's exactly what I want. Should I use 'through' or just make a new Model? As I said before, with your car example.. if you just want to know how > many of a part are in a car, Then what you did is enough, then you > could have some cars, and some pieces, say > > Cars = (Motorcycle, 4x4, Car)

Re: ForeignKey problem

2012-07-06 Thread Soviet
car = models.ForeignKey('Car') part = models.ForeignKey('Part') amount = models.IntegerField() Whats the advantage of doing it 'through' if I can just make it a new model? Or am I completely wrong about everything again? :) (Sorry for the double post) W dni

Re: ForeignKey problem

2012-07-06 Thread Soviet
Thanks, but damn, isn't that overly complicated (for me). Using through looks like a easier way, but then I have to add Wheel four times and can't just type '4' in some field, since I don't need it to exist in database four time, just an information that there are four wheels. W dniu piątek, 6

Re: ForeignKey problem

2012-07-06 Thread Soviet
> You don't. You get all wheel objects and count them. > I don't understand. It's the same wheel added four times, not four different wheels. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https:/

Re: ForeignKey problem

2012-07-06 Thread Soviet
Alright, bad example. Lets try LEGO pieces. I have a LEGO set that has many pieces (ManyToMany). But I have 4 wheels and 1 brick in that set. The 'brick' can be added with no problem, but how do I save the information that there's 4 'wheel' objects and not only one? W dniu czwartek, 5 lipca 2

Re: ForeignKey problem

2012-07-05 Thread Soviet
Thanks a lot! After few experiments I think I get it :). But! I do have another problem. Lets ditch our football example. Let's say that I have something like that: class CherryTree(models.Model): name = models.IntegerField() cherries = models.ManyToManyField('CherryFruit') class Cherry

Re: ForeignKey problem

2012-06-25 Thread Soviet
W dniu poniedziałek, 25 czerwca 2012 18:54:48 UTC+2 użytkownik Kurtis napisał: > > Actually, I'm pretty confused about this part :) A ForeignKey is used to > relate to another Model -- not just a Model Field -- in Django's ORM. > > So for example, if you have a Team Model and a Player Model, you'

Re: ForeignKey problem

2012-06-25 Thread Soviet
Thank you kind sir for your fast response, that worked brilliantly. Can I be cheeky and ask why does it work? :) On 25 Cze, 18:43, Adrian Bool wrote: > On 25 Jun 2012, at 17:41, Soviet wrote: > > > I'm new to this Django thing and I run into first problem :). > > > L

ForeignKey problem

2012-06-25 Thread Soviet
Hey I'm new to this Django thing and I run into first problem :). Let's say I have two models and in each I have field with ForeignKey relating to field in other model (hope it's clear). Now that I want to run migrate with South, I'm getting "NameError: name 'ModelName' is not defined". This is cl

Re: Setting up EC2 for Django

2011-07-02 Thread Soviet
to > type "linux howto" or "linux howto" or "linux for beginners" as a > search result? > > Next time posting here, please use this as a guide: > > https://code.djangoproject.com/wiki/UsingTheMailingList > > Cal > > > > > >

Setting up EC2 for Django

2011-07-02 Thread Soviet
Hello I need to set up EC2 instance to run Django+Python+PostgreSQL+Apache +Solr+nginx+Mercurial etc. This is all black magic for me - I was only using shared hosting like webfaction, where everything is dumb- friendly :). But you know, "the customer is always right", and I have to run it on Amazon