Re: 'WSGIRequest' object has no attribute 'get'

2021-11-23 Thread ramadhan ngallen
Surely it has self.request.GET and not self.request.get
On 23 Nov 2021, 09:11 +0300, Trippy Samurai , 
wrote:
> Getting error while working with template view
>
> views.py
>
>
> class DeveloperTicketView(TemplateView):
>
> def get_template_names(self):
> if self.request.get('status') == 'Opened':
> template_name = 'app/open_tickets.html'
> elif self.request.get('status') == 'Accepted':
> template_name = 'app/dev_accepted_tickets'
> elif self.request.get('status') == "Completed":
> template_name = 'app/dev_completed_tickets.html'
> else:
> template_name = 'app/dev_closed_tickets.html'
>
> return template_name
>
>
> def get_context_data(self, **kwargs):
> context = super(DeveloperTicketView,self).get_context_data(**kwargs)
> context['open_tickets'] = Ticket.objects.filter(status = 'Opened')
> context['accepted_tickets'] = Ticket.objects.filter(status = 
> 'Accepted',accepted_by = self.request.user)
> context['completed_tickets'] = Ticket.objects.filter(status = 
> 'Completed',accepted_by = self.request.user)
> context['closed_tickets'] = Ticket.objects.filter(status = 
> 'Closed',accepted_by = self.request.user)
> return context
>  --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/65cd3d84-5946-43d6-8abc-c78e4246fb07n%40googlegroups.com.

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4e8ffafc-5b78-42fb-9458-3ee0b0c97c3c%40Spark.


Re: learn django

2021-11-23 Thread MR INDIA
if you just want auth, and don't want to learn django fully, then get a 
django crashcourse, and use django allauth. crash course = 
https://youtu.be/rHux0gMZ3Eg , django allauth: https://youtu.be/GQySb3W2feo 

On Monday, 22 November 2021 at 21:38:29 UTC+5:30 Kasper Laudrup wrote:

> On 21/11/2021 06.57, Shahin Salim wrote:
> > iam shahin salim .iam a student.now iam lerning python.but iam confused 
> > with it.they give me this task.idont know were to sart.what i want to do 
> > for learn and also do this task.
> >
>
> I think you start with step one: "Have a clear idea about View Engine 
> and its working". Have you done that?
>
> Kind regards,
>
> Kasper Laudrup
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cd68869c-b523-408d-9cfd-6570264e455an%40googlegroups.com.


Re: learn django

2021-11-23 Thread Kasper Laudrup

On 23/11/2021 15.07, MR INDIA wrote:
if you just want auth, and don't want to learn django fully, then get a 
django crashcourse, and use django allauth. crash course = 
https://youtu.be/rHux0gMZ3Eg , django allauth: https://youtu.be/GQySb3W2feo




I think you meant to reply to someone else. This doesn't seem relevant 
for what I wrote at all.


Kind regards,

Kasper Laudrup

--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/55696c78-3903-376a-d95c-f2b602658e20%40stacktrace.dk.


Re: learn django

2021-11-23 Thread MR INDIA
I wrote to the person who asked the question

On Tuesday, 23 November 2021 at 19:42:21 UTC+5:30 Kasper Laudrup wrote:

> On 23/11/2021 15.07, MR INDIA wrote:
> > if you just want auth, and don't want to learn django fully, then get a 
> > django crashcourse, and use django allauth. crash course = 
> > https://youtu.be/rHux0gMZ3Eg , django allauth: 
> https://youtu.be/GQySb3W2feo
> > 
>
> I think you meant to reply to someone else. This doesn't seem relevant 
> for what I wrote at all.
>
> Kind regards,
>
> Kasper Laudrup
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c420d388-99c7-4c80-8a5d-4e78cd34d96cn%40googlegroups.com.


Question for Upload images issue

2021-11-23 Thread Alam Khazi
Hi,
By using Vuejs, Axios and Django, we're uploading "multiple images" using
Vuejs form in one upload/browse attempt. After uploading, the images are
getting in a list and then the list of images names are stored into backend
in ImageField.  The image names are saving into database but not saving
into Media Folder. Here is snippet of the code.

Vuejs
```
  
Files


  {{ name }}

  
  

  
  
  Submit
```
Axiox
```

new Vue({
  el: '#app',
  data() {
return {
  files: [],
  images: [],
}
  },
  computed: {
filesNames() {
  const fn = []
  for (let i = 0; i < this.files.length; ++i) {
fn.push(this.files.item(i).name)

  }
  return fn
}
  },
  methods: {
handleFileUploads(event) {
  this.files = event.target.files;
  this.images = [...this.files].map(URL.createObjectURL);
},
submitFile() {
  let formData = new FormData();
  for (var i = 0; i < this.files.length; i++) {
let file = this.files[i];
formData.append('files[' + i + ']', file);
  }
 submitForm: function(){
  let formData = new FormData();
  const fna = []
  for (let i = 0; i < this.files.length; ++i) {
fna.push(this.files.item(i).name)
  }
  console.log('fna');
  console.log(fna);
axios({
method : "POST",
url: "{% url 'service-ad' %}",
headers: {'X-CSRFTOKEN': '{{ csrf_token }}',
'Content-Type': 'multipart/form-data'},
data : {
"images": fna,
},
  }).then(response => {
console.log('SUCCESS!!');
  }).catch(err => {
console.log('FAILURE!!');
  });
}
  }
})

```
Where as in other case we have similar functionality of uploading
'multiple images' in one upload/browse attempt, but here, we are using HTML
form and the images names are saved in database as well as in Media Folder.

Django
```
def servicevue(request):
if request.method == "POST":
data = json.loads(request.body)
images = data['images']
img_length = len(images)
if img_length == 1:
image_name = images[0]
image_name2 = ''
elif img_length == 2:
image_name = images[0]
image_name2 = images[1]
else:
image_name = ''
image_name2 = ''

savehotel = Hotel(
  image=image_name,
  image2=image_name2,
  )
savehotel.save()
messages.success(request, """Your Ad is successfully posted.""")
return JsonResponse(safe=False)
return render(request, 'servicead.html')
```
So we are wondering what could be the issue. We hope our code is correctly
implemented. Please help me out whether this is any way to unblock this
issue?

Best regards,
Salima

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABscGkRXhvC6zALxCXvQN6-DmB%2BxedTSWO8KrPS2Nih0imZtXA%40mail.gmail.com.


Re: learn django

2021-11-23 Thread Kasper Laudrup

On 23/11/2021 15.39, MR INDIA wrote:

I wrote to the person who asked the question



Well, you replied to me. That was a bit confusing, but we all make 
mistakes of course.


Kind regards,

Kasper Laudrup

--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2772102d-8a22-1060-5ea4-5e1ff723237d%40stacktrace.dk.


OpenPGP_0xE5D9CAC64AAA55EB.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


AJAX or Javascript POST request for Django form

2021-11-23 Thread DJANGO DEVELOPER
I am working on a django based project in which I have integrated ML 
trained models to check if a https url is legitimate or not. for this I 
need javascript or ajax to call a rest api for my form in which I want to 
send a post request so that I can check if a https url is legitimate or not.
*NOTE: My code is running successfully and giving correct answers on 
postman.* so just want to integrate it with my HTML form.
*My work:*
*form.html:*


  





https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"; 
rel="stylesheet" 
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
 
crossorigin="anonymous">

SITE URL Form
  
  
  
  
SITE URL

  
  POST






  (function () {
var output = document.getElementById('output');
document.getElementById('post').onclick = function () {
  var data = document.getElementById('data').value;

  axios.post('http://127.0.0.1:8000/predict/', JSON.parse(data))
.then(function (res) {
  output.className = 'container';
  output.innerHTML = res.data;
})
.catch(function (err) {
  output.className = 'container text-danger';
  output.innerHTML = err.message;
});
};
  })();





https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js";
 
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
 
crossorigin="anonymous">



  


*myapp/urls.py:*
path('form/', form, name="form"),
path('predict/', predict, name='predict')
*this is the response I am returning:*
if list(model.predict([test]))[0] == 1:
return JsonResponse({"Response":"Legitimate"})
else:
return JsonResponse({"Response":"Phishing or fake"})

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e81cf4f0-1208-4623-97f9-4b88f01d67b3n%40googlegroups.com.


Re: AJAX or Javascript POST request for Django form

2021-11-23 Thread Duncan Santiago
hello, am not sure what the question is. Kindly elaborate.

On Tue, 23 Nov 2021 at 09:19, DJANGO DEVELOPER 
wrote:

> I am working on a django based project in which I have integrated ML
> trained models to check if a https url is legitimate or not. for this I
> need javascript or ajax to call a rest api for my form in which I want to
> send a post request so that I can check if a https url is legitimate or not.
> *NOTE: My code is running successfully and giving correct answers on
> postman.* so just want to integrate it with my HTML form.
> *My work:*
> *form.html:*
> 
> 
>   
> 
> 
> 
>
> 
> https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css";
> rel="stylesheet"
> integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
> crossorigin="anonymous">
>
> SITE URL Form
>   
>   
>   
>   
> SITE URL
> 
>   
>   POST
> 
>
> 
>
> 
> 
>   (function () {
> var output = document.getElementById('output');
> document.getElementById('post').onclick = function () {
>   var data = document.getElementById('data').value;
>
>   axios.post('http://127.0.0.1:8000/predict/', JSON.parse(data))
> .then(function (res) {
>   output.className = 'container';
>   output.innerHTML = res.data;
> })
> .catch(function (err) {
>   output.className = 'container text-danger';
>   output.innerHTML = err.message;
> });
> };
>   })();
> 
>
> 
>
> 
> https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js";
> integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
> crossorigin="anonymous">
>
> 
> 
>   
> 
>
> *myapp/urls.py:*
> path('form/', form, name="form"),
> path('predict/', predict, name='predict')
> *this is the response I am returning:*
> if list(model.predict([test]))[0] == 1:
> return JsonResponse({"Response":"Legitimate"})
> else:
> return JsonResponse({"Response":"Phishing or fake"})
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e81cf4f0-1208-4623-97f9-4b88f01d67b3n%40googlegroups.com
> 
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACPcFdJ11YDrrpcCChwMcufz4CqcySacbKVQ-OtvEAVZEhK%3DBg%40mail.gmail.com.


Re: AJAX or Javascript POST request for Django form

2021-11-23 Thread DJANGO DEVELOPER
okay let me explain.
I have trained models which tells us that which website is legitimate or
which website is not legitimate. I have integrated that model with my
django web app using rest api.
I tested the API on postman and working.
now I want to get the result on front end using HTML CSS and javascript. so
how can I achieve it?

On Tue, Nov 23, 2021 at 10:16 PM Duncan Santiago 
wrote:

> hello, am not sure what the question is. Kindly elaborate.
>
> On Tue, 23 Nov 2021 at 09:19, DJANGO DEVELOPER 
> wrote:
>
>> I am working on a django based project in which I have integrated ML
>> trained models to check if a https url is legitimate or not. for this I
>> need javascript or ajax to call a rest api for my form in which I want to
>> send a post request so that I can check if a https url is legitimate or not.
>> *NOTE: My code is running successfully and giving correct answers on
>> postman.* so just want to integrate it with my HTML form.
>> *My work:*
>> *form.html:*
>> 
>> 
>>   
>> 
>> 
>> 
>>
>> 
>> https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css";
>> rel="stylesheet"
>> integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
>> crossorigin="anonymous">
>>
>> SITE URL Form
>>   
>>   
>>   
>>   
>> SITE URL
>> 
>>   
>>   POST
>> 
>>
>> 
>>
>> 
>> 
>>   (function () {
>> var output = document.getElementById('output');
>> document.getElementById('post').onclick = function () {
>>   var data = document.getElementById('data').value;
>>
>>   axios.post('http://127.0.0.1:8000/predict/', JSON.parse(data))
>> .then(function (res) {
>>   output.className = 'container';
>>   output.innerHTML = res.data;
>> })
>> .catch(function (err) {
>>   output.className = 'container text-danger';
>>   output.innerHTML = err.message;
>> });
>> };
>>   })();
>> 
>>
>> 
>>
>> 
>> https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js";
>> integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
>> crossorigin="anonymous">
>>
>> 
>> 
>>   
>> 
>>
>> *myapp/urls.py:*
>> path('form/', form, name="form"),
>> path('predict/', predict, name='predict')
>> *this is the response I am returning:*
>> if list(model.predict([test]))[0] == 1:
>> return JsonResponse({"Response":"Legitimate"})
>> else:
>> return JsonResponse({"Response":"Phishing or fake"})
>>
>> --
>> 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+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/e81cf4f0-1208-4623-97f9-4b88f01d67b3n%40googlegroups.com
>> 
>> .
>>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACPcFdJ11YDrrpcCChwMcufz4CqcySacbKVQ-OtvEAVZEhK%3DBg%40mail.gmail.com
> 
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKPY9pnmOXaLFnBRE4Eqi52yY-E%2BP1ih7arBDbxCqru4a-ZXxA%40mail.gmail.com.


Re: AJAX or Javascript POST request for Django form

2021-11-23 Thread Duncan Santiago
do a demo, enter the URL on the text area and click on the post button.
Then send me the logs on the terminal running Django and also open the
console and send the output,

On Tue, 23 Nov 2021 at 10:21, DJANGO DEVELOPER 
wrote:

> okay let me explain.
> I have trained models which tells us that which website is legitimate or
> which website is not legitimate. I have integrated that model with my
> django web app using rest api.
> I tested the API on postman and working.
> now I want to get the result on front end using HTML CSS and javascript.
> so how can I achieve it?
>
> On Tue, Nov 23, 2021 at 10:16 PM Duncan Santiago <
> duncansantiag...@gmail.com> wrote:
>
>> hello, am not sure what the question is. Kindly elaborate.
>>
>> On Tue, 23 Nov 2021 at 09:19, DJANGO DEVELOPER 
>> wrote:
>>
>>> I am working on a django based project in which I have integrated ML
>>> trained models to check if a https url is legitimate or not. for this I
>>> need javascript or ajax to call a rest api for my form in which I want to
>>> send a post request so that I can check if a https url is legitimate or not.
>>> *NOTE: My code is running successfully and giving correct answers on
>>> postman.* so just want to integrate it with my HTML form.
>>> *My work:*
>>> *form.html:*
>>> 
>>> 
>>>   
>>> 
>>> 
>>> 
>>>
>>> 
>>> https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css";
>>> rel="stylesheet"
>>> integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
>>> crossorigin="anonymous">
>>>
>>> SITE URL Form
>>>   
>>>   
>>>   
>>>   
>>> SITE URL
>>> 
>>>   
>>>   POST
>>> 
>>>
>>> 
>>>
>>> 
>>> 
>>>   (function () {
>>> var output = document.getElementById('output');
>>> document.getElementById('post').onclick = function () {
>>>   var data = document.getElementById('data').value;
>>>
>>>   axios.post('http://127.0.0.1:8000/predict/', JSON.parse(data))
>>> .then(function (res) {
>>>   output.className = 'container';
>>>   output.innerHTML = res.data;
>>> })
>>> .catch(function (err) {
>>>   output.className = 'container text-danger';
>>>   output.innerHTML = err.message;
>>> });
>>> };
>>>   })();
>>> 
>>>
>>> 
>>>
>>> 
>>> https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js";
>>> integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
>>> crossorigin="anonymous">
>>>
>>> 
>>> 
>>>   
>>> 
>>>
>>> *myapp/urls.py:*
>>> path('form/', form, name="form"),
>>> path('predict/', predict, name='predict')
>>> *this is the response I am returning:*
>>> if list(model.predict([test]))[0] == 1:
>>> return JsonResponse({"Response":"Legitimate"})
>>> else:
>>> return JsonResponse({"Response":"Phishing or fake"})
>>>
>>> --
>>> 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+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/e81cf4f0-1208-4623-97f9-4b88f01d67b3n%40googlegroups.com
>>> 
>>> .
>>>
>> --
>> 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+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CACPcFdJ11YDrrpcCChwMcufz4CqcySacbKVQ-OtvEAVZEhK%3DBg%40mail.gmail.com
>> 
>> .
>>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAKPY9pnmOXaLFnBRE4Eqi52yY-E%2BP1ih7arBDbxCqru4a-ZXxA%40mail.gmail.com
> 
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the 

Re: AJAX or Javascript POST request for Django form

2021-11-23 Thread Duncan Santiago
your page also reloads and results may not be displayed on your frontend,
just add this lines on your onclick listerner

function(e){ //notice the e parameter, it is the event parameter.
e.preventDefault()
 your code here.

}

or you can just paste this on your script section


(function () {
var output = document.getElementById('output');
document.getElementById('post').onclick = function (e) {
e.preventDefault()
  var data = document.getElementById('data').value;

  axios.post('http://127.0.0.1:8000/predict/', JSON.parse(data))
.then(function (res) {
  output.className = 'container';
  output.innerHTML = res.data;
})
.catch(function (err) {
  output.className = 'container text-danger';
  output.innerHTML = err.message;
});
};
  })();

On Tue, 23 Nov 2021 at 10:34, Duncan Santiago 
wrote:

> do a demo, enter the URL on the text area and click on the post button.
> Then send me the logs on the terminal running Django and also open the
> console and send the output,
>
> On Tue, 23 Nov 2021 at 10:21, DJANGO DEVELOPER 
> wrote:
>
>> okay let me explain.
>> I have trained models which tells us that which website is legitimate or
>> which website is not legitimate. I have integrated that model with my
>> django web app using rest api.
>> I tested the API on postman and working.
>> now I want to get the result on front end using HTML CSS and javascript.
>> so how can I achieve it?
>>
>> On Tue, Nov 23, 2021 at 10:16 PM Duncan Santiago <
>> duncansantiag...@gmail.com> wrote:
>>
>>> hello, am not sure what the question is. Kindly elaborate.
>>>
>>> On Tue, 23 Nov 2021 at 09:19, DJANGO DEVELOPER 
>>> wrote:
>>>
 I am working on a django based project in which I have integrated ML
 trained models to check if a https url is legitimate or not. for this I
 need javascript or ajax to call a rest api for my form in which I want to
 send a post request so that I can check if a https url is legitimate or 
 not.
 *NOTE: My code is running successfully and giving correct answers on
 postman.* so just want to integrate it with my HTML form.
 *My work:*
 *form.html:*
 
 
   
 
 
 

 
 https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css";
 rel="stylesheet"
 integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
 crossorigin="anonymous">

 SITE URL Form
   
   
   
   
 SITE URL
 
   
   POST
 

 

 
 
   (function () {
 var output = document.getElementById('output');
 document.getElementById('post').onclick = function () {
   var data = document.getElementById('data').value;

   axios.post('http://127.0.0.1:8000/predict/',
 JSON.parse(data))
 .then(function (res) {
   output.className = 'container';
   output.innerHTML = res.data;
 })
 .catch(function (err) {
   output.className = 'container text-danger';
   output.innerHTML = err.message;
 });
 };
   })();
 

 

 
 https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js";
 integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
 crossorigin="anonymous">

 
 
   
 

 *myapp/urls.py:*
 path('form/', form, name="form"),
 path('predict/', predict, name='predict')
 *this is the response I am returning:*
 if list(model.predict([test]))[0] == 1:
 return JsonResponse({"Response":"Legitimate"})
 else:
 return JsonResponse({"Response":"Phishing or fake"})

 --
 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+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/e81cf4f0-1208-4623-97f9-4b88f01d67b3n%40googlegroups.com
 
 .

>>> --
>>> 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+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.g

Re: AJAX or Javascript POST request for Django form

2021-11-23 Thread DJANGO DEVELOPER
sorry if you get offended because I need a solution. a working solution. I
am not familiar with javascript. so getting a lot of issues

On Tue, Nov 23, 2021 at 10:38 PM Duncan Santiago 
wrote:

> your page also reloads and results may not be displayed on your frontend,
> just add this lines on your onclick listerner
>
> function(e){ //notice the e parameter, it is the event parameter.
> e.preventDefault()
>  your code here.
>
> }
>
> or you can just paste this on your script section
>
>
> (function () {
> var output = document.getElementById('output');
> document.getElementById('post').onclick = function (e) {
> e.preventDefault()
>   var data = document.getElementById('data').value;
>
>   axios.post('http://127.0.0.1:8000/predict/', JSON.parse(data))
> .then(function (res) {
>   output.className = 'container';
>   output.innerHTML = res.data;
> })
> .catch(function (err) {
>   output.className = 'container text-danger';
>   output.innerHTML = err.message;
> });
> };
>   })();
>
> On Tue, 23 Nov 2021 at 10:34, Duncan Santiago 
> wrote:
>
>> do a demo, enter the URL on the text area and click on the post button.
>> Then send me the logs on the terminal running Django and also open the
>> console and send the output,
>>
>> On Tue, 23 Nov 2021 at 10:21, DJANGO DEVELOPER 
>> wrote:
>>
>>> okay let me explain.
>>> I have trained models which tells us that which website is legitimate or
>>> which website is not legitimate. I have integrated that model with my
>>> django web app using rest api.
>>> I tested the API on postman and working.
>>> now I want to get the result on front end using HTML CSS and javascript.
>>> so how can I achieve it?
>>>
>>> On Tue, Nov 23, 2021 at 10:16 PM Duncan Santiago <
>>> duncansantiag...@gmail.com> wrote:
>>>
 hello, am not sure what the question is. Kindly elaborate.

 On Tue, 23 Nov 2021 at 09:19, DJANGO DEVELOPER 
 wrote:

> I am working on a django based project in which I have integrated ML
> trained models to check if a https url is legitimate or not. for this I
> need javascript or ajax to call a rest api for my form in which I want to
> send a post request so that I can check if a https url is legitimate or 
> not.
> *NOTE: My code is running successfully and giving correct answers on
> postman.* so just want to integrate it with my HTML form.
> *My work:*
> *form.html:*
> 
> 
>   
> 
> 
> 
>
> 
> https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css";
> rel="stylesheet"
> integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
> crossorigin="anonymous">
>
> SITE URL Form
>   
>   
>   
>   
> SITE URL
> 
>   
>   POST
> 
>
> 
>
> 
> 
>   (function () {
> var output = document.getElementById('output');
> document.getElementById('post').onclick = function () {
>   var data = document.getElementById('data').value;
>
>   axios.post('http://127.0.0.1:8000/predict/',
> JSON.parse(data))
> .then(function (res) {
>   output.className = 'container';
>   output.innerHTML = res.data;
> })
> .catch(function (err) {
>   output.className = 'container text-danger';
>   output.innerHTML = err.message;
> });
> };
>   })();
> 
>
> 
>
> 
> https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js";
> integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
> crossorigin="anonymous">
>
> 
> 
>   
> 
>
> *myapp/urls.py:*
> path('form/', form, name="form"),
> path('predict/', predict, name='predict')
> *this is the response I am returning:*
> if list(model.predict([test]))[0] == 1:
> return JsonResponse({"Response":"Legitimate"})
> else:
> return JsonResponse({"Response":"Phishing or fake"})
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e81cf4f0-1208-4623-97f9-4b88f01d67b3n%40googlegroups.com
> 

Re: AJAX or Javascript POST request for Django form

2021-11-23 Thread Duncan Santiago
send me your code then,
or GitHub repo handle.

On Tue, 23 Nov 2021 at 11:27, DJANGO DEVELOPER 
wrote:

> sorry if you get offended because I need a solution. a working solution. I
> am not familiar with javascript. so getting a lot of issues
>
> On Tue, Nov 23, 2021 at 10:38 PM Duncan Santiago <
> duncansantiag...@gmail.com> wrote:
>
>> your page also reloads and results may not be displayed on your frontend,
>> just add this lines on your onclick listerner
>>
>> function(e){ //notice the e parameter, it is the event parameter.
>> e.preventDefault()
>>  your code here.
>>
>> }
>>
>> or you can just paste this on your script section
>>
>>
>> (function () {
>> var output = document.getElementById('output');
>> document.getElementById('post').onclick = function (e) {
>> e.preventDefault()
>>   var data = document.getElementById('data').value;
>>
>>   axios.post('http://127.0.0.1:8000/predict/', JSON.parse(data))
>> .then(function (res) {
>>   output.className = 'container';
>>   output.innerHTML = res.data;
>> })
>> .catch(function (err) {
>>   output.className = 'container text-danger';
>>   output.innerHTML = err.message;
>> });
>> };
>>   })();
>>
>> On Tue, 23 Nov 2021 at 10:34, Duncan Santiago 
>> wrote:
>>
>>> do a demo, enter the URL on the text area and click on the post button.
>>> Then send me the logs on the terminal running Django and also open the
>>> console and send the output,
>>>
>>> On Tue, 23 Nov 2021 at 10:21, DJANGO DEVELOPER 
>>> wrote:
>>>
 okay let me explain.
 I have trained models which tells us that which website is legitimate
 or which website is not legitimate. I have integrated that model with my
 django web app using rest api.
 I tested the API on postman and working.
 now I want to get the result on front end using HTML CSS and
 javascript. so how can I achieve it?

 On Tue, Nov 23, 2021 at 10:16 PM Duncan Santiago <
 duncansantiag...@gmail.com> wrote:

> hello, am not sure what the question is. Kindly elaborate.
>
> On Tue, 23 Nov 2021 at 09:19, DJANGO DEVELOPER <
> abubakarbr...@gmail.com> wrote:
>
>> I am working on a django based project in which I have integrated ML
>> trained models to check if a https url is legitimate or not. for this I
>> need javascript or ajax to call a rest api for my form in which I want to
>> send a post request so that I can check if a https url is legitimate or 
>> not.
>> *NOTE: My code is running successfully and giving correct answers on
>> postman.* so just want to integrate it with my HTML form.
>> *My work:*
>> *form.html:*
>> 
>> 
>>   
>> 
>> 
>> 
>>
>> 
>> https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css";
>> rel="stylesheet"
>> integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
>> crossorigin="anonymous">
>>
>> SITE URL Form
>>   
>>   
>>   
>>   
>> SITE URL
>> 
>>   
>>   POST
>> 
>>
>> 
>>
>> 
>> 
>>   (function () {
>> var output = document.getElementById('output');
>> document.getElementById('post').onclick = function () {
>>   var data = document.getElementById('data').value;
>>
>>   axios.post('http://127.0.0.1:8000/predict/',
>> JSON.parse(data))
>> .then(function (res) {
>>   output.className = 'container';
>>   output.innerHTML = res.data;
>> })
>> .catch(function (err) {
>>   output.className = 'container text-danger';
>>   output.innerHTML = err.message;
>> });
>> };
>>   })();
>> 
>>
>> 
>>
>> 
>> https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js";
>> integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
>> crossorigin="anonymous">
>>
>> 
>> 
>>   
>> 
>>
>> *myapp/urls.py:*
>> path('form/', form, name="form"),
>> path('predict/', predict, name='predict')
>> *this is the response I am returning:*
>> if list(model.predict([test]))[0] == 1:
>> return JsonResponse({"Response":"Legitimate"})
>> else:
>> return JsonResponse({"Response":"Phishing or fake"})
>>
>> --
>> 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 dj

Re: AJAX or Javascript POST request for Django form

2021-11-23 Thread DJANGO DEVELOPER
can I have you on anydesk or any meeting tool?

On Tue, Nov 23, 2021 at 11:31 PM Duncan Santiago 
wrote:

> send me your code then,
> or GitHub repo handle.
>
> On Tue, 23 Nov 2021 at 11:27, DJANGO DEVELOPER 
> wrote:
>
>> sorry if you get offended because I need a solution. a working solution.
>> I am not familiar with javascript. so getting a lot of issues
>>
>> On Tue, Nov 23, 2021 at 10:38 PM Duncan Santiago <
>> duncansantiag...@gmail.com> wrote:
>>
>>> your page also reloads and results may not be displayed on your
>>> frontend, just add this lines on your onclick listerner
>>>
>>> function(e){ //notice the e parameter, it is the event parameter.
>>> e.preventDefault()
>>>  your code here.
>>>
>>> }
>>>
>>> or you can just paste this on your script section
>>>
>>>
>>> (function () {
>>> var output = document.getElementById('output');
>>> document.getElementById('post').onclick = function (e) {
>>> e.preventDefault()
>>>   var data = document.getElementById('data').value;
>>>
>>>   axios.post('http://127.0.0.1:8000/predict/', JSON.parse(data))
>>> .then(function (res) {
>>>   output.className = 'container';
>>>   output.innerHTML = res.data;
>>> })
>>> .catch(function (err) {
>>>   output.className = 'container text-danger';
>>>   output.innerHTML = err.message;
>>> });
>>> };
>>>   })();
>>>
>>> On Tue, 23 Nov 2021 at 10:34, Duncan Santiago <
>>> duncansantiag...@gmail.com> wrote:
>>>
 do a demo, enter the URL on the text area and click on the post button.
 Then send me the logs on the terminal running Django and also open the
 console and send the output,

 On Tue, 23 Nov 2021 at 10:21, DJANGO DEVELOPER 
 wrote:

> okay let me explain.
> I have trained models which tells us that which website is legitimate
> or which website is not legitimate. I have integrated that model with my
> django web app using rest api.
> I tested the API on postman and working.
> now I want to get the result on front end using HTML CSS and
> javascript. so how can I achieve it?
>
> On Tue, Nov 23, 2021 at 10:16 PM Duncan Santiago <
> duncansantiag...@gmail.com> wrote:
>
>> hello, am not sure what the question is. Kindly elaborate.
>>
>> On Tue, 23 Nov 2021 at 09:19, DJANGO DEVELOPER <
>> abubakarbr...@gmail.com> wrote:
>>
>>> I am working on a django based project in which I have integrated ML
>>> trained models to check if a https url is legitimate or not. for this I
>>> need javascript or ajax to call a rest api for my form in which I want 
>>> to
>>> send a post request so that I can check if a https url is legitimate or 
>>> not.
>>> *NOTE: My code is running successfully and giving correct answers on
>>> postman.* so just want to integrate it with my HTML form.
>>> *My work:*
>>> *form.html:*
>>> 
>>> 
>>>   
>>> 
>>> 
>>> 
>>>
>>> 
>>> https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css";
>>> rel="stylesheet"
>>> integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
>>> crossorigin="anonymous">
>>>
>>> SITE URL Form
>>>   
>>>   
>>>   
>>>   
>>> SITE URL
>>> 
>>>   
>>>   POST
>>> 
>>>
>>> 
>>>
>>> 
>>> 
>>>   (function () {
>>> var output = document.getElementById('output');
>>> document.getElementById('post').onclick = function () {
>>>   var data = document.getElementById('data').value;
>>>
>>>   axios.post('http://127.0.0.1:8000/predict/',
>>> JSON.parse(data))
>>> .then(function (res) {
>>>   output.className = 'container';
>>>   output.innerHTML = res.data;
>>> })
>>> .catch(function (err) {
>>>   output.className = 'container text-danger';
>>>   output.innerHTML = err.message;
>>> });
>>> };
>>>   })();
>>> 
>>>
>>> 
>>>
>>> 
>>> https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js";
>>> integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
>>> crossorigin="anonymous">
>>>
>>> 
>>> 
>>>   
>>> 
>>>
>>> *myapp/urls.py:*
>>> path('form/', form, name="form"),
>>> path('predict/', predict, name='predict')
>>> *this is the response I am returning:*
>>> if list(model.predict([test]))[0] == 1:
>>> return JsonResponse({"Response":"Legitimate"})
>>> else:
>>>

Re: AJAX or Javascript POST request for Django form

2021-11-23 Thread Duncan Santiago
let's try google meet.

On Tue, 23 Nov 2021 at 11:39, DJANGO DEVELOPER 
wrote:

> can I have you on anydesk or any meeting tool?
>
> On Tue, Nov 23, 2021 at 11:31 PM Duncan Santiago <
> duncansantiag...@gmail.com> wrote:
>
>> send me your code then,
>> or GitHub repo handle.
>>
>> On Tue, 23 Nov 2021 at 11:27, DJANGO DEVELOPER 
>> wrote:
>>
>>> sorry if you get offended because I need a solution. a working solution.
>>> I am not familiar with javascript. so getting a lot of issues
>>>
>>> On Tue, Nov 23, 2021 at 10:38 PM Duncan Santiago <
>>> duncansantiag...@gmail.com> wrote:
>>>
 your page also reloads and results may not be displayed on your
 frontend, just add this lines on your onclick listerner

 function(e){ //notice the e parameter, it is the event parameter.
 e.preventDefault()
  your code here.

 }

 or you can just paste this on your script section


 (function () {
 var output = document.getElementById('output');
 document.getElementById('post').onclick = function (e) {
 e.preventDefault()
   var data = document.getElementById('data').value;

   axios.post('http://127.0.0.1:8000/predict/',
 JSON.parse(data))
 .then(function (res) {
   output.className = 'container';
   output.innerHTML = res.data;
 })
 .catch(function (err) {
   output.className = 'container text-danger';
   output.innerHTML = err.message;
 });
 };
   })();

 On Tue, 23 Nov 2021 at 10:34, Duncan Santiago <
 duncansantiag...@gmail.com> wrote:

> do a demo, enter the URL on the text area and click on the post button.
> Then send me the logs on the terminal running Django and also open the
> console and send the output,
>
> On Tue, 23 Nov 2021 at 10:21, DJANGO DEVELOPER <
> abubakarbr...@gmail.com> wrote:
>
>> okay let me explain.
>> I have trained models which tells us that which website is legitimate
>> or which website is not legitimate. I have integrated that model with my
>> django web app using rest api.
>> I tested the API on postman and working.
>> now I want to get the result on front end using HTML CSS and
>> javascript. so how can I achieve it?
>>
>> On Tue, Nov 23, 2021 at 10:16 PM Duncan Santiago <
>> duncansantiag...@gmail.com> wrote:
>>
>>> hello, am not sure what the question is. Kindly elaborate.
>>>
>>> On Tue, 23 Nov 2021 at 09:19, DJANGO DEVELOPER <
>>> abubakarbr...@gmail.com> wrote:
>>>
 I am working on a django based project in which I have integrated
 ML trained models to check if a https url is legitimate or not. for 
 this I
 need javascript or ajax to call a rest api for my form in which I want 
 to
 send a post request so that I can check if a https url is legitimate 
 or not.
 *NOTE: My code is running successfully and giving correct answers
 on postman.* so just want to integrate it with my HTML form.
 *My work:*
 *form.html:*
 
 
   
 
 
 

 
 https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css";
 rel="stylesheet"
 integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
 crossorigin="anonymous">

 SITE URL Form
   
   
   
   
 SITE URL
 >>> rows="5">
   
   POST
 

 

 
 
   (function () {
 var output = document.getElementById('output');
 document.getElementById('post').onclick = function () {
   var data = document.getElementById('data').value;

   axios.post('http://127.0.0.1:8000/predict/',
 JSON.parse(data))
 .then(function (res) {
   output.className = 'container';
   output.innerHTML = res.data;
 })
 .catch(function (err) {
   output.className = 'container text-danger';
   output.innerHTML = err.message;
 });
 };
   })();
 

 

 
 https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js";
 integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
 crossorigin="anonymous">

 
 
   
>>>

Re: AJAX or Javascript POST request for Django form

2021-11-23 Thread DJANGO DEVELOPER
okay


On Wed, Nov 24, 2021 at 12:04 AM Duncan Santiago 
wrote:

> let's try google meet.
>
> On Tue, 23 Nov 2021 at 11:39, DJANGO DEVELOPER 
> wrote:
>
>> can I have you on anydesk or any meeting tool?
>>
>> On Tue, Nov 23, 2021 at 11:31 PM Duncan Santiago <
>> duncansantiag...@gmail.com> wrote:
>>
>>> send me your code then,
>>> or GitHub repo handle.
>>>
>>> On Tue, 23 Nov 2021 at 11:27, DJANGO DEVELOPER 
>>> wrote:
>>>
 sorry if you get offended because I need a solution. a working
 solution. I am not familiar with javascript. so getting a lot of issues

 On Tue, Nov 23, 2021 at 10:38 PM Duncan Santiago <
 duncansantiag...@gmail.com> wrote:

> your page also reloads and results may not be displayed on your
> frontend, just add this lines on your onclick listerner
>
> function(e){ //notice the e parameter, it is the event parameter.
> e.preventDefault()
>  your code here.
>
> }
>
> or you can just paste this on your script section
>
>
> (function () {
> var output = document.getElementById('output');
> document.getElementById('post').onclick = function (e) {
> e.preventDefault()
>   var data = document.getElementById('data').value;
>
>   axios.post('http://127.0.0.1:8000/predict/',
> JSON.parse(data))
> .then(function (res) {
>   output.className = 'container';
>   output.innerHTML = res.data;
> })
> .catch(function (err) {
>   output.className = 'container text-danger';
>   output.innerHTML = err.message;
> });
> };
>   })();
>
> On Tue, 23 Nov 2021 at 10:34, Duncan Santiago <
> duncansantiag...@gmail.com> wrote:
>
>> do a demo, enter the URL on the text area and click on the post
>> button.
>> Then send me the logs on the terminal running Django and also open
>> the console and send the output,
>>
>> On Tue, 23 Nov 2021 at 10:21, DJANGO DEVELOPER <
>> abubakarbr...@gmail.com> wrote:
>>
>>> okay let me explain.
>>> I have trained models which tells us that which website is
>>> legitimate or which website is not legitimate. I have integrated that 
>>> model
>>> with my django web app using rest api.
>>> I tested the API on postman and working.
>>> now I want to get the result on front end using HTML CSS and
>>> javascript. so how can I achieve it?
>>>
>>> On Tue, Nov 23, 2021 at 10:16 PM Duncan Santiago <
>>> duncansantiag...@gmail.com> wrote:
>>>
 hello, am not sure what the question is. Kindly elaborate.

 On Tue, 23 Nov 2021 at 09:19, DJANGO DEVELOPER <
 abubakarbr...@gmail.com> wrote:

> I am working on a django based project in which I have integrated
> ML trained models to check if a https url is legitimate or not. for 
> this I
> need javascript or ajax to call a rest api for my form in which I 
> want to
> send a post request so that I can check if a https url is legitimate 
> or not.
> *NOTE: My code is running successfully and giving correct answers
> on postman.* so just want to integrate it with my HTML form.
> *My work:*
> *form.html:*
> 
> 
>   
> 
> 
> 
>
> 
> https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css";
> rel="stylesheet"
> integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
> crossorigin="anonymous">
>
> SITE URL Form
>   
>   
>   
>   
> SITE URL
>  rows="5">
>   
>   POST
> 
>
> 
>
> 
> 
>   (function () {
> var output = document.getElementById('output');
> document.getElementById('post').onclick = function () {
>   var data = document.getElementById('data').value;
>
>   axios.post('http://127.0.0.1:8000/predict/',
> JSON.parse(data))
> .then(function (res) {
>   output.className = 'container';
>   output.innerHTML = res.data;
> })
> .catch(function (err) {
>   output.className = 'container text-danger';
>   output.innerHTML = err.message;
> });
> };
>   })();
> 
>
> 
>
> 
> https://cdn.jsdelivr.net/npm/bootstrap@5

Re: AJAX or Javascript POST request for Django form

2021-11-23 Thread DJANGO DEVELOPER
https://meet.google.com/pns-vbmz-sys

On Wed, Nov 24, 2021 at 12:08 AM DJANGO DEVELOPER 
wrote:

> okay
>
>
> On Wed, Nov 24, 2021 at 12:04 AM Duncan Santiago <
> duncansantiag...@gmail.com> wrote:
>
>> let's try google meet.
>>
>> On Tue, 23 Nov 2021 at 11:39, DJANGO DEVELOPER 
>> wrote:
>>
>>> can I have you on anydesk or any meeting tool?
>>>
>>> On Tue, Nov 23, 2021 at 11:31 PM Duncan Santiago <
>>> duncansantiag...@gmail.com> wrote:
>>>
 send me your code then,
 or GitHub repo handle.

 On Tue, 23 Nov 2021 at 11:27, DJANGO DEVELOPER 
 wrote:

> sorry if you get offended because I need a solution. a working
> solution. I am not familiar with javascript. so getting a lot of issues
>
> On Tue, Nov 23, 2021 at 10:38 PM Duncan Santiago <
> duncansantiag...@gmail.com> wrote:
>
>> your page also reloads and results may not be displayed on your
>> frontend, just add this lines on your onclick listerner
>>
>> function(e){ //notice the e parameter, it is the event parameter.
>> e.preventDefault()
>>  your code here.
>>
>> }
>>
>> or you can just paste this on your script section
>>
>>
>> (function () {
>> var output = document.getElementById('output');
>> document.getElementById('post').onclick = function (e) {
>> e.preventDefault()
>>   var data = document.getElementById('data').value;
>>
>>   axios.post('http://127.0.0.1:8000/predict/',
>> JSON.parse(data))
>> .then(function (res) {
>>   output.className = 'container';
>>   output.innerHTML = res.data;
>> })
>> .catch(function (err) {
>>   output.className = 'container text-danger';
>>   output.innerHTML = err.message;
>> });
>> };
>>   })();
>>
>> On Tue, 23 Nov 2021 at 10:34, Duncan Santiago <
>> duncansantiag...@gmail.com> wrote:
>>
>>> do a demo, enter the URL on the text area and click on the post
>>> button.
>>> Then send me the logs on the terminal running Django and also open
>>> the console and send the output,
>>>
>>> On Tue, 23 Nov 2021 at 10:21, DJANGO DEVELOPER <
>>> abubakarbr...@gmail.com> wrote:
>>>
 okay let me explain.
 I have trained models which tells us that which website is
 legitimate or which website is not legitimate. I have integrated that 
 model
 with my django web app using rest api.
 I tested the API on postman and working.
 now I want to get the result on front end using HTML CSS and
 javascript. so how can I achieve it?

 On Tue, Nov 23, 2021 at 10:16 PM Duncan Santiago <
 duncansantiag...@gmail.com> wrote:

> hello, am not sure what the question is. Kindly elaborate.
>
> On Tue, 23 Nov 2021 at 09:19, DJANGO DEVELOPER <
> abubakarbr...@gmail.com> wrote:
>
>> I am working on a django based project in which I have integrated
>> ML trained models to check if a https url is legitimate or not. for 
>> this I
>> need javascript or ajax to call a rest api for my form in which I 
>> want to
>> send a post request so that I can check if a https url is legitimate 
>> or not.
>> *NOTE: My code is running successfully and giving correct answers
>> on postman.* so just want to integrate it with my HTML form.
>> *My work:*
>> *form.html:*
>> 
>> 
>>   
>> 
>> 
>> 
>>
>> 
>> https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css";
>> rel="stylesheet"
>> integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
>> crossorigin="anonymous">
>>
>> SITE URL Form
>>   
>>   
>>   
>>   
>> SITE URL
>> > rows="5">
>>   
>>   POST
>> 
>>
>> 
>>
>> 
>> 
>>   (function () {
>> var output = document.getElementById('output');
>> document.getElementById('post').onclick = function () {
>>   var data = document.getElementById('data').value;
>>
>>   axios.post('http://127.0.0.1:8000/predict/',
>> JSON.parse(data))
>> .then(function (res) {
>>   output.className = 'container';
>>   output.innerHTML = res.data;
>> })
>> .catch(function (err) {
>>   output.className = 

Re: learn django

2021-11-23 Thread MR INDIA
Oh Sorry

On Tue, 23 Nov 2021 at 21:45, Kasper Laudrup  wrote:

> On 23/11/2021 15.39, MR INDIA wrote:
> > I wrote to the person who asked the question
> >
>
> Well, you replied to me. That was a bit confusing, but we all make
> mistakes of course.
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/9AiTVlwAHQ8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/2772102d-8a22-1060-5ea4-5e1ff723237d%40stacktrace.dk
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABKy62mw1%2BY-LgipK87HaY68JPW9XLVwgs42%3D9VdWvdbw%3D8BLA%40mail.gmail.com.