Re: How to invoke Sub Form which have MULTIPLE OPTIONS to choose inside Django Form.

2020-05-20 Thread chaitanya orakala
Thank you for your response. I see some javascript inside the form. I am
not fully aware of it. is there any template which I can use in forms??

On Thu, May 21, 2020 at 1:22 AM Vishesh Mangla 
wrote:

> #template
>
> 
>   Volvo
>   Saab
>   Opel
>   Audi
> 
>
>
>
> 
>
> 
>
>
>
>
>
> 
>
> 
>
> 
>
> 
>
> 
>
> Document.querySelector(“select”).addEventListener(“change”,(ele)={
>
> If ele.target.textContent ==”Volvo”:
>
> ..
>
> Else if
>
> ...
>
> Else
>
> ...
>
> })
>
> 
>
>
>
> Otherwise just send a form to pick the user preference out of Basic,
> Standard, Advanced, get the request and based on the request’s attributes
> send a form back through redirect function.
>
> Sent from Mail  for
> Windows 10
>
>
>
> *From: *Sai 
> *Sent: *21 May 2020 10:00
> *To: *Django users 
> *Subject: *How to invoke Sub Form which have MULTIPLE OPTIONS to choose
> inside Django Form.
>
>
>
> Hi Everyone,
>
> I am pretty much familiar with Django Forms with models. I want to build a
> Submit Form which consists of attributes like UserName, Email, address
> field and 3 options to select the packages, for example, Basic, Standard,
> and Advanced.  I have gone through Django Docs but there is no such thing.
>
>
>
> Please let me know how to achieve this and open to ideas.
>
>
>
> Thank You in Advance.
>
> --
> 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/cb12fc88-0d5a-4ec4-a6d6-1272a0a69d9a%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/5ec6100b.1c69fb81.97f6e.083a%40mx.google.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/CAPcTzRaKzDosDCbUMR%3DHyM6bDEvk3VPmhEEcZ750Lho0uwrFjw%40mail.gmail.com.


RE: Please help me out?

2020-05-20 Thread Vishesh Mangla
You need to look at the “header” of the request object for those details. Sent from Mail for Windows 10 From: meera ganganiSent: 21 May 2020 10:39To: django-users@googlegroups.comSubject: Please help me out? I want to mark the attendance of employee using ip address or any other waycan you please help me out of the situation? Thanking You,Meera.-- 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/CANaPPPJY3JypYQaWbbx%3DNQe6SyUghvXXRRF4SK3iER0N0wa0OQ%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/5ec61042.1c69fb81.acd42.0c85%40mx.google.com.


RE: How to invoke Sub Form which have MULTIPLE OPTIONS to choose inside Django Form.

2020-05-20 Thread Vishesh Mangla
#template   

Document.querySelector(“select”).addEventListener(“change”,(ele)={

If ele.target.textContent ==”Volvo”:

    ..

Else if

...

Else

...

})

  Otherwise just send a form to pick the user preference out of Basic, Standard, Advanced, get the request and based on the request’s attributes send a form back through redirect function. Sent from Mail for Windows 10 From: SaiSent: 21 May 2020 10:00To: Django usersSubject: How to invoke Sub Form which have MULTIPLE OPTIONS to choose inside Django Form. Hi Everyone, I am pretty much familiar with Django Forms with models. I want to build a Submit Form which consists of attributes like UserName, Email, address field and 3 options to select the packages, for example, Basic, Standard, and Advanced.  I have gone through Django Docs but there is no such thing. Please let me know how to achieve this and open to ideas.  Thank You in Advance.-- 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/cb12fc88-0d5a-4ec4-a6d6-1272a0a69d9a%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/5ec6100b.1c69fb81.97f6e.083a%40mx.google.com.


Please help me out?

2020-05-20 Thread meera gangani
I want to mark the attendance of employee using ip address or any other way
can you please help me out of the situation?

Thanking You,
Meera.

-- 
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/CANaPPPJY3JypYQaWbbx%3DNQe6SyUghvXXRRF4SK3iER0N0wa0OQ%40mail.gmail.com.


How to invoke Sub Form which have MULTIPLE OPTIONS to choose inside Django Form.

2020-05-20 Thread Sai
Hi Everyone, 
I am pretty much familiar with Django Forms with models. I want to build a 
Submit Form which consists of attributes like UserName, Email, address 
field and 3 options to select the packages, for example, Basic, Standard, 
and Advanced.  I have gone through Django Docs but there is no such thing.

Please let me know how to achieve this and open to ideas. 

Thank You in Advance.

-- 
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/cb12fc88-0d5a-4ec4-a6d6-1272a0a69d9a%40googlegroups.com.


Re: TypeError: __init__() got an unexpected keyword argument 'Null'

2020-05-20 Thread Jorge Gimeno
Similar to keys in a dictionary, keyword argument names are case
sensitive.  Try to pass in the lowercase version 'null':

Raison_Non_Delivery_cd = models.ForeignKey(Raison,
on_delete=models.CASCADE, related_name='raisonNonDelivery', null=True)

-Jorge

On Wed, May 20, 2020 at 5:05 PM hajar  wrote:

> hello django users , I hope u r doing well !
>
>
> why can't I use Null in this case of foreign key , I hope you can see the
> picture below that's my class and the error
>
>
>
> [image: err.png]
>
> --
> 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/ce736614-3ff9-47fa-885d-3f5b87160291%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/CANfN%3DK8aTYjLmtyTsPCSrViFFAd9ZTiF5S4W%3DwHr0EEFxNzNmQ%40mail.gmail.com.


Re: Django foreign-key cannot assign must be a instance

2020-05-20 Thread saqlain abbas
try to pass -1.0

On Tue, May 19, 2020 at 1:08 PM Aldian Fazrihady  wrote:

> replace
> ```
> Report.objects.create(param=test_name,comp=compon,value=test_value)
> ```
> with
> ```
> Report.objects.create(param=test_name,comp_id=compon,value=test_value)
> ```
>
> On Tue, May 19, 2020 at 2:39 PM ratnadeep ray 
> wrote:
>
>> Can you please say in which line we should make that change because in so
>> many places I am using comp. So in all the places should I change that ?
>>
>> On Tuesday, 19 May 2020 12:36:19 UTC+5:30, Aldian Fazrihady wrote:
>>>
>>> Use comp_id= instead of comp=
>>>
>>> Regards,
>>>
>>> Aldian Fazrihady
>>> http://aldianfazrihady.com
>>>
>>> Pada tanggal Sel, 19 Mei 2020 13.49, ratnadeep ray 
>>> menulis:
>>>
 Hi all,

 I am trying to add a row in the DB using the following views.py:

 # Create your views here.
> from django.shortcuts import render
> from fusioncharts.models import Component,Report
> import xlrd
> def pie_chart(request):
> labels = []
> data = []
> loc = ("C:\Django_apps\QRC_Report.xlsx")
> workbook = xlrd.open_workbook(loc)
> worksheet = workbook.sheet_by_name('Sheet1')
> num_rows = worksheet.nrows - 1
> num_cols = worksheet.ncols - 1
> curr_row = -1
> component = []
> comp = None
> while curr_row < num_rows:
>   curr_row += 1
>   row = worksheet.row(curr_row)
>   curr_col = -1
>   if "Header" in worksheet.cell_value(curr_row, 0):
> compon = worksheet.cell_value(curr_row, 0).strip("*")
> print("The component is %s" %compon)
> component.append(compon)
> print("===The results of the component %s is as
> follows" %compon)
> Component.objects.create(comp=compon)
> continue
>   while curr_col < num_cols:
> curr_col += 1
> cell_value = worksheet.cell_value(curr_row, curr_col)
> #print("Cell value = %s" %cell_value)
> test_name = worksheet.cell_value(curr_row,0)
> print("Test name = %s" %test_name)
> test_value = worksheet.cell_value(curr_row,1)
> print("Test result = %s" %test_value)
> print("The component is = %s" %comp)
>
> *Report.objects.create(param=test_name,comp=compon,value=test_value)*
> return render(request, 'pie_chart.html', {
> 'labels': labels,
> 'data': data,
> })


 However the above highlighted line is throwing the following error:

> Cannot assign "'Header SQL Detailed'": "Report.comp" must be a
> "Component" instance.


 My model is as follows:

 from django.db import models
> from django.urls import reverse
> from decimal import Decimal
> # Create your models here.
> class Component(models.Model):
> comp = models.CharField(max_length=30)
> class Report(models.Model):
> comp = models.ForeignKey(Component,on_delete=models.CASCADE)
> param = models.CharField(max_length=30)
> value =
> models.DecimalField(max_digits=25,decimal_places=18,default=Decimal('0.'))



 Can anyone please point out what is going wrong here? What should be
 the correction?

 Thanks.

 --
 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...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/afb5a06a-0d7d-4038-a0fc-3c2aadbbe4fc%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/1425af8b-7dae-4cdb-ba8a-82d0a9fa0a74%40googlegroups.com
>> 
>> .
>>
>
>
> --
> Regards,
>
> Aldian Fazrihady
> http://aldianfazrihady.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/CAN7EoAZ%2BnrQSbpcwx8-PbYyvTNLE1X%3DpfLH0ifVb2KrR3zRsEw%40mail.gmail.com
> 

TypeError: __init__() got an unexpected keyword argument 'Null'

2020-05-20 Thread hajar


hello django users , I hope u r doing well ! 


why can't I use Null in this case of foreign key , I hope you can see the 
picture below that's my class and the error 



[image: err.png]

-- 
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/ce736614-3ff9-47fa-885d-3f5b87160291%40googlegroups.com.


Re: Add search to my blog app

2020-05-20 Thread sachin chaurasiya
>From which book you have had learnt django

On Wed, May 20, 2020, 9:46 PM sunday honesty 
wrote:

> Hello everyone! I have got a question. I am a Django beginner trying to
> build my first web app after completing a book.
>
> I made an app I called developers forum where authenticated users can post
> something like question or code achievement and another can comment in form
> of answer.
> I want to add a search functionality which was not covered in the tutorial.
> I browsed out and found how I could add the search but the search results
> will be displayed to a designated urls created for the purpose. I want to
> be able to redirect the searcher to the exact post containing the keyword
> they have typed in the search form with the text highlighted. How can I
> achieve that... If you need any pieces of my code to be able to help me, be
> kind to ask me; I'll post a link to where you can find it.
> Thanks in advance.
>
> --
> 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/cdbf7038-480e-446f-aeac-e079ad575e47%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/CAD_X%3DJrpiPHhOWqjwQXC5MAiC9js_79Pz5e5JJnX477LqTEX%2BA%40mail.gmail.com.


Re: Can you help me out?

2020-05-20 Thread Suraj Thapa FC
Django channels

On Wed, 20 May, 2020, 9:07 pm chaitanya orakala, 
wrote:

> Hi Meera,
> Please go through this link, it might help you
> https://chatterbot.readthedocs.io/en/stable/django/
>
> how ever if you are ok with third-party applications,  you can choose
> Zendesk or Drift.
>
> Thank You
>
> On Wed, May 20, 2020 at 11:19 AM meera gangani 
> wrote:
>
>> I create a chatroom in django
>> Please let me help if you know how to do it?
>> Otherwise you can tell me a library so at least I can do it myself?
>>
>>
>> Thanking You
>> -Meera
>>
>> --
>> 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/CANaPPPKytMLmEWGMhe5Y6zGEW25P1uPAdbXY%2BB3xH%2BcQHZgAAg%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/CAPcTzRYe57-UkcfxTSWj7%3D_Jm49cDdn1h1_kGKhR0boob-zU5A%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/CAPjsHcGx17-bCNT1bAL9vPGpx-btD3_fdCMJzMm4JDbAhPms8A%40mail.gmail.com.


RE: Add search to my blog app

2020-05-20 Thread Vishesh Mangla
Or one thing you can do w/o _javascript_, that is send a post request to the server through a form and then redirect to a view with a blog matching that search query.  Template: {{csrf_token}} //see the correct template tagSubmit Views:def index(request):    if request.method ==”POST”:    search_query = request.POST[“search”]    //Suppose search query is blog_1   If search_query[-1] == 1:   return httpResponse(“blog1”)    return //default index.html   Sent from Mail for Windows 10 From: Ali AhammadSent: 20 May 2020 22:32To: Django usersSubject: Add search to my blog app At first you should make search search template where you should put what and how you want display Then you should write a views.py function where you should usequery=request.GET[‘queer’]Object_list=Post.objects.filter(title__icontains=query)*same for the content If you want and then you should use union*Return render(request,’search.html’,{ ‘object_list’:object_list,’query’:query}) Then in the sign.html use ur home.html or anything and write according to your requirement You don’t need to use java -- 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/277d37ed-188f-4ad1-960a-e4f5eceee3d0%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/5ec5630d.1c69fb81.1f3d5.4cfd%40mx.google.com.


RE: Add search to my blog app

2020-05-20 Thread Vishesh Mangla
_javascript_ it that needs to be done dynamically otherwise redirect() Sent from Mail for Windows 10 From: Ali AhammadSent: 20 May 2020 22:32To: Django usersSubject: Add search to my blog app At first you should make search search template where you should put what and how you want display Then you should write a views.py function where you should usequery=request.GET[‘queer’]Object_list=Post.objects.filter(title__icontains=query)*same for the content If you want and then you should use union*Return render(request,’search.html’,{ ‘object_list’:object_list,’query’:query}) Then in the sign.html use ur home.html or anything and write according to your requirement You don’t need to use java -- 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/277d37ed-188f-4ad1-960a-e4f5eceee3d0%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/5ec562fc.1c69fb81.b8149.a086%40mx.google.com.


Add search to my blog app

2020-05-20 Thread Ali Ahammad
At first you should make search search template where you should put what and 
how you want display

Then you should write a views.py function where you should use
query=request.GET[‘queer’]
Object_list=Post.objects.filter(title__icontains=query)
*same for the content If you want and then you should use union*
Return render(request,’search.html’,{ ‘object_list’:object_list,’query’:query})

Then in the sign.html use ur home.html or anything and write according to your 
requirement

You don’t need to use java

-- 
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/277d37ed-188f-4ad1-960a-e4f5eceee3d0%40googlegroups.com.


RE: Re: Add search to my blog app

2020-05-20 Thread Vishesh Mangla
Then you have a better option to learn react(a frontend framework for _javascript_). You cannot do dynamic stuff on the web without using _javascript_. Sent from Mail for Windows 10 From: sunday honestySent: 20 May 2020 21:57To: django-users@googlegroups.comSubject: Re: Add search to my blog app I don't know _javascript_ On Wed, May 20, 2020, 5:25 PM Vishesh Mangla  wrote:Hi if you want a search bar you need _javascript_ which will do the dynamic stuff. Add an event listener to you  of html and use “change” as the event. Then you need to insert and remove elements on the DOM based on the text in the search box. For more info ask on  https://webchat.freenode.net/ in the #_javascript_.  Sent from Mail for Windows 10 From: sunday honestySent: 20 May 2020 21:45To: Django usersSubject: Add search to my blog app Hello everyone! I have got a question. I am a Django beginner trying to build my first web app after completing a book. I made an app I called developers forum where authenticated users can post something like question or code achievement and another can comment in form of answer.I want to add a search functionality which was not covered in the tutorial.I browsed out and found how I could add the search but the search results will be displayed to a designated urls created for the purpose. I want to be able to redirect the searcher to the exact post containing the keyword they have typed in the search form with the text highlighted. How can I achieve that... If you need any pieces of my code to be able to help me, be kind to ask me; I'll post a link to where you can find it.Thanks in advance. -- 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/cdbf7038-480e-446f-aeac-e079ad575e47%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/5ec559c3.1c69fb81.ccc5c.9d57%40mx.google.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/CALcuGNv0LBJeQxZB04xyWCDvTgoo5zN82Nf_7bqpomAbQWwAFQ%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/5ec560b5.1c69fb81.18b72.a8fe%40mx.google.com.


RE: Re: NEW TO DJANGO

2020-05-20 Thread Vishesh Mangla
  Sent from Mail for Windows 10 From: Madhav NandanSent: 20 May 2020 22:19To: Django usersSubject: Re: NEW TO DJANGO I need to know what I should do so that once I click a hyperlink, it will redirect me to a payment page and I need to make a working payment option like paypal integration or razorpay integration. I did installed sdk, I made account on razorpay. what next? thanks for response. From: Madhav NandanSent: 19 May 2020 20:34To: django...@googlegroups.comSubject: NEW TO DJANGO Dear Django fellas, I'm new to Django here. I started learning and it's been a while and I'm facing a lot of issues. Can somebody help me with ''how can I integrate a payment system like PayPal to a link?'' Like I have a link, if someone clicks on that link that will redirect the user to the payment page and there on the payment provider works. I just need to get started and somebody can guide me here hopefully. I don't' need code or so. Help me here. Best regards,-- Madhav Nandancell: 9170459494Skype: gaurav.kumar3992 -- 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...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGXYL6JYzv%3DvTRNXc1ZqSvJ-6S%3DOSJt%2B%3D_%3DhLqvwyaD0Z_NoDA%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/63a1a453-ee38-4eba-85f7-a4d6f46c367d%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/5ec5605b.1c69fb81.9a1f5.8ba9%40mx.google.com.


RE: Re: NEW TO DJANGO

2020-05-20 Thread Vishesh Mangla
Haven’t you used the redirect() function in Django? Sent from Mail for Windows 10 From: Madhav NandanSent: 20 May 2020 22:19To: Django usersSubject: Re: NEW TO DJANGO I need to know what I should do so that once I click a hyperlink, it will redirect me to a payment page and I need to make a working payment option like paypal integration or razorpay integration. I did installed sdk, I made account on razorpay. what next? thanks for response. From: Madhav NandanSent: 19 May 2020 20:34To: django...@googlegroups.comSubject: NEW TO DJANGO Dear Django fellas, I'm new to Django here. I started learning and it's been a while and I'm facing a lot of issues. Can somebody help me with ''how can I integrate a payment system like PayPal to a link?'' Like I have a link, if someone clicks on that link that will redirect the user to the payment page and there on the payment provider works. I just need to get started and somebody can guide me here hopefully. I don't' need code or so. Help me here. Best regards,-- Madhav Nandancell: 9170459494Skype: gaurav.kumar3992 -- 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...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGXYL6JYzv%3DvTRNXc1ZqSvJ-6S%3DOSJt%2B%3D_%3DhLqvwyaD0Z_NoDA%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/63a1a453-ee38-4eba-85f7-a4d6f46c367d%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/5ec55fec.1c69fb81.99dba.9ce0%40mx.google.com.


Re: NEW TO DJANGO

2020-05-20 Thread Madhav Nandan
I need to know what I should do so that once I click a hyperlink, it will 
redirect me to a payment page and I need to make a working payment option 
like paypal integration or razorpay integration.

I did installed sdk, I made account on razorpay. what next?

thanks for response.


 
>
> *From: *Madhav Nandan 
> *Sent: *19 May 2020 20:34
> *To: *django...@googlegroups.com 
> *Subject: *NEW TO DJANGO
>
>  
>
> Dear Django fellas,
>
>  
>
> I'm new to Django here. I started learning and it's been a while and I'm 
> facing a lot of issues. Can somebody help me with *''how can I integrate 
> a payment system like PayPal to a link?''*
>
>  Like I have a link, if someone clicks on that link that will redirect the 
> user to the payment page and there on the payment provider works.
>
>  
>
> I just need to get started and somebody can guide me here hopefully. I 
> don't' need code or so.
>
>  
>
> Help me here.
>
>  
>
> Best regards,
>
>  
>
>  
>
>  
>
>  
>
> -- 
>
> Madhav Nandan
>
> cell: 9170459494
>
> Skype: gaurav.kumar3992
>
>  
>
> -- 
> 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...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAGXYL6JYzv%3DvTRNXc1ZqSvJ-6S%3DOSJt%2B%3D_%3DhLqvwyaD0Z_NoDA%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/63a1a453-ee38-4eba-85f7-a4d6f46c367d%40googlegroups.com.


Re: Add search to my blog app

2020-05-20 Thread sunday honesty
I don't know JavaScript

On Wed, May 20, 2020, 5:25 PM Vishesh Mangla 
wrote:

> Hi if you want a search bar you need javascript which will do the dynamic
> stuff. Add an event listener to you  of html and use
> “change” as the event. Then you need to insert and remove elements on the
> DOM based on the text in the search box. For more info ask on
> https://webchat.freenode.net/ in the #javascript.
>
>
>
> Sent from Mail  for
> Windows 10
>
>
>
> *From: *sunday honesty 
> *Sent: *20 May 2020 21:45
> *To: *Django users 
> *Subject: *Add search to my blog app
>
>
>
> Hello everyone! I have got a question. I am a Django beginner trying to
> build my first web app after completing a book.
>
>
>
> I made an app I called developers forum where authenticated users can post
> something like question or code achievement and another can comment in form
> of answer.
>
> I want to add a search functionality which was not covered in the tutorial.
>
> I browsed out and found how I could add the search but the search results
> will be displayed to a designated urls created for the purpose. I want to
> be able to redirect the searcher to the exact post containing the keyword
> they have typed in the search form with the text highlighted. How can I
> achieve that... If you need any pieces of my code to be able to help me, be
> kind to ask me; I'll post a link to where you can find it.
>
> Thanks in advance.
>
>
>
> --
>
> 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/cdbf7038-480e-446f-aeac-e079ad575e47%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/5ec559c3.1c69fb81.ccc5c.9d57%40mx.google.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/CALcuGNv0LBJeQxZB04xyWCDvTgoo5zN82Nf_7bqpomAbQWwAFQ%40mail.gmail.com.


RE: Add search to my blog app

2020-05-20 Thread Vishesh Mangla
Hi if you want a search bar you need _javascript_ which will do the dynamic stuff. Add an event listener to you  of html and use “change” as the event. Then you need to insert and remove elements on the DOM based on the text in the search box. For more info ask on  https://webchat.freenode.net/ in the #_javascript_.  Sent from Mail for Windows 10 From: sunday honestySent: 20 May 2020 21:45To: Django usersSubject: Add search to my blog app Hello everyone! I have got a question. I am a Django beginner trying to build my first web app after completing a book. I made an app I called developers forum where authenticated users can post something like question or code achievement and another can comment in form of answer.I want to add a search functionality which was not covered in the tutorial.I browsed out and found how I could add the search but the search results will be displayed to a designated urls created for the purpose. I want to be able to redirect the searcher to the exact post containing the keyword they have typed in the search form with the text highlighted. How can I achieve that... If you need any pieces of my code to be able to help me, be kind to ask me; I'll post a link to where you can find it.Thanks in advance. -- 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/cdbf7038-480e-446f-aeac-e079ad575e47%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/5ec559c3.1c69fb81.ccc5c.9d57%40mx.google.com.


Add search to my blog app

2020-05-20 Thread sunday honesty
Hello everyone! I have got a question. I am a Django beginner trying to build 
my first web app after completing a book.

I made an app I called developers forum where authenticated users can post 
something like question or code achievement and another can comment in form of 
answer.
I want to add a search functionality which was not covered in the tutorial.
I browsed out and found how I could add the search but the search results will 
be displayed to a designated urls created for the purpose. I want to be able to 
redirect the searcher to the exact post containing the keyword they have typed 
in the search form with the text highlighted. How can I achieve that... If you 
need any pieces of my code to be able to help me, be kind to ask me; I'll post 
a link to where you can find it.
Thanks in advance.

-- 
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/cdbf7038-480e-446f-aeac-e079ad575e47%40googlegroups.com.


Re: Can you help me out?

2020-05-20 Thread chaitanya orakala
Hi Meera,
Please go through this link, it might help you
https://chatterbot.readthedocs.io/en/stable/django/

how ever if you are ok with third-party applications,  you can choose
Zendesk or Drift.

Thank You

On Wed, May 20, 2020 at 11:19 AM meera gangani 
wrote:

> I create a chatroom in django
> Please let me help if you know how to do it?
> Otherwise you can tell me a library so at least I can do it myself?
>
>
> Thanking You
> -Meera
>
> --
> 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/CANaPPPKytMLmEWGMhe5Y6zGEW25P1uPAdbXY%2BB3xH%2BcQHZgAAg%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/CAPcTzRYe57-UkcfxTSWj7%3D_Jm49cDdn1h1_kGKhR0boob-zU5A%40mail.gmail.com.


Re: HOW TO PROTECT SOURCE CODE DEPLOYED TO A REMOTE SERVER

2020-05-20 Thread James Shen
try to deploy using a container technology like a docker , only expose port
80, and keep the login to SSH to yourself.

On Wed, May 20, 2020 at 4:54 PM John McClain  wrote:

> Hello Sunday,
>
> I wonder if you could deploy to git and use one of the licenses there to
> protect the code. I think they would be bound by the use the license
> permits. Have you looked at this as a possibility?
>
> John
>
> On Tue, 19 May 2020 at 02:35, Sunday Iyanu Ajayi 
> wrote:
>
>> I get your point but my solution is kind of a  SaaS Application. the
>> client wants to host it on his controlled server  and if they get the
>> source code, they can replicate, modify and maybe sell it.  Is there a way
>> to host the compiled file or lock the directory to the project.
>> *AJAYI Sunday *
>> (+234) 806 771 5394
>> *sunnexaj...@gmail.com *
>>
>>
>>
>> On Mon, May 18, 2020 at 9:28 PM Jim Armstrong 
>> wrote:
>>
>>> When I work on client projects, I deploy to a test server that is under
>>> my control. Once the project is complete and they have paid the invoice, I
>>> deploy to the production server under their control. At that point, I don't
>>> care if they have access to the code - my contracts give the clients all
>>> rights to the project code upon completion of the project.
>>>
>>>
>>> On Friday, May 15, 2020 at 9:22:33 AM UTC-4, Sunday Iyanu Ajayi wrote:

 I am working for a client that wants to deploy a project I am working
 on in a remote server and I will like to project my source code when
 deployed so that they will not be able to mess with it.

 How can  I  go about it please?

 *AJAYI Sunday *
 (+234) 806 771 5394
 *sunne...@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/636f0636-30df-4ce2-8629-2be8b208ec37%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/CAKYSAw3Hqjuz5rD_AsZ5Wa%2B3WBzQ9LN0GzZKHx3D-irztJ1G0A%40mail.gmail.com
>> 
>> .
>>
>
>
> --
> John McClain
>
> Cell: 085-1977-823
> Skype: jmcclain0129
> Email: jmcclain0...@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/CAN-hv_pbGUu7Qjm%2BZO7fOmT2H1W2C8Xy%2BhTk_6_BQcUcwc-XbA%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/CAEmHaVuC4MJG6G1wfvJ_0QOEP7aRQK_OaSE5i_aWN19yt%3DGLog%40mail.gmail.com.


Can you help me out?

2020-05-20 Thread meera gangani
I create a chatroom in django
Please let me help if you know how to do it?
Otherwise you can tell me a library so at least I can do it myself?


Thanking You
-Meera

-- 
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/CANaPPPKytMLmEWGMhe5Y6zGEW25P1uPAdbXY%2BB3xH%2BcQHZgAAg%40mail.gmail.com.


Re: Reverse for 'display_data' not found. 'display_data' is not a valid view function or pattern name

2020-05-20 Thread Jorge Gimeno
On Tue, May 19, 2020 at 10:56 PM ratnadeep ray  wrote:

> Hi all,
>
> I am getting the below error when I am trying to load the home page:
> Reverse for 'display_data' not found. 'display_data' is not a valid view
> function or pattern name
>
> My views.py file is as follows:
>
>
>
>> def home(request):
>> #query_results = QRC_DB.objects.all()
>> return render(request, 'display_data.html')
>>
>> def display_data(request,component):
>> #query_results = QRC_DB.objects.all()
>> return HttpResponse("You're looking at the component %s." % component)
>
>
> My urls.py file under the app is as follows:
>
> from django.urls import path
> from fusioncharts import views
>
> urlpatterns = [
>> path('home/', views.home, name=''),
>> ]
>
>
> The urls.py file under the project is as follows:
>
> from django.contrib import admin
>> from django.urls import path,include
>> urlpatterns = [
>> path('admin/', admin.site.urls),
>> path('', include('fusioncharts.urls'))
>> ]
>
>
>
> And my html file (display_data) code is as follows :
>
>>
>> {% block content %}
>>   Display the test results
>>   
>> 
>> SQL
>>   
>> {% endblock %}
>
>
>
>
> Can anyone please help me to find out the mistake ?
>
> Thanks.
>
>
>
>
>
>
> --
> 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/31ce205c-b54c-484f-8928-350eb91178a6%40googlegroups.com
> 
> .
>

NoReverseFound is one of those exceptions that I need a mental mapping
for.  It's not necessarily easy to intuit the meaning from the name
itself.  What works for me is that Django is saying "You've given me a
named URL, and I can't find it."

In your template, there's a url tag. The first argument of a url tag is the
named url it should insert there.  You give the tag 'display_data', but
there is no urlpattern in either of your urls with the name set to
'display_data'.

In your fusioncharts/urls.py, I would add this (completely untested):

from django.urls import path
from fusioncharts import views

urlpatterns = [
> path('home/', views.home, name=''),
>
   *path('display_data//', views.display_data,
name='display_data'), # <- Added here!*

> ]


Now we have a path with the same name that your template is looking for,
you have a view it sends the data to, and you capture the variable that
will be sent to the view.

Hope this helps!

-Jorge

-- 
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/CANfN%3DK9wy5WFN4TEb6gapvQAkqYqM8G0mXKwFAzB1TLz-EUbuA%40mail.gmail.com.


how to show blog posts according to categories and the list of categories in html template?

2020-05-20 Thread Ali Ahammad
0
1


i am trying to make site with django and want to categorize each post and a 
category list. in the category list every category name will be shown as a 
list and every category name will be linked to the posts according to their 
categories.

here is my *models.py*:

class Category(models.Model):
name=models.CharField(max_length=1000,null=True)
def __str__(self):
return self.nameclass Post(models.Model):
title=models.CharField(max_length=200,blank=True,null=True)

author=models.ForeignKey(get_user_model(),on_delete=models.CASCADE,null=True)
body=RichTextField(blank=True,null=True) 
image=models.FileField(upload_to="mediaphoto")

topImage=ImageSpecField(source='image',processors=[ResizeToFill(750,300)],format='PNG',options={'quality':60})
 
date=models.DateField(default=datetime.now, blank=True)
category = 
models.ForeignKey(Category,on_delete=models.CASCADE,verbose_name="Categories")  


def __str__(self):
return self.title
def get_absolute_url(self):
return reverse('post_detail',args={str(self.id)})

here is my *views.py*:
def Categorylist(request):
categories = Category.objects.all()
return render (request, 'category_list.html', {'categories'
: categories})
def CategoryDetail(request,pk):
category = get_object_or_404(Category, pk=pk)

return render(request, 'post_category.html', {'Category': category})

here is my *urls.py*:

urlpatterns = [

path('post//delete/',BlogappDeleteView.as_view(),name='post_delete'),
path('post//edit/',BlogappUpdateView.as_view(),name='post_edit'),
path('post/new/', BlogappCreateview.as_view(),name='post_new'),
path('post//',BlogappPostView.as_view(),name='post_detail'), 
path('post//category', views.CategoryDetail, name='category'),
path('search',views.Search,name='search'),
path('',BlogappListView.as_view(),name='home'),
]

here is *post_category.html*

  {{ category.name }} Category{% for c in category %}{{post.title}}
{{post.description|truncatechars:400|safe}}
Read More 


Posted on {{post.date|safe}} by
{{post.author}}in {{post.category}}
  {% endfor %}

here is *category_list.html*:

{% for c in categories %}
  {{c.name}}{% endfor %}

main problem is that category list is not fetching any list from the 
Category name and when click on the category in a post below, it is not 
showing the posts related to this category. the category page is showing 
the category name post like physics category.

i think i messed up with the views.py query or in templates... will you 
help me on this please? it will be very much appreciated.

-- 
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/dbd7715a-7cec-4d0f-9f57-ed6746a71185%40googlegroups.com.


Re: HOW TO PROTECT SOURCE CODE DEPLOYED TO A REMOTE SERVER

2020-05-20 Thread Sunday Iyanu Ajayi
Thank you so much. I really appreciate
*AJAYI Sunday *
(+234) 806 771 5394
*sunnexaj...@gmail.com *



On Wed, May 20, 2020 at 7:18 AM Derek  wrote:

> Yes - short answer is you cannot really "protect" Python code directly
> (see: https://python-compiler.com/post/how-to-distribute-python-program )
>
> Long answer - don't sell your code to anyone that you do not trust with
> it.  Obviously, there is a legal route, but there is also the "name and
> shame" option.  Sometimes open source is better; you get paid for your time
> to work on the code rather than trying to sell it as a product - which then
> you have to try and protect.  The open source option prevents the company
> from "selling" the code (well, they would look very silly if they tried to
> do that) and establishes you as the "go to" person for creating and
> maintaining that type of system. If they do make changes to the open source
> code, you'd get the benefit as well.
>
> In general, try and create partnerships with your clients so they want to
> include you in the development process, rather than treating each as other
> as competitors.
>
>
> On Tuesday, 19 May 2020 15:22:13 UTC+2, Andréas Kühne wrote:
>>
>> You can't really do that with Python - however - IF you want to go down
>> that route, you can just use the pyc files - you can theoretically
>> backwards compile them, but I think this is the most you can do
>>
>> Regards,
>>
>> Andréas
>>
>>
>> Den tis 19 maj 2020 kl 03:36 skrev Sunday Iyanu Ajayi > >:
>>
>>> I get your point but my solution is kind of a  SaaS Application. the
>>> client wants to host it on his controlled server  and if they get the
>>> source code, they can replicate, modify and maybe sell it.  Is there a way
>>> to host the compiled file or lock the directory to the project.
>>> *AJAYI Sunday *
>>> (+234) 806 771 5394
>>> *sunne...@gmail.com*
>>>
>>>
>>>
>>> On Mon, May 18, 2020 at 9:28 PM Jim Armstrong 
>>> wrote:
>>>
 When I work on client projects, I deploy to a test server that is under
 my control. Once the project is complete and they have paid the invoice, I
 deploy to the production server under their control. At that point, I don't
 care if they have access to the code - my contracts give the clients all
 rights to the project code upon completion of the project.


 On Friday, May 15, 2020 at 9:22:33 AM UTC-4, Sunday Iyanu Ajayi wrote:
>
> I am working for a client that wants to deploy a project I am working
> on in a remote server and I will like to project my source code when
> deployed so that they will not be able to mess with it.
>
> How can  I  go about it please?
>
> *AJAYI Sunday *
> (+234) 806 771 5394
> *sunne...@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...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/636f0636-30df-4ce2-8629-2be8b208ec37%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...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAKYSAw3Hqjuz5rD_AsZ5Wa%2B3WBzQ9LN0GzZKHx3D-irztJ1G0A%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/021a40fa-a755-4d77-addf-dfd112597dbc%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/CAKYSAw3iWZ-pRSaO0ehCU0uzppjTmTQcmMevJkcCAiOA9ecSMg%40mail.gmail.com.


Re: Getting the except django.core.exceptions.ImproperlyConfigured while querying DB

2020-05-20 Thread Hella Nick
此处有语法错误: path('display_data/', views.display_data, name=
'display_data'),
正确的写法为:path(r'^display_data//$', views.display_data, name=
'display_data/'),

请记住,一定要加 /

-- 
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/CAHfGPEe6TDiKM_p4W_%2BpsJtp3c3-yV5%3DtFouXXwKqoHORWqPng%40mail.gmail.com.


Re: Getting the except django.core.exceptions.ImproperlyConfigured while querying DB

2020-05-20 Thread Hella Nick
如果您确定数据库中有数据的话,那么就是您该视图的url设计错误。Django数据库查询的get方法查询不到数据会报错。希望可以帮助到您。

ratnadeep ray  于2020年5月20日周三 下午4:16写道:

> I am trying to fetch a few rows from the DB using the following code in my
> views.py:
>
> from django.http import HttpResponsefrom django.shortcuts import renderfrom 
> fusioncharts.models import QRC_DB
> def display_data(request,component):
> query_results = QRC_DB.objects.get(component_name__contains=component)
> return HttpResponse("You're looking at the component %s." % component)
>
> For the above, I am getting the following exception:
>
> django.core.exceptions.ImproperlyConfigured: The included URLconf 
> 'Piechart_Excel.urls' does not appear to have any patterns in it. If you see 
> valid patterns in the file then the issue is probably caused by a circular 
> import.
>
> However whenever I am *removing/commenting out* the below line, the above 
> exception disappears:
>
> query_results = QRC_DB.objects.get(component_name__contains=component)
>
>
> Can anyone say what can be going wrong here?
>
> urls.py file under app is as follows:
>
> from django.urls import path from fusioncharts import views urlpatterns 
> urlpatterns
>> = [
>> path('push-data/', views.push_data, name='push-data'),
>> path('home/', views.home, name='home'),
>> path('display_data/', views.display_data, name=
>> 'display_data'),
>> ]
>
> The url under the main project is as follows:
>
> from django.contrib import adminfrom django.urls import path,include
>>
>> urlpatterns urlpatterns = [
>> path('admin/', admin.site.urls),
>> path('', include('fusioncharts.urls'))
>> ]
>
> So please advise what's going wrong.
>
> --
> 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/0acc7888-9e25-43fd-8a50-64fe43086190%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/CAHfGPEd6_f3W7fCiS-aSvkC5X%2BbTNRiUFXFTV_qjECAZyfGrNQ%40mail.gmail.com.


Re: Can't Fix the No Reverse Error in Ajax

2020-05-20 Thread Hella Nick
是的,正确的写法为
  Like 

Motaz Hejaze  于2020年5月20日周三 下午2:06写道:

> Change your ajax method from "post" to "get" , you are not submitting any
> data to use post .
>
> Also change the method in your form too , and share the error message
> please.
>
> On Wed, 20 May 2020, 6:18 am Ahmed Khairy, 
> wrote:
>
>> Do you mean that this line should be changed?
>>
>> > 'post_id' class= "btn btn-danger btn-sm" value="{{post.id}}"
>> > No ! Don't Print it 
>>
>> On Tuesday, May 19, 2020 at 11:11:12 PM UTC-4, Hella Nick wrote:
>>>
>>> button标签中的type属性设置为button,
>>>
>>> Ahmed Khairy  于2020年5月20日周三 上午1:54写道:
>>>
 I am trying to use Ajax to submit a like button, I believe everything
 is in order but I keep getting django.urls.exceptions.NoReverseMatch:
 Reverse for 'like_post' with arguments '('',)' not found. 1 pattern(s)
 tried: ['score/like/(?P[0-9]+)$']


 I am not sure what is the reason. Need help to identify the error.


 Here is the view


 class PostDetailView(DetailView):
 model = Post
 template_name = "post_detail.html"

 def get_context_data(self, *args, **kwargs):
 context = super(PostDetailView, self).get_context_data()
 stuff = get_object_or_404(Post, id=self.kwargs['pk'])
 total_likes = stuff.total_likes()
 liked = False
 if stuff.likes.filter(id=self.request.user.id).exists():
 liked = True
 context["total_likes"] = total_likes
 context["liked"] = liked
 return context


 def LikeView(request, pk):
 # post = get_object_or_404(Post, id=request.POST.get('post_id'))
 post = get_object_or_404(Post, id=request.POST.get('id'))
 like = False
 if post.likes.filter(id=request.user.id).exists():
 post.likes.remove(request.user)
 like = False
 else:
 post.likes.add(request.user)
 like = True
 context["total_likes"] = total_likes
 context["liked"] = liked

 if request.is_ajax:
 html = render_to_string('like_section.html', context, request=
 request)
 return JsonResponse({'form': html})

 Here is the url.py updated

 urlpatterns = [
 path('user/', UserPostListView.as_view(), name=
 'user-posts'),
 path('', PostListView.as_view(), name='score'),
 path('who_we_Are/', who_we_are, name='who_we_are'),
 path('/', PostDetailView.as_view(), name='post-detail'),
 path('like/', LikeView, name='like_post'),
 path('new/', PostCreateView.as_view(), name='post-create'),
 path('/update/', PostUpdateView.as_view(), name=
 'post-update'),
 path('/delete/', PostDeleteView.as_view(), name=
 'post-delete')
 ]

 here is the template

 
 {% csrf_token %}
  Likes: {{total_likes}} 
 {% if user.is_authenticated %}
 {% if liked %}
 >>> 'post_id' class= "btn btn-danger btn-sm"
 value="{{post.id}}"> Unlike 
 {% else %}
 >>> 'post_id' class= "btn btn-primary btn-sm"
 value="{{post.id}}"> Like 
 {% endif  %}
 {% else %}
 >>> > Login to Like 
 {% endif %}
 

 here is the ajax

 https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js";>