With this
Team:
{% for team in object.squad.team_set.all %}
{% appearance_count_for_team team.id %}
and
class AppearanceCountForTeamNode(template.Node):
def __init__(self, team_id):
print team_id
...
I get "team.id" printed out and not the id of the team.
W
Hi list,
why can I add a record in the admin where the name field is empty,
when the docs say:
"primary_key=True implies blank=False, null=False and unique=True.
Only one primary key is allowed on an object."
My code:
name = models.CharField(maxlength=255, primary_key=True, db_index=True)
There
Hi,
On 4/25/07, Ramiro Morales <[EMAIL PROTECTED]> wrote:
> > Hi list,
> > why can I add a record in the admin where the name field is empty,
>
> Because, as you wrote, blank and null are False?
blank=False means that a blank field ISN'T allowed.
Kai
--~--~-~--~~~--
Hola,
On 4/25/07, Ramiro Morales <[EMAIL PROTECTED]> wrote:
> Sorry, I don't understand what you are asking.then.The
> first paragraph of your message was:
Second try:
primary_key=True implies blank=True and null=True.
This means that you cannot add an entry where the name (in my case) is empty.
Argh, sorry... I made a mistake:
primary_key implies blank=False and null=False.
Now it should be correct. :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send emai
Hi,
On 4/25/07, Ramiro Morales <[EMAIL PROTECTED]> wrote:
> Try adding blank=False explicitely because it works
> at the admin UI level so it doesn't know about database
> primary keys and such.
I thoght "implies" means "automatically added".
Well, I will try add it manually... seems like a bug,
Hello list,
I have a question regarding general database design.
Ok.. which method would you recommend, if you have a table
with a field 'name' which values should be unique in the whole table?
1) use (implicit) id which is automatically added by django, as primary
key and a 'name' field with "un
Hi,
On 4/25/07, Mike Caldwell <[EMAIL PROTECTED]> wrote:
> I don't think there is a "right(tm)" way, but there are some things to
> consider. A lot of people would argue that a unique characteristic makes a
> very good primary key, I think I might be one of them. But, remember that
> data refle
A point that I missed was the speed. Is method 1) maybe faster than method 2?
I think it could.. because in 1) there are only numbers stored as
primary_key and
not strings (which can be as long as 255 characters).
Speed is one thing.. but is there any other difference between the two methods?
Whi
Hi Doug,
On 4/26/07, Doug Van Horn <[EMAIL PROTECTED]> wrote:
> [Links]
> There's no harm in having unique columns in addition to your primary
> key (as you describe). The nut of the problem around natural keys,
> IMHO, is that the rules that make them natural keys today can change
> such that t
Hi,
On 4/26/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> Wow .. there's been a lot of response to this without the answer
> actually appearing: it's a bug! :-)
>
> Ticket #3774 is the relevant ticket.
>
> I'm very tempted to fix this by actually implementing the documented
> behaviour, bec
Hi list,
maybe I'm a bit confused (or tired) but
how would you go and cache a view that will *never*
change depending on a request on my application?
If I read the manual right, I have to give a timeout to
all the cache functions that are available. In my case I have
a view that will never change
Hi!
On Oct 26, 2007, at 4:07 AM, [EMAIL PROTECTED] wrote:
>
>> maybe I'm a bit confused (or tired) but
>> how would you go and cache a view that will *never*
>> change depending on a request on my application?
>
> Is the output something difficult for the view to generate?
No, it's just a massi
Hello list!
Is it possible to call functions of the model out of the template?
Sorry, didn't find it in the docs.
Example:
{{ model.function() }}
Thanks
Kai
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django
Hi,
On 12/2/06, James Bennett <[EMAIL PROTECTED]> wrote:
> Note that this has 'method', not 'method()' -- parentheses are not
> used, and it is not possible to pass arguments to the method. This is
> done because the template language is not meant to be a full
> programming language; if you need
I must misunderstand something really basic here. Just look:
Template:
{{ movie.genres_title_list }}
models.py:
def genres_title_list(self, separator=', '):
return separator.join([x.title for x in self.genres])
Prints nothing... idea anyone?
Kai
--~--~-~--~~
Hi,
On 12/3/06, Ivan Sagalaev <[EMAIL PROTECTED]> wrote:
> Kai Kuehne wrote:
> [model.py]
>
> If I reconstruct the case correctly and `genres` is a relation to child
> objects with ForeignKey to a Movie then `self.genres` by default should
> look like `self.genre_set.a
Hi list!
I've got a problem:
settings.py:
TEMPLATE_DIRS = ( '/home/kai/Projekte/kaikuehne/templates' )
home.html:
{% extends "/blog/base" %}
I get the following error:
"Template '/blog/base' cannot be extended, because it doesn't exist"
But, the file does exist:
$ ls -l /home/
Hi,
On 12/9/06, mezhaka <[EMAIL PROTECTED]> wrote:
>
> try
> {% extends "/blog/base.html" %}
> instead of
> {% extends "/blog/base" %}
Doesn't work.
Kai
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django user
Sorry, forget to paste the blog/base.html. So, here it is:
{% load comments.comments %}
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
http://www.w3.org/1999/xhtml";>
My django blog: {% block title %}Generic Page{%
endblock %}
{% block extrahead %}{%
Hi Baurzhan,
On 12/10/06, Baurzhan Ismagulov <[EMAIL PROTECTED]> wrote:
> Hello Kai,
>
> On Sun, Dec 10, 2006 at 12:23:09AM +0100, Kai Kuehne wrote:
> > > {% extends "/blog/base" %}
> > Doesn't work.
>
> {% extends "blog/base.html
Hi George,
On 1/10/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> class Author (models.Model) :
> name = CharField(maxlength=100)
> class Story (models.Model) :
> author = ForeignKey(Author)
What about a relation, hm? :)
Kai
--~--~-~--~~~---~--~~
You re
Hi Nate,
On 1/20/07, natebeaty <[EMAIL PROTECTED]> wrote:
> blog_dict = {
> 'queryset': Blog.objects.all(),
> 'template_object_name': 'blog',
> "extra_context" : {
> "blog_month_list" : Blog.objects.dates("date_added", "month"),
> "current_issue" : Issue.objects.latest
Hi,
On 1/21/07, natebeaty <[EMAIL PROTECTED]> wrote:
> Wait, can't you just use post.tags.all in your object_detail template
> without any wrappers (for all tags related to a post)? Django will
> auto-populate such a related list in a generic view:
>
> {% if post.tags.all %}
>
Hey Pedro,
On 1/10/07, pedro <[EMAIL PROTECTED]> wrote:
> Hello guys,
>
> http://www.places2go.org: is a new site i'm developing, already
> available in a beta version.
Cool idea, but I don't like colors.
Kai
--~--~-~--~~~---~--~~
You received this message becau
Hey!
I wanted to select all models, but in random order:
random.shuffle(Obj.objects.all())
This doesn't work, error message:
TypeError: object does not support item assignment
Anyony an idea in how to make it?
(It's for a blogroll, if you wonder where it could be used.)
Greetings :)
Sorry, I got it:
all = Obj.objects.all()
newlist = [x for x in all]
random.shuffle(newlist)
Not that beautiful, but it works. :)
Greetings
Kai
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django use
Hi
On 2/9/07, Brett Parker <[EMAIL PROTECTED]> wrote:
> Err, why not use a random sort as...
>
> Obj.objects.order_by('?')
>
> ref: http://www.djangoproject.com/documentation/db_api/#order-by-fields
Becasue I didn't know it (a good reason, I think).
> Cheers,
Thanks Brett!
Kai
--~--~-
Btw, why is it called maxlength and in newforms
max_length (or the other way around, not sure)?
Shouldn't they be identcal?
Greetings
Kai
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post
101 - 129 of 129 matches
Mail list logo