09.02.2012 20:01, Rune Kaagaard пишет:
Maybe something like the following untested code:
def submit_if_any(a, b, conditions, submit_func):
has_any = False
for condition in conditions:
if condition(a, b):
Maybe something like the following untested code:
def submit_if_any(a, b, conditions, submit_func):
has_any = False
for condition in conditions:
if condition(a, b):
has_any = True
> Why are you only saving if you've made a change? (Just make sure you
> aren't optimizing prematurely.)
I have a lot of signals going round, so I wan't to keep saves to a
minimum. But
nothing bad would happen if I always saved in this case. Thus the code
would
look:
resource.user.email = requ
On Feb 9, 9:41 am, Rune Kaagaard wrote:
> Dear django-users
>
> I keep doing patterns like:
>
> has_changed = False
> if resource.user.email != request.POST['email']:
> resource.user.email = request.POST['email']
> has_changed = True
> if resource.us
On Feb 9, 9:41 am, Rune Kaagaard wrote:
> has_changed = False
> if resource.user.email != request.POST['email']:
> resource.user.email = request.POST['email']
> has_changed = True
> if resource.user.is_active != request.POST['is_active']:
>
Dear django-users
I keep doing patterns like:
has_changed = False
if resource.user.email != request.POST['email']:
resource.user.email = request.POST['email']
has_changed = True
if resource.user.is_active != request.POST['is_active']:
re
6 matches
Mail list logo