On 2 sep, 10:18, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Tue, Sep 2, 2008 at 2:30 AM, bruno desthuilliers
>
> <[EMAIL PROTECTED]> wrote:
> > More seriously, it took me 2 minutes playing with a model object in
> > the interactive shell to come up with what seems a working solution:
>
> Yeah
Or
>>> foo = Foo.objects.values().get(pk=1)
>>> type(foo)
2008/9/1 Malcolm Tredinnick <[EMAIL PROTECTED]>
>
>
> On Mon, 2008-09-01 at 15:10 -0400, Jay Parlar wrote:
> > On Mon, Sep 1, 2008 at 2:48 PM, Vance Dubberly <[EMAIL PROTECTED]>
> wrote:
> > >
> > > So I'm finding there are multiple plac
Bruno, thanks that 2 mins of yours was exactly what I was looking for.
I feel much worse about myself and much better about the world in
general, which is the way things should be, thanks!
Does seem odd that there is no such method in Model already but that
it's in ModelForm instead. Oh well ea
On Tue, Sep 2, 2008 at 2:30 AM, bruno desthuilliers
<[EMAIL PROTECTED]> wrote:
> More seriously, it took me 2 minutes playing with a model object in
> the interactive shell to come up with what seems a working solution:
Yeah, which is why I pointed out the easy wrapper function for it in
my email
On 2 sep, 05:24, "Vance Dubberly" <[EMAIL PROTECTED]> wrote:
> Wow. I guess it wasn't such a stupid question.
>
> foo._meta.fields .. each field will give me att names but not values.
Getting an attribute by name is dead simple in Python - use getattr().
> All the methods on the fields that lo
On Mon, Sep 1, 2008 at 10:24 PM, Vance Dubberly <[EMAIL PROTECTED]> wrote:
> Hmm perhaps I should do
>
> foo = Foo.objects.filter(pk=1)
> foo_form = FooForm(instance=foo)
> data = foo_form.cleaned_data
Or you could do what the form itself is doing, namely, using the
function django.forms.models.
Wow. I guess it wasn't such a stupid question.
foo._meta.fields .. each field will give me att names but not values.
All the methods on the fields that look like they return values only
return the values you give them, WTF?
Foo.objects.filter(pk=1).values()[0] requires 2 calls to the database
On Mon, 2008-09-01 at 15:10 -0400, Jay Parlar wrote:
> On Mon, Sep 1, 2008 at 2:48 PM, Vance Dubberly <[EMAIL PROTECTED]> wrote:
> >
> > So I'm finding there are multiple places where I'm needing to iterate
> > over the properties of a Model and I'm absolutely certain it's got to
> > be insanely
On Mon, Sep 1, 2008 at 2:48 PM, Vance Dubberly <[EMAIL PROTECTED]> wrote:
>
> So I'm finding there are multiple places where I'm needing to iterate
> over the properties of a Model and I'm absolutely certain it's got to
> be insanely easy to get a dictionary from a model but for the life of
> me
So I'm finding there are multiple places where I'm needing to iterate
over the properties of a Model and I'm absolutely certain it's got to
be insanely easy to get a dictionary from a model but for the life of
me I can't figure it out, and I can't find any documentation on the
matter.
basically
10 matches
Mail list logo