Dnia 2011-09-10, sob o godzinie 14:50 -0700, Christian Ramsey pisze:
> def __unicode__(self)
> return 'Name you'd like without the s'
> for each model and this will be used instead.
That's obviously not what he's after.
> On 10 Sep 2011, at 14:40, Gillwill wrote:
> >Apparently the Django
Hi all,
I'm not sure it's actually supposed to work, but looks like a common
enough approach that it should.
Say you have an aggregate query:
> Model.objects.values('field').annotate(Sum('count'))
that results in an aggregate query that follows:
> SELECT "models_model"."field", SUM("models_model"
Dnia 2011-06-21, wto o godzinie 14:31 -0300, Andre Terra pisze:
> I'm not sure this has anything to do with your issue, but it's easy to
> miss when reading the docs.
It's kind of related, but not directly. The similarity to the issue
mentioned above is that the default ordering field is added to
Dnia 2011-06-22, śro o godzinie 14:15 +0100, Cal Leeming [Simplicity
Media Ltd] pisze:
> If you're interested, please reply on-list so others can see.
Sure, I'd attend.
--
Michał (Saviq) Sawicz
signature.asc
Description: This is a digitally signed message part
Dnia 2011-06-22, śro o godzinie 06:32 -0700, Wim Feijen pisze:
> Our query is:
>
> newsitems = NewsItem.objects.filter(Q(expires_at__gt = datetime.now())
> | Q(expires_at__isnull = True), effective_at__lte = datetime.now(),
> is_active=True).order_by('-news_timestamp')
>
> Or is datetime.now() fi
Dnia 2011-06-22, śro o godzinie 13:44 -0700, snfctech pisze:
> Which passes the form with the same post data and some error messages
> back to the user.
Maybe you could just reinstantiate a clean RegistrationFormSet without
passing request.POST to it? Maybe copying errors from the original,
bound
Dnia 2011-06-29, śro o godzinie 16:31 -0700, elliot pisze:
> Book.objects.annotate(mostrecent = Max('transaction__start_date'))
.values('pk')
Or whatever values you want.
--
Michał Sawicz
signature.asc
Description: This is a digitally signed message part
Dnia 2011-07-04, pon o godzinie 14:19 -0700, galgal pisze:
> I'm rather searchung the way to do that in my admin.py file not in
> core files.
Obviously the proposal was... fundamentally wrong.
Create your own UserAdmin, unregister the one registered by
django.contrib.admin and register your own.
Dnia 2011-07-04, pon o godzinie 14:15 -0700, galgal pisze:
> How can I hide remove link in Django admin? I need to hide it in my
> code, not in permissions (only user with id=1 can see it no matter if
> any users are superusers)
Override has_delete_permission [1] on your ModelAdmin.
https://docs.
Dnia 2011-07-04, pon o godzinie 16:50 -0500, charles pisze:
> The current URL, , didn't match any of these.
And the current URL was?
--
Michał (Saviq) Sawicz
signature.asc
Description: This is a digitally signed message part
Dnia 2011-07-04, pon o godzinie 15:13 -0700, galgal pisze:
> That's my code now - how to hide groups for example?
Have you tried reading the Django Admin docs? [1] [2]
[1] https://docs.djangoproject.com/en/1.3/ref/contrib/admin/
[2]
https://docs.djangoproject.com/en/1.3/ref/contrib/admin/#django.
Dnia 2011-07-04, pon o godzinie 15:20 -0700, galgal pisze:
> Yes I read it. exclude = ('groups',) throws:
> Caught KeyError while rendering: "Key 'groups' not found in Form"
That's because the stock UserAdmin defines fieldsets in which 'groups'
is a field, you need to modify the fieldsets, too.
Dnia 2011-07-05, wto o godzinie 15:16 -0700, galgal pisze:
> Is there any possibility to change permissions list in user edit page?
> I don't wan't to show all of permissions for example admin log entry
> or auth group etc. How can I modify a main queryset to exclude some of
> it?
Override ModelA
Dnia 2011-07-05, wto o godzinie 15:13 -0700, galgal pisze:
> I made it in that way, and it works:
Remember that you need to exclude the field from the form, too, if you
don't want malicious attempts to inject the groups to work.
--
Michał (Saviq) Sawicz
signature.asc
Description: This is a dig
Dnia 2011-07-06, śro o godzinie 00:31 -0700, galgal pisze:
> Ok but like I said in previous post, exclude = ('groups',) etc doesn't
> work :/
It does, you just need to override both exclude / fields _and_
fieldsets.
The exception you've mentioned resulted from the fact that you've
excluded the f
Dnia 2011-07-06, śro o godzinie 13:16 -0700, galgal pisze:
> Any idea how to overwrite it dynamically?
> def get_form(self, request, obj=None, **kwargs):
> self.exclude = ('user_permissions',)
> return super(UserProfileAdmin, self).get_form(request,
> obj=None, **kwargs)
> Throws:
>
Dnia 2011-07-06, śro o godzinie 14:40 -0700, galgal pisze:
> Full code:
> class UserProfileAdmin(UserAdmin):
> inlines = [UserProfileInline,]
> list_filter = ('userprofile__type','userprofile__cities',)
> search_fields = ['userprofile__type', 'username',
> 'userprofile__cities__name', '
Dnia 2011-07-11, pon o godzinie 09:48 -0700, Brent pisze:
> How do I use a foreign key, though? In other words, how do I tell my
> code to look at UserProfile rather than just user?
https://docs.djangoproject.com/en/1.3/topics/auth/#storing-additional-information-about-users
--
Michał (Saviq) S
Dnia 2011-07-15, pią o godzinie 16:07 +0530, Kenneth Gonsalves pisze:
> caveat - I have never used generic views, class based or otherwise,
> but
> I was under the impression that if one wants customised forms or
> views,
> generic is not the way to go.
Why not? The model edit views use the Model
Hi all,
I'd like to pick your brainz about how would you approach constructing
and rendering a complex table with headers, row/colspanning cells in a
most clean way that rids the view of rendering as much as possible.
Here's roughly what I'm after (incomplete, but you should see what I
mean):
htt
Dnia 2011-08-03, śro o godzinie 10:34 +1000, Sam Walters pisze:
> Hi i dont see what is complex about this.
--8<--
> The view 'rendering' as much as possible. So i assume you would rather
> have an initial template rendered. then perhaps have views that
> deliver data via JSON or something? AJAX+JS
21 matches
Mail list logo