On Fri, Feb 11, 2011 at 8:54 AM, vanderkerkoff wrote:
> A fried of mine told me the answer, couldn't find it anywhere online.
> Is this documented anywhere?
>
> In my document model I had to add this to order the document list in
> the publication admin page
>
> class Meta:
> ordering = ('title
A fried of mine told me the answer, couldn't find it anywhere online.
Is this documented anywhere?
In my document model I had to add this to order the document list in
the publication admin page
class Meta:
ordering = ('title',)
I was under the impression all the Meta stuff had been moved in
django1.2.4
I've got a document model
class Document(models.Model):
LANG_CODE = (
('B', 'Both'),
('E', 'English'),
('C', 'Cymraeg'),
)
title = models.CharField(max_length=100)
slug = models.SlugField(max_length=100,
u
Thanks Nick,
I guess I'll be passing that value, that makes sense.
I'm using a generic view to write the list page, I'll read up more on
the queries, thanks for all your help,
Wendy
On Aug 16, 9:55 pm, Nick Serra wrote:
> The_film was just sudo code. I was assuming you wanted to show
> filmmaker
The_film was just sudo code. I was assuming you wanted to show
filmmakers based on a movie id. I would recommend going through the
django tutorials if you haven't, they go over all of the queries and
how the general layout goes when doing stuff like this.
On Aug 16, 7:46 pm, Wendy wrote:
> It doe
It doesn't know what the_film is:
name 'the_film' is not defined
if I put quotes around 'the_film', it's expecting an integer:
invalid literal for int() with base 10: 'the_film'
I think that what's happening, it's trying to match the id.
I'm going to read about filtering a little more, feels li
In your view do:
filmmakeritems =
FilmmakerPosition.objects.filter(film=the_film).order_by('position')
Pass that into your template. Then in your template do:
{% for item in filmmakeritems %}
Name: {{ item.filmmaker.first_name }}
{% endfor %}
Etc...
On Aug 16, 6:12 pm, Wendy wrote:
> Sure,
Sure, it's pretty big, here are the relevant fields pulled out:
class Filmmaker (models.Model):
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=40)
def __unicode__(self):
return u'%s %s' % (self.first_name, self.last_name
Can you list your models.py for me? What exactly do you want to show
in your template? I'm guessing some sort of WHERE clause, like all
filmmakers for a film or something.
On Aug 16, 5:08 pm, Wendy wrote:
> OK, I have the inline solution working in the admin, I can see why
> it's prettier!
> Now
OK, I have the inline solution working in the admin, I can see why
it's prettier!
Now I'm trying to figure out how to refer to these filmmakers in my
film list template, as there is no longer a film.filmmakers object...
So when I look in mysql, films_filmmakerposition has an id, a
filmmaker id, a f
Thanks, Nick, I just figured that out, doh! So I got the first
example going, I guess I'll try the inline solution as well, if it's
the pretty way to do it... It'll be good for me to actually see what
they both do.
W
On Aug 16, 12:28 pm, Nick Serra wrote:
> The inline solution is the pretty w
The inline solution is the pretty way to do it. If you just want the
join to show up in the admin, then simply register the join model in
the admin like any other model. In your admin,py include
FilmmakerPosition and then do admin.site.register(FilmmakerPosition)
On Aug 16, 3:24 pm, Wendy wrote:
Thanks Nick,
I tried the first solution first.
You're right, the many to manys aren't editable on that page, but the
problem is, I'm not seeing another admin page for the new join model:
class FilmmakerPosition(models.Model):
filmmaker = models.ForeignKey(Filmmaker)
film = models
You can go two directions with this. First, you could use a
intermediate model for the many to many join, which would allow you to
specify extra field on the join, in this case the order. Read up on
this here:
http://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relat
I have a many to many field, with the horizontal available and chosen
boxes in the admin. I wanted to see if there's any way that an admin
can select the order that the chosen objects show up, and have it be
saved and display that way. Right now, they're not ordered, but seem
to show up based on
I have recently upgraded to the beta 1.2 release and I am having a
problem with the ordering in the admin. One of the tables is large,
so I don't want an order by clause in the generated sql. There is one
join in the generated query (due to a foreign key ref), but it also
contains an ord
16 matches
Mail list logo