How to override the javascript default editable bootstap values in Django

28 views
Skip to first unread message

Srinivas Gadi

unread,
Sep 16, 2018, 6:37:47 AM9/16/18
to Django users

 am stuck at overriding the default editable bootstrap values in Django framework javascript HTML page

In my webpage, it coded as below


$.fn.editable.defaults.url = "{% url 'page1' model.PATH %}";


Now my requirement is, When I click on a button, it check the views.py(page1, which is default URL) and pass the context through 'return HttpResponse' to html page that "True" or "False" based the value, if false, it should go page2, it never goes to page2 url, its entered to the function conflict_warn() but not inside and eventually it failed with the,Uncaught TypeError:e.getAttribute is not a function I tried number of ways, but all are vain.


$(this).editable({
    value
: "",
    display
: false,
    success
: function (response, newValue) {
       
if (response.hasOwnProperty("State"))){
    conflict_warn
(response, newValue)//if State value True,should go to other func
}
   
else {
    window
.location.href = "{% url 'path1' 'path2'%}" + response;
}
       
},
error
: function(response, newValue) { $(this).editable("destroy"); }
   
});
$
(this).editable("submit");


function conflict_warn(response, newValue) {
    $
(this).editable({
        value
: ""
    display
: false
    success
: function (response.newvalue) {
            window
.location.href = "{% url 'path1' 'path2'%}" + response;
       
}
   
});
    $
(this).editable("setValue", "{% url 'page1' model.PATH %}");
    $
(this).editable("submit");
}


Srinivas Gadi

unread,
Sep 17, 2018, 5:20:11 PM9/17/18
to django...@googlegroups.com
Can someone please help me with this?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f27486fd-7b8a-4286-9c3a-25a73f40250d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Srinivas .G
      9966559383
Reply all
Reply to author
Forward
0 new messages