Code

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#2048 closed enhancement (fixed)

[patch] Allow positional args in get_object_or_404

Reported by: Joeboy Owned by: adrian
Component: Core (Other) Version: master
Severity: minor Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

presently, get_object_or_404 only accepts keyword arguments, so this kind of query:

r = get_object_or_404( Resource, Q(pk=resource_id) & (Q(expiry_date__isnull=True) | Q(expiry_date__gt=datetime.now())) )

fails. Patch appears to fix it. (thanks for Heimy for irc assistance).

Attachments (1)

positional-args-in-get-object-or-404.diff (626 bytes) - added by Joeboy 8 years ago.

Download all attachments as: .zip

Change History (3)

Changed 8 years ago by Joeboy

comment:1 Changed 8 years ago by jacob

  • Resolution set to fixed
  • Status changed from new to closed

(In [3014]) Fixed #2048 - get_object_or_404 now allows *args as well. Thanks, Joeboy

comment:2 Changed 8 years ago by jacob

(In [3015]) Added *args to get_list_or_404, too (refs #2048).

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.