(request, uid)
return ajax_success(has_changes=True, msg='Showing changes', diff=tmpl)
View most recent diff to a post.
View most recent diff to a post.
View most recent diff to a post .
def view_diff(request, uid):
    """
    View most recent diff to a post.
    """

    # View most recent diff made to a post
    post = Post.objects.filter(uid=uid).first()

    diffs = Diff.objects.filter(post=post).order_by('-pk')

    # Post has no recorded changes,
    if not diffs.exists():
        return ajax_success(has_changes=False, msg='Post has no recorded changes')

    # Change new line chars to break line tags.
    context = dict(diffs=diffs)
    tmpl = loader.get_template(template_name='diff.html')
    tmpl = tmpl.render(context)

    # Return newly created diff
    return ajax_success(has_changes=True, msg='Showing changes', diff=tmpl)
def view_diff ( request , uid ) : # View most recent diff made to a post post = Post . objects . filter ( uid = uid ) . first ( ) diffs = Diff . objects . filter ( post = post ) . order_by ( '-pk' ) # Post has no recorded changes, if not diffs . exists ( ) : return ajax_success ( has_changes = False , msg = 'Post has no recorded changes' ) # Change new line chars to break line tags. context = dict ( diffs = diffs ) tmpl = loader . get_template ( template_name = 'diff.html' ) tmpl = tmpl . render ( context ) # Return newly created diff return ajax_success ( has_changes = True , msg = 'Showing changes' , diff = tmpl )