The candidate object is attached to the request object by middleware.

class CandidateCheckMiddleware(object):
    def process_view(self, request, view, args, kwargs):
        candidate = request.user.is_authenticated() and \
            Candidate.objects.filter(user=request.user)
        if candidate:
            request.candidate = candidate[0]
        else:
            request.candidate = None

# Later on we attempt to delete candidate..

            candidate = request.candidate
            logout(request)
            candidate.delete()

Does this help? I suppose I could retrieve the candidate again and
delete it but I don't see why this doesn't work?

On Jan 12, 2:43 pm, Szymon <szy...@mwg.pl> wrote:
> On 12 Sty, 15:40, John Baker <j...@jdiligence.com> wrote:
>
> > # later in code trying to delete
> > candidate.delete()
>
> > Any clues? (Django 1.0.2 final)
>
> You need to provide how you fetch objects, I mean code before
> cadidate.delete().
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to