Re: Adding a verbose_name to id field

2020-02-08 Thread Mike Dewhirst

On 9/02/2020 3:54 am, Bruckner de Villiers wrote:


Mike,

I tried id = model.AutoField(verbose_name=”Ticket #”).  Migrate didn’t 
like it – can’t have duplicate primaries.  I suspect this is because 
the Bug model already exists.


What I am trying to achieve is an auto-increment field whereby every 
time a user logs a bug/suggestion/comment it writes a unique ticket 
number in the background, which is used as a reference for subsequent 
actions like Fixed, Close, WiP, etc.  and as a ForeignKey in the 
Comment model.   I couldn’t find anything meaningful for this 
functionality and so thought that the ‘id’ is already fit for purpose, 
but merely requires an explanatory field text.




I think Jason is correct. The id field belongs to the DBMS and 
theoretically should never carry any human or real world meaning.


You would be better having an auto-incrementing field called "ticket" or 
similar


If you really must use the id field you can supply the model with your 
own id field (that's covered somewhere in the docs) with whatever name 
suits.


Cheers

Mike




Make sense?

Bruckner de Villiers

083 625 1086

*From: * on behalf of Mike Dewhirst 


*Reply to: *
*Date: *Saturday, 08 February 2020 at 13:48
*To: *
*Subject: *RE: Adding a verbose_name to id field

I imagine you need to specify the id field in your model and give it a 
verbose name.


This is an unusual requirement. Why do you want to do such a thing?

Mike

 Original message 

From: Bruckner de Villiers 

Date: 8/2/20 21:33 (GMT+10:00)

To: django-users@googlegroups.com

Subject: Adding a verbose_name to id field

Using Sqlite3 & Django 3.0.2 - I have searched high and low, but can’t 
find a way to add a verbose name to the id of a model.


Anyone have ideas, please?

Bruckner de Villiers

+27 83 625 1086

--
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/5e3e9fe6.1c69fb81.7cda5.a2fdSMTPIN_ADDED_MISSING%40gmr-mx.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/CA217C44-C4FE-4CE8-8479-97B9F05939BE%40gmail.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/2ad77dc8-e743-8241-7531-378bb7f717af%40dewhirst.com.au.


Re: is there a WYSIWYG for Django

2020-02-08 Thread john
Thanks - that was very helpful - but of course so were the personal 
suggestions.

Johnf

On 2/8/20 4:42 PM, Jason wrote:
Anytime you have a question of "is there something in django that will 
do X?", check out https://djangopackages.org/


For example, there is a pretty good up to date WYSIWYG category with 
possible options


https://djangopackages.org/grids/g/wysiwyg/

--
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/c8429460-83c6-4176-b917-d0bbf70981db%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/73c9d2da-66e2-a7e1-e611-208af72b8c0d%40jfcomputer.com.


Re: Adding a verbose_name to id field

2020-02-08 Thread Jason
Sounds to me you'd like a separate auto-increment field?

On Saturday, February 8, 2020 at 11:55:48 AM UTC-5, Bruckner de Villiers 
wrote:
>
> Mike,
>
> I tried id = model.AutoField(verbose_name=”Ticket #”).  Migrate didn’t 
> like it – can’t have duplicate primaries.  I suspect this is because the 
> Bug model already exists.
>
>  
>
> What I am trying to achieve is an auto-increment field whereby every time 
> a user logs a bug/suggestion/comment it writes a unique ticket number in 
> the background, which is used as a reference for subsequent actions like 
> Fixed, Close, WiP, etc.  and as a ForeignKey in the Comment model.   I 
> couldn’t find anything meaningful for this functionality and so thought 
> that the ‘id’ is already fit for purpose, but merely requires an 
> explanatory field text.
>
>  
>
> Make sense?
>
>  
>
> Bruckner de Villiers
>
> 083 625 1086
>
>  
>
> *From: *> on behalf of Mike 
> Dewhirst >
> *Reply to: *>
> *Date: *Saturday, 08 February 2020 at 13:48
> *To: *>
> *Subject: *RE: Adding a verbose_name to id field
>
>  
>
> I imagine you need to specify the id field in your model and give it a 
> verbose name. 
>
>  
>
> This is an unusual requirement. Why do you want to do such a thing?
>
>  
>
> Mike
>
>  
>
>  Original message 
>
> From: Bruckner de Villiers > 
>
> Date: 8/2/20 21:33 (GMT+10:00) 
>
> To: django...@googlegroups.com  
>
> Subject: Adding a verbose_name to id field 
>
>  
>
> Using Sqlite3 & Django 3.0.2 - I have searched high and low, but can’t 
> find a way to add a verbose name to the id of a model.
>
> Anyone have ideas, please?
>
>  
>
> Bruckner de Villiers
>
> +27 83 625 1086
>
> -- 
> 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/5e3e9fe6.1c69fb81.7cda5.a2fdSMTPIN_ADDED_MISSING%40gmr-mx.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/0627cb8d-c308-4ef0-85f9-14de135a2270%40googlegroups.com.


Re: is there a WYSIWYG for Django

2020-02-08 Thread Jason
Anytime you have a question of "is there something in django that will do 
X?", check out https://djangopackages.org/

For example, there is a pretty good up to date WYSIWYG category with 
possible options

https://djangopackages.org/grids/g/wysiwyg/

-- 
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/c8429460-83c6-4176-b917-d0bbf70981db%40googlegroups.com.


Re: Migrated code is not working in Django

2020-02-08 Thread Integr@te System
Hi Ram,

plz show error code.

On Sun, Feb 9, 2020, 01:03 Ram  wrote:

> Hi,
>
> I just noticed that the migrations table in Postgres is not updated though
> we reset all the previous migrations. Do I need to run any step in the
> database side whenever integrate new code drop? Unfortunately, we are not
> using the GIT method yet to bring over the new code.
>
> Best regards,
> ~Ram
>
> On Sat, Feb 8, 2020 at 10:22 AM Ram  wrote:
>
>> Hello DC,
>>
>> Thank you for your email. We have added code for user's registration
>> where users use
>>
>> 1. sign up form and submit the form
>> 2. upon submission users get a message about the next steps for
>> activating their registration
>>
>> Issue # 1 The issue here is users are not getting any activation email
>> Issue # 2 confirmation message is also incorrect. " *Your Registration
>> is successful! Please contact Admin for Emails validation Link* " I
>> searched for this message in all files and did not find it.
>>
>> Here are the code snippets
>>
>> # signup page
>>> #
>>> def signup_view(request):
>>>if request.method == 'POST':
>>>form = CustomerForm(request.POST)
>>>if form.is_valid():
>>>cust_item = form.cleaned_data
>>>print(cust_item)
>>>saveform = rim_customer(email=cust_item['email'],
>>>reemail=cust_item['reemail'],
>>>password=cust_item['password'],
>>>repassword=cust_item['repassword'],
>>> firstname=cust_item['firstname'],
>>>state=cust_item['state'],
>>>Zip=cust_item['Zip'],
>>>cust_status='0',
>>>mailing=cust_item['mailing'],
>>>referred_by=cust_item['referred_by'])
>>>saveform.save()
>>>
>>># Added the code for sending mail when a customer registered
>>> here EmailMessage is used from Django
>>>activate = ">> + "> Click Here"
>>>sendMailStaus =  EmailMessage('Registration Confirmation',
>>>  "Thank you for
>>> registering with us!. You Activation is pending. Please " + activate +
>>> "",
>>>  settings.EMAIL_HOST_USER,
>>>  [cust_item['email']])
>>>sendMailStaus.content_subtype="html"
>>>sendMailStaus.send()
>>>
>>>form = CustomerForm()
>>>return render(request, 'signup.html',{'form':form, 'success':
>>> 'mail succesfully send'})
>>>else:
>>>messages.error(request, form)
>>># return render(request,"form.html", {'error':error})
>>>else:
>>>form = CustomerForm()
>>>return render(request, "signup.html", {'form': form})
>>>
>>
>>
>>  # SiginUp_With_Transaction
>>> def Popup_signup_view(request):
>>> if request.method == 'POST':
>>> form = CustomerForm(request.POST)
>>> if form.is_valid():
>>> cust_item = form.cleaned_data
>>> saveform = rim_customer(email=cust_item['email'],
>>> reemail=cust_item['reemail'],
>>> password=cust_item['password'],
>>> repassword=cust_item['repassword'],
>>>
>>> firstname=cust_item['firstname'], state=cust_item['state'],
>>> Zip=cust_item['Zip'],
>>> mailing=cust_item['mailing'], cust_status='0',
>>>
>>> referred_by=cust_item['referred_by'])
>>> saveform.save()
>>> email = cust_item['email']
>>> # noinspection PyUnresolvedReferences
>>> sentMailStatus = sendEmail(email, request, saveform.id)
>>> form = CustomerForm()
>>> productid = request.POST['id']
>>> result = transation_Cast(productid, email)
>>>
>>> if sentMailStatus == True:
>>> return HttpResponseRedirect(result)
>>> else:
>>> return HttpResponseRedirect(result)
>>> else:
>>> messages.error(request, form)
>>> # return render(request,"form.html",{'error':error})
>>> else:
>>> form = CustomerForm()
>>> return render(request, "signup.html", {'form': form})
>>>
>>
>> Mail server settings in settings.py
>>
>> EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'  # added by
>>> me
>>> EMAIL_HOST = 'smtp.gmail.com'
>>> #EMAIL_PORT = 465
>>> EMAIL_USE_TLS = True
>>> #EMAIL_USE_SSL = True
>>> EMAIL_PORT = 587
>>> EMAIL_HOST_USER = 'ad...@domain.com'
>>> EMAIL_HOST_PASSWORD = 'domain@123456'
>>>
>>
>> Best regards,
>> ~Ram
>>
>>
>> On Fri, Feb 7, 2020 at 10:28 PM DC  wrote:
>>
>>> Hi ram,
>>>
>>> What’s is not working ? Like static files?

Re: open source advice needed

2020-02-08 Thread John McClain
Kimberly,

I would enjoy helping you with this journey.

Please get in touch

jmcclain0...@gmail.com

On Wed, 29 Jan 2020 at 00:18, Kimberly Regan  wrote:

> Hello,
> I have an idea that I pitched and placed 4th at the Harvard Zaentz Early
> Innovation Challenge. I've been implementing the model at my school for 20+
> years., The technology, a learning management system type program, will
> support the model to streamline procedures in classrooms toward effective
> and efficient student learning. I'm trying to find out what I need to do to
> find a developer, what language I use (meaning software specs), and how
> many people/hours would it take to develop it. I have a doctorate in
> education, but a newbie in technology development. A friend recommended I
> post a question to this site. Any ideas out there? 
> Thanks so much!
> Kimberly
>
> --
> 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/540e150c-535b-45dd-a56e-345352bba167%40googlegroups.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_qPS7Di00Nnq31-Av8u4F5a%3DZEENrV4JGe6Cv6UUspNwg%40mail.gmail.com.


is there a WYSIWYG for Django

2020-02-08 Thread Desmond Nyamador
Hi I suggest you try out Django summernote. Easy to setup for your admin and 
frontend 

-- 
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/e5028222-8a6b-41a9-a547-b686ea1b513b%40googlegroups.com.


Re: Régrouper les lover de PYTHON

2020-02-08 Thread KONE GOMPOU LOUA ALASSANE
De quel module s’agit-il?

Le sam. 8 févr. 2020 à 14:45, SORO MOISE  a écrit :

> SALUT JE VIENT DE DECOUVRIRE CE MODULE DE PYTHON ET JE VOUDRAIS SAVOIR
> PLUS SUR CE QU'ON PEUT FAIRE AVEC.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this  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/d45e7c23-8754-407f-a47d-feb779144dd0%40googlegroups.com
> 
> .
>
-- 
*La meilleure façon de prédire l’avenir est de le créer. *

-- 
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/CANoHCstPoay1gAVB9gBG30GNGCqfYmcAgCb0tCzW3mWBtPg2AQ%40mail.gmail.com.


Re: Migrated code is not working in Django

2020-02-08 Thread Ram
Hi,

I just noticed that the migrations table in Postgres is not updated though
we reset all the previous migrations. Do I need to run any step in the
database side whenever integrate new code drop? Unfortunately, we are not
using the GIT method yet to bring over the new code.

Best regards,
~Ram

On Sat, Feb 8, 2020 at 10:22 AM Ram  wrote:

> Hello DC,
>
> Thank you for your email. We have added code for user's registration where
> users use
>
> 1. sign up form and submit the form
> 2. upon submission users get a message about the next steps for activating
> their registration
>
> Issue # 1 The issue here is users are not getting any activation email
> Issue # 2 confirmation message is also incorrect. " *Your Registration is
> successful! Please contact Admin for Emails validation Link* " I searched
> for this message in all files and did not find it.
>
> Here are the code snippets
>
> # signup page
>> #
>> def signup_view(request):
>>if request.method == 'POST':
>>form = CustomerForm(request.POST)
>>if form.is_valid():
>>cust_item = form.cleaned_data
>>print(cust_item)
>>saveform = rim_customer(email=cust_item['email'],
>>reemail=cust_item['reemail'],
>>password=cust_item['password'],
>>repassword=cust_item['repassword'],
>> firstname=cust_item['firstname'],
>>state=cust_item['state'],
>>Zip=cust_item['Zip'],
>>cust_status='0',
>>mailing=cust_item['mailing'],
>>referred_by=cust_item['referred_by'])
>>saveform.save()
>>
>># Added the code for sending mail when a customer registered
>> here EmailMessage is used from Django
>>activate = "> + "> Click Here"
>>sendMailStaus =  EmailMessage('Registration Confirmation',
>>  "Thank you for registering
>> with us!. You Activation is pending. Please " + activate + "",
>>  settings.EMAIL_HOST_USER,
>>  [cust_item['email']])
>>sendMailStaus.content_subtype="html"
>>sendMailStaus.send()
>>
>>form = CustomerForm()
>>return render(request, 'signup.html',{'form':form, 'success':
>> 'mail succesfully send'})
>>else:
>>messages.error(request, form)
>># return render(request,"form.html", {'error':error})
>>else:
>>form = CustomerForm()
>>return render(request, "signup.html", {'form': form})
>>
>
>
>  # SiginUp_With_Transaction
>> def Popup_signup_view(request):
>> if request.method == 'POST':
>> form = CustomerForm(request.POST)
>> if form.is_valid():
>> cust_item = form.cleaned_data
>> saveform = rim_customer(email=cust_item['email'],
>> reemail=cust_item['reemail'],
>> password=cust_item['password'],
>> repassword=cust_item['repassword'],
>> firstname=cust_item['firstname'],
>> state=cust_item['state'],
>> Zip=cust_item['Zip'],
>> mailing=cust_item['mailing'], cust_status='0',
>>
>> referred_by=cust_item['referred_by'])
>> saveform.save()
>> email = cust_item['email']
>> # noinspection PyUnresolvedReferences
>> sentMailStatus = sendEmail(email, request, saveform.id)
>> form = CustomerForm()
>> productid = request.POST['id']
>> result = transation_Cast(productid, email)
>>
>> if sentMailStatus == True:
>> return HttpResponseRedirect(result)
>> else:
>> return HttpResponseRedirect(result)
>> else:
>> messages.error(request, form)
>> # return render(request,"form.html",{'error':error})
>> else:
>> form = CustomerForm()
>> return render(request, "signup.html", {'form': form})
>>
>
> Mail server settings in settings.py
>
> EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'  # added by
>> me
>> EMAIL_HOST = 'smtp.gmail.com'
>> #EMAIL_PORT = 465
>> EMAIL_USE_TLS = True
>> #EMAIL_USE_SSL = True
>> EMAIL_PORT = 587
>> EMAIL_HOST_USER = 'ad...@domain.com'
>> EMAIL_HOST_PASSWORD = 'domain@123456'
>>
>
> Best regards,
> ~Ram
>
>
> On Fri, Feb 7, 2020 at 10:28 PM DC  wrote:
>
>> Hi ram,
>>
>> What’s is not working ? Like static files?
>> Could you share what error you are facing?
>>
>> Regards, d
>>
>> On Sat, 8 Feb 2020 at 1:25 PM, Ram  wrote:
>>
>>> Hi,
>>>
>>> When we have new code drop from 

Re: Migrated code is not working in Django

2020-02-08 Thread Ram
Hello DC,

Thank you for your email. We have added code for user's registration where
users use

1. sign up form and submit the form
2. upon submission users get a message about the next steps for activating
their registration

Issue # 1 The issue here is users are not getting any activation email
Issue # 2 confirmation message is also incorrect. " *Your Registration is
successful! Please contact Admin for Emails validation Link* " I searched
for this message in all files and did not find it.

Here are the code snippets

# signup page
> #
> def signup_view(request):
>if request.method == 'POST':
>form = CustomerForm(request.POST)
>if form.is_valid():
>cust_item = form.cleaned_data
>print(cust_item)
>saveform = rim_customer(email=cust_item['email'],
>reemail=cust_item['reemail'],
>password=cust_item['password'],
>repassword=cust_item['repassword'],
> firstname=cust_item['firstname'],
>state=cust_item['state'],
>Zip=cust_item['Zip'],
>cust_status='0',
>mailing=cust_item['mailing'],
>referred_by=cust_item['referred_by'])
>saveform.save()
>
># Added the code for sending mail when a customer registered
> here EmailMessage is used from Django
>activate = " + "> Click Here"
>sendMailStaus =  EmailMessage('Registration Confirmation',
>  "Thank you for registering
> with us!. You Activation is pending. Please " + activate + "",
>  settings.EMAIL_HOST_USER,
>  [cust_item['email']])
>sendMailStaus.content_subtype="html"
>sendMailStaus.send()
>
>form = CustomerForm()
>return render(request, 'signup.html',{'form':form, 'success':
> 'mail succesfully send'})
>else:
>messages.error(request, form)
># return render(request,"form.html", {'error':error})
>else:
>form = CustomerForm()
>return render(request, "signup.html", {'form': form})
>


 # SiginUp_With_Transaction
> def Popup_signup_view(request):
> if request.method == 'POST':
> form = CustomerForm(request.POST)
> if form.is_valid():
> cust_item = form.cleaned_data
> saveform = rim_customer(email=cust_item['email'],
> reemail=cust_item['reemail'],
> password=cust_item['password'],
> repassword=cust_item['repassword'],
> firstname=cust_item['firstname'],
> state=cust_item['state'],
> Zip=cust_item['Zip'],
> mailing=cust_item['mailing'], cust_status='0',
>
> referred_by=cust_item['referred_by'])
> saveform.save()
> email = cust_item['email']
> # noinspection PyUnresolvedReferences
> sentMailStatus = sendEmail(email, request, saveform.id)
> form = CustomerForm()
> productid = request.POST['id']
> result = transation_Cast(productid, email)
>
> if sentMailStatus == True:
> return HttpResponseRedirect(result)
> else:
> return HttpResponseRedirect(result)
> else:
> messages.error(request, form)
> # return render(request,"form.html",{'error':error})
> else:
> form = CustomerForm()
> return render(request, "signup.html", {'form': form})
>

Mail server settings in settings.py

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'  # added by me
> EMAIL_HOST = 'smtp.gmail.com'
> #EMAIL_PORT = 465
> EMAIL_USE_TLS = True
> #EMAIL_USE_SSL = True
> EMAIL_PORT = 587
> EMAIL_HOST_USER = 'ad...@domain.com'
> EMAIL_HOST_PASSWORD = 'domain@123456'
>

Best regards,
~Ram


On Fri, Feb 7, 2020 at 10:28 PM DC  wrote:

> Hi ram,
>
> What’s is not working ? Like static files?
> Could you share what error you are facing?
>
> Regards, d
>
> On Sat, 8 Feb 2020 at 1:25 PM, Ram  wrote:
>
>> Hi,
>>
>> When we have new code drop from development, we copy the files manually
>> to the hosting server running in Digital Ocean droplet. Then we run these
>> two commands
>>
>> 1. makemigrations
>> 2. migrate
>>
>> in the python virtual environment.
>>
>> Both the commands completed find but, we are not able to use the new
>> integration in our web site. We did not touch the database (postgres) side
>> hoping that models.py would take care of migration on the database side.
>>
>> Please advise what would be missing from my side?
>>

Re: is there a WYSIWYG for Django

2020-02-08 Thread Bill Freeman
That's the plan.  It's what I though you meant by WYSIWYG.  Fiber is nice
because they don't have to understand a back end interface; you just edit
from the page that you want to change, edit a particular element of it,
which client's have an easier time with.  But there still has to be
something that lets you edit HTML straightforwardly, and that needs to run
in the browser for responsiveness.

On Sat, Feb 8, 2020 at 11:52 AM johnf  wrote:

> Thanks Fiber looks better.  But you did say you use mostly TinyMCE.  I can
> develop the site (it's just as straight forward with some pictures, menu
> and a few pages) then hand that over to the owners to maintain using
> TinyMCE??  What about mobile etc...?
>
> Johnf
>
> On 2/8/20 8:36 AM, Bill Freeman wrote:
>
> I have used Django Fiber:   http://ridethepony.org/
> And several other CMS.  I mostly used TinyMCE.
> The world may have moved on.
>
> On Sat, Feb 8, 2020 at 11:02 AM johnf  wrote:
>
>> Thanks that is a start.  I would also like something that will help with
>> design of the pages/views.
>>
>> Johnf
>>
>> On 2/8/20 7:51 AM, Andrew C. wrote:
>>
>> Try Quill.js. If you google Quill.js and Quill.js Django, I believe
>> you'll find the Django package that goes along with that text editor.
>> Really, you only need the Quill.js code for your template. WYSIWYG is
>> just a user typing in HTML without realizing it. Just save the HTML
>> (because the rest is escaped while the user is typing).
>>
>> It's also useful if you escape all instances of a script tag in case
>> someone inputs an unescaped . Your server wouldn't be
>> destroyed necessarily, but there could be some XSS that you want to
>> avoid.
>>
>> On 2/8/20, john   wrote:
>>
>> Hi,
>>
>> I realize that Django does not have a frontend but is there a
>> tool/package that works well for WYSIWYG a simple website?
>>
>> Johnf
>>
>> --
>> 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 
>> visithttps://groups.google.com/d/msgid/django-users/da5f5c36-0bca-4a47-d91d-5c67b657c7a5%40jfcomputer.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/2cdcf4aa-07db-446e-8597-585b5c571639%40gmail.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/CAB%2BAj0tdqykbk5YyXkx_Axo-3MuyM%3DS_86qJWpzXan%2B-whfNfg%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/d194dd78-88e0-eb32-f2bf-035c6a740e1a%40gmail.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/CAB%2BAj0sUwL5Opor_JWf1rFMuPGwDSHEFAPc2vRfEwCxPtY0czA%40mail.gmail.com.


Re: Adding a verbose_name to id field

2020-02-08 Thread Bruckner de Villiers
Mike,

I tried id = model.AutoField(verbose_name=”Ticket #”).  Migrate didn’t like it 
– can’t have duplicate primaries.  I suspect this is because the Bug model 
already exists.

 

What I am trying to achieve is an auto-increment field whereby every time a 
user logs a bug/suggestion/comment it writes a unique ticket number in the 
background, which is used as a reference for subsequent actions like Fixed, 
Close, WiP, etc.  and as a ForeignKey in the Comment model.   I couldn’t find 
anything meaningful for this functionality and so thought that the ‘id’ is 
already fit for purpose, but merely requires an explanatory field text.

 

Make sense?

 

Bruckner de Villiers

083 625 1086

 

From:  on behalf of Mike Dewhirst 

Reply to: 
Date: Saturday, 08 February 2020 at 13:48
To: 
Subject: RE: Adding a verbose_name to id field

 

I imagine you need to specify the id field in your model and give it a verbose 
name. 

 

This is an unusual requirement. Why do you want to do such a thing?

 

Mike

 

 Original message 

From: Bruckner de Villiers  

Date: 8/2/20 21:33 (GMT+10:00) 

To: django-users@googlegroups.com 

Subject: Adding a verbose_name to id field 

 

Using Sqlite3 & Django 3.0.2 - I have searched high and low, but can’t find a 
way to add a verbose name to the id of a model.

Anyone have ideas, please?

 

Bruckner de Villiers

+27 83 625 1086

-- 
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/5e3e9fe6.1c69fb81.7cda5.a2fdSMTPIN_ADDED_MISSING%40gmr-mx.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/CA217C44-C4FE-4CE8-8479-97B9F05939BE%40gmail.com.


Re: is there a WYSIWYG for Django

2020-02-08 Thread johnf
Thanks Fiber looks better.  But you did say you use mostly TinyMCE.  I 
can develop the site (it's just as straight forward with some pictures, 
menu and a few pages) then hand that over to the owners to maintain 
using TinyMCE??  What about mobile etc...?


Johnf

On 2/8/20 8:36 AM, Bill Freeman wrote:

I have used Django Fiber: http://ridethepony.org/
And several other CMS.  I mostly used TinyMCE.
The world may have moved on.

On Sat, Feb 8, 2020 at 11:02 AM johnf > wrote:


Thanks that is a start.  I would also like something that will
help with design of the pages/views.

Johnf

On 2/8/20 7:51 AM, Andrew C. wrote:

Try Quill.js. If you google Quill.js and Quill.js Django, I believe
you'll find the Django package that goes along with that text editor.
Really, you only need the Quill.js code for your template. WYSIWYG is
just a user typing in HTML without realizing it. Just save the HTML
(because the rest is escaped while the user is typing).

It's also useful if you escape all instances of a script tag in case
someone inputs an unescaped . Your server wouldn't be
destroyed necessarily, but there could be some XSS that you want to
avoid.

On 2/8/20, john    wrote:

Hi,

I realize that Django does not have a frontend but is there a
tool/package that works well for WYSIWYG a simple website?

Johnf

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

https://groups.google.com/d/msgid/django-users/da5f5c36-0bca-4a47-d91d-5c67b657c7a5%40jfcomputer.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/2cdcf4aa-07db-446e-8597-585b5c571639%40gmail.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/CAB%2BAj0tdqykbk5YyXkx_Axo-3MuyM%3DS_86qJWpzXan%2B-whfNfg%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/d194dd78-88e0-eb32-f2bf-035c6a740e1a%40gmail.com.


Front end solution to run SQL query in django

2020-02-08 Thread oliseh obiajuru
I am trying to create a query builder, I have seen SQL explore which is a 
package but I can't bring it to the front end of my app. I need help please

-- 
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/d97e5f9d-78ea-49c8-809c-c88d4001346c%40googlegroups.com.


Re: is there a WYSIWYG for Django

2020-02-08 Thread Bill Freeman
I have used Django Fiber:   http://ridethepony.org/
And several other CMS.  I mostly used TinyMCE.
The world may have moved on.

On Sat, Feb 8, 2020 at 11:02 AM johnf  wrote:

> Thanks that is a start.  I would also like something that will help with
> design of the pages/views.
>
> Johnf
>
> On 2/8/20 7:51 AM, Andrew C. wrote:
>
> Try Quill.js. If you google Quill.js and Quill.js Django, I believe
> you'll find the Django package that goes along with that text editor.
> Really, you only need the Quill.js code for your template. WYSIWYG is
> just a user typing in HTML without realizing it. Just save the HTML
> (because the rest is escaped while the user is typing).
>
> It's also useful if you escape all instances of a script tag in case
> someone inputs an unescaped . Your server wouldn't be
> destroyed necessarily, but there could be some XSS that you want to
> avoid.
>
> On 2/8/20, john   wrote:
>
> Hi,
>
> I realize that Django does not have a frontend but is there a
> tool/package that works well for WYSIWYG a simple website?
>
> Johnf
>
> --
> 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 
> visithttps://groups.google.com/d/msgid/django-users/da5f5c36-0bca-4a47-d91d-5c67b657c7a5%40jfcomputer.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/2cdcf4aa-07db-446e-8597-585b5c571639%40gmail.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/CAB%2BAj0tdqykbk5YyXkx_Axo-3MuyM%3DS_86qJWpzXan%2B-whfNfg%40mail.gmail.com.


Re: is there a WYSIWYG for Django

2020-02-08 Thread johnf
Thanks that is a start.  I would also like something that will help with 
design of the pages/views.


Johnf

On 2/8/20 7:51 AM, Andrew C. wrote:

Try Quill.js. If you google Quill.js and Quill.js Django, I believe
you'll find the Django package that goes along with that text editor.
Really, you only need the Quill.js code for your template. WYSIWYG is
just a user typing in HTML without realizing it. Just save the HTML
(because the rest is escaped while the user is typing).

It's also useful if you escape all instances of a script tag in case
someone inputs an unescaped . Your server wouldn't be
destroyed necessarily, but there could be some XSS that you want to
avoid.

On 2/8/20, john  wrote:

Hi,

I realize that Django does not have a frontend but is there a
tool/package that works well for WYSIWYG a simple website?

Johnf

--
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/da5f5c36-0bca-4a47-d91d-5c67b657c7a5%40jfcomputer.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/2cdcf4aa-07db-446e-8597-585b5c571639%40gmail.com.


Re: is there a WYSIWYG for Django

2020-02-08 Thread Andrew C.
Try Quill.js. If you google Quill.js and Quill.js Django, I believe
you'll find the Django package that goes along with that text editor.
Really, you only need the Quill.js code for your template. WYSIWYG is
just a user typing in HTML without realizing it. Just save the HTML
(because the rest is escaped while the user is typing).

It's also useful if you escape all instances of a script tag in case
someone inputs an unescaped . Your server wouldn't be
destroyed necessarily, but there could be some XSS that you want to
avoid.

On 2/8/20, john  wrote:
> Hi,
>
> I realize that Django does not have a frontend but is there a
> tool/package that works well for WYSIWYG a simple website?
>
> Johnf
>
> --
> 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/da5f5c36-0bca-4a47-d91d-5c67b657c7a5%40jfcomputer.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/CAJVmkNnMhBbrjG-stwWor91zRKJyhXL9PfSds7CiPYV-E4hEvA%40mail.gmail.com.


is there a WYSIWYG for Django

2020-02-08 Thread john

Hi,

I realize that Django does not have a frontend but is there a 
tool/package that works well for WYSIWYG a simple website?


Johnf

--
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/da5f5c36-0bca-4a47-d91d-5c67b657c7a5%40jfcomputer.com.


Re: Using celery in django for making orders and payments

2020-02-08 Thread Kasper Laudrup

Hi Bhumika,

On 08/02/2020 15.38, Bhumika shrestha wrote:
im having trouble in using celery in django for making orders and 
payments can you guys help me with that




That's really hard to tell since you don't explain which kind of 
troubles you are facing, but if you provide some details, I'm sure 
someone will at least to try help you out.


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/e7aa41c7-24ac-10bd-94e7-00d5f6756bc5%40stacktrace.dk.


Re: Contractions in Django 3.0 and Django 2.2

2020-02-08 Thread אורי
For example in this case:

if (django.VERSION >= (3, 0)):
...
else:
...
אורי
u...@speedy.net


On Sat, Feb 8, 2020 at 3:48 PM One Above All <
the.one.above.all.ti...@gmail.com> wrote:

> i am working on a project which is adding support for Django 3.0. While
> doing so, I came across ticket # 30400
> https://code.djangoproject.com/ticket/30400 after which contractions were
> rewritten. I am writing a test which should work with both Django 3.0 and
> 2.2. I have to assert error_messages
> in django.contrib.auth.forms.SetPasswordForm like below
>
> self.assertIn("The two password fields didn’t match.",
>> str(response.data['new_password2']))
>
>
> How can I make this work in both versions of Django ?
>
> Thanks and Regards,
> Gagan Deep
>
> --
> 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/18f30e79-1c67-46b6-9482-d6f18a109887%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/CABD5YeECcxfDMWZ8tdwCUebQZz%2BWN--Os28Ce7pHg7SdCfrxNg%40mail.gmail.com.


Re: Contractions in Django 3.0 and Django 2.2

2020-02-08 Thread אורי
You can check which Django version is used and assert accordingly.

https://stackoverflow.com/a/6468505/1412564
אורי
u...@speedy.net


On Sat, Feb 8, 2020 at 3:48 PM One Above All <
the.one.above.all.ti...@gmail.com> wrote:

> i am working on a project which is adding support for Django 3.0. While
> doing so, I came across ticket # 30400
> https://code.djangoproject.com/ticket/30400 after which contractions were
> rewritten. I am writing a test which should work with both Django 3.0 and
> 2.2. I have to assert error_messages
> in django.contrib.auth.forms.SetPasswordForm like below
>
> self.assertIn("The two password fields didn’t match.",
>> str(response.data['new_password2']))
>
>
> How can I make this work in both versions of Django ?
>
> Thanks and Regards,
> Gagan Deep
>
> --
> 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/18f30e79-1c67-46b6-9482-d6f18a109887%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/CABD5YeEBDm5-qmAhZWtSv6kx83EwNimhK0mfrVFtPm%3D7Y7dd4g%40mail.gmail.com.


Régrouper les lover de PYTHON

2020-02-08 Thread SORO MOISE
SALUT JE VIENT DE DECOUVRIRE CE MODULE DE PYTHON ET JE VOUDRAIS SAVOIR PLUS 
SUR CE QU'ON PEUT FAIRE AVEC.

-- 
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/d45e7c23-8754-407f-a47d-feb779144dd0%40googlegroups.com.


Re: Trie Data Structure

2020-02-08 Thread Soumen Khatua
Sorry.
But I don't have any mail in my inbox from your side.

Thank you



On Sat 8 Feb, 2020, 5:49 PM onlinejudge95,  wrote:

> I am ready to answer your question, but not here it's a Django User's
> Group. The question you are asking is about implementation of an algorithm
> which is language agnostic. Technically, it shouldn't be asked in the
> Python Mailing list too.
>
> Keep a watch on your inbox though. :)
>
> Thanks,
> onlinejudge95
>
> On Sat, Feb 8, 2020, 3:06 PM Soumen Khatua 
> wrote:
>
>> from collections import defaultdict
>>
>>
>> class TrieNode():
>>
>> def __init__(self):
>> self.children = defaultdict()
>> self.terminating = False
>>
>>
>> class Trie():
>>
>> def __init__(self):
>> self.root = self.get_node()
>>
>> def get_node(self):
>> return TrieNode()
>>
>> def get_index(self, ch):
>> return ord(ch) - ord('a')
>>
>> def insert(self, word):
>>
>> root = self.root
>> len1 = len(word)
>>
>> for i in range(len1):
>> index = self.get_index(word[i])
>>
>> if index not in root.children:
>> root.children[index] = self.get_node()
>> root = root.children.get(index)
>>
>> root.terminating = True
>>
>> def search(self, word):
>> root = self.root
>> len1 = len(word)
>>
>> for i in range(len1):
>> index = self.get_index(word[i])
>> if not root:
>> return False
>> root = root.children.get(index)
>>
>> return True if root and root.terminating else False
>>
>> def delete(self, word):
>>
>> root = self.root
>> len1 = len(word)
>>
>> for i in range(len1):
>> index = self.get_index(word[i])
>>
>> if not root:
>> print ("Word not found")
>> return -1
>> root = root.children.get(index)
>>
>> if not root:
>> print ("Word not found")
>> return -1
>> else:
>> root.terminating = False
>> return 0
>>
>> def update(self, old_word, new_word):
>> val = self.delete(old_word)
>> if val == 0:
>> self.insert(new_word)
>>
>>
>>
>> if __name__ == "__main__":
>>
>> strings = ["pqrs", "pprt", "psst", "qqrs", "pqrs"]
>>
>> t = Trie()
>> for word in strings:
>> t.insert(word)
>>
>>
>> Could anyone tell me,How Inset function is working here? actually I'm not
>> able to track it. Specially if index is alerady available in root.children
>> then how it is creating an another TrieNode object.
>>
>> 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/CAPUw6WbzxcxyzwKynS9vnZe5cwem2bT8bjLZS%2BO9C%2BfyV6V6MA%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/CAD%3DM5eTHoFBbwPiMphieWSB8pemHM0Tzs_r1CjfjdPVB0NWCaw%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/CAPUw6WbHfPfj9_YR_sVDUB%2BWZdxPgjUYbL7TJmR11BjYe%3DpkmA%40mail.gmail.com.


Re: Getting this error with running django server

2020-02-08 Thread Kasper Laudrup

Hi "python stories"

On 08/02/2020 10.43, python stories wrote:

   File "C:\Users\user\PycharmProjects\pyshop\pyshop\urls.py", line 17
     from django.urls import path path, include
                                  ^
SyntaxError: invalid syntax


Can anyone help me out. Many thanks!



The error clearly indicates what is wrong. You have a syntax error 
because you don't use the correct syntax for importing modules. This was 
the best help I could find:


https://www.tutorialspoint.com/How-to-use-multiple-modules-with-Python-import-Statement

This is extremely basic Python knowledge. I suggest you start out by 
learning some basic python before diving into Django. Otherwise you'll 
spent a lot of time dealing with very basic mistakes like this.


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/403285e2-8f41-b3a0-2fca-4e32b3cd9739%40stacktrace.dk.


Using celery in django for making orders and payments

2020-02-08 Thread Bhumika shrestha
im having trouble in using celery in django for making orders and payments 
can you guys help me with that

-- 
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/84a6708e-8d9c-437d-a8d8-762bb1a80236%40googlegroups.com.


Getting this error with running django server

2020-02-08 Thread python stories
C:\Users\user\PycharmProjects\pyshop>py manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "C:\Python38\lib\threading.py", line 932, in _bootstrap_inner
self.run()
  File "C:\Python38\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
  File "C:\Python38\lib\site-packages\django\utils\autoreload.py", line 53, 
in wrapper
fn(*args, **kwargs)
  File 
"C:\Python38\lib\site-packages\django\core\management\commands\runserver.py", 
line 11
7, in inner_run
self.check(display_num_errors=True)
  File "C:\Python38\lib\site-packages\django\core\management\base.py", line 
392, in check
all_issues = self._run_checks(
  File "C:\Python38\lib\site-packages\django\core\management\base.py", line 
382, in _run_che
cks
return checks.run_checks(**kwargs)
  File "C:\Python38\lib\site-packages\django\core\checks\registry.py", line 
72, in run_check
s
new_errors = check(app_configs=app_configs)
  File "C:\Python38\lib\site-packages\django\core\checks\urls.py", line 13, 
in check_url_con
fig
return check_resolver(resolver)
  File "C:\Python38\lib\site-packages\django\core\checks\urls.py", line 23, 
in check_resolve
r
return check_method()
  File "C:\Python38\lib\site-packages\django\urls\resolvers.py", line 407, 
in check
for pattern in self.url_patterns:
  File "C:\Python38\lib\site-packages\django\utils\functional.py", line 48, 
in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Python38\lib\site-packages\django\urls\resolvers.py", line 588, 
in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", 
self.urlconf_module)
  File "C:\Python38\lib\site-packages\django\utils\functional.py", line 48, 
in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Python38\lib\site-packages\django\urls\resolvers.py", line 581, 
in urlconf_module

return import_module(self.urlconf_name)
  File "C:\Python38\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 1014, in _gcd_import
  File "", line 991, in _find_and_load
  File "", line 975, in _find_and_load_unlocked
  File "", line 671, in _load_unlocked
  File "", line 779, in exec_module
  File "", line 916, in get_code
  File "", line 846, in source_to_code
  File "", line 219, in 
_call_with_frames_removed
  File "C:\Users\user\PycharmProjects\pyshop\pyshop\urls.py", line 17
from django.urls import path path, include
 ^
SyntaxError: invalid syntax


Can anyone help me out. Many 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/352f7ed4-12f7-4d14-8813-a416a53c7130%40googlegroups.com.


Re: Python Django Training

2020-02-08 Thread Hector Gonzalez
Iam interest!!! Take my email
El 2 feb. 2020 12:33 PM, "V S V Narsimha Murthy" 
escribió:

> Hi Everyone,
>
> I am interested to attend the python and Django training. Please add my
> email as well for the training classes.
>
> Thanks in advance.
>
> Regards,
> Narasimha Murthy
>
> On Sun, Feb 2, 2020 at 9:25 PM Maqdum Adewale  wrote:
>
>> I'm interested
>>
>> On Sun, Feb 2, 2020, 3:44 PM yerri swamy 
>> wrote:
>>
>>> I am also intrested..
>>>
>>> On Sat, Feb 1, 2020, 7:12 PM Srikanth K  wrote:
>>>
 Hi,

 I am from Hyderabad. I am Python Developer by Profession. I am eager
 take up any Python , Django Training (online Preferrable or Weekends).
 Members who require can contact me or share me  there idea.

 Regards,
 Srikanth.K

 --
 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/CACPyz-gXb7wo9E0Uhs_pnxF9X52uA10__
 Fq1xt4trjXUaN3ehQ%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/CAKMSwL9eDJMGh6Jc20fureSvx%
>>> 3DeZrDPtbWFhcjTKEzU4rQbHXA%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/CA%2B48qrFGwBVGhdpPyCSqN_6GdjiDAj%3DSp-
>> 4CF74YWN7eZgOfwA%40mail.gmail.com
>> 
>> .
>>
>
>
> --
> Thanks
> Narasimha Murthy
>
> --
> 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/CAE%3D5Kz4OwOG3kVy48NWtWDXQYrtgCy5
> jB%2BY9jfUu2%3DJ_6g8tzA%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/CA%2BT_vrB9b99-RfA%2BP0O3DQ_FNdZw0Z2Sv3xuW8YNPnxA6cr2Cw%40mail.gmail.com.


Contractions in Django 3.0 and Django 2.2

2020-02-08 Thread One Above All
i am working on a project which is adding support for Django 3.0. While 
doing so, I came across ticket # 30400 
https://code.djangoproject.com/ticket/30400 after which contractions were 
rewritten. I am writing a test which should work with both Django 3.0 and 
2.2. I have to assert error_messages 
in django.contrib.auth.forms.SetPasswordForm like below

self.assertIn("The two password fields didn’t match.", 
> str(response.data['new_password2']))


How can I make this work in both versions of Django ?

Thanks and Regards,
Gagan Deep 

-- 
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/18f30e79-1c67-46b6-9482-d6f18a109887%40googlegroups.com.


Re: Trie Data Structure

2020-02-08 Thread onlinejudge95
I am ready to answer your question, but not here it's a Django User's
Group. The question you are asking is about implementation of an algorithm
which is language agnostic. Technically, it shouldn't be asked in the
Python Mailing list too.

Keep a watch on your inbox though. :)

Thanks,
onlinejudge95

On Sat, Feb 8, 2020, 3:06 PM Soumen Khatua 
wrote:

> from collections import defaultdict
>
>
> class TrieNode():
>
> def __init__(self):
> self.children = defaultdict()
> self.terminating = False
>
>
> class Trie():
>
> def __init__(self):
> self.root = self.get_node()
>
> def get_node(self):
> return TrieNode()
>
> def get_index(self, ch):
> return ord(ch) - ord('a')
>
> def insert(self, word):
>
> root = self.root
> len1 = len(word)
>
> for i in range(len1):
> index = self.get_index(word[i])
>
> if index not in root.children:
> root.children[index] = self.get_node()
> root = root.children.get(index)
>
> root.terminating = True
>
> def search(self, word):
> root = self.root
> len1 = len(word)
>
> for i in range(len1):
> index = self.get_index(word[i])
> if not root:
> return False
> root = root.children.get(index)
>
> return True if root and root.terminating else False
>
> def delete(self, word):
>
> root = self.root
> len1 = len(word)
>
> for i in range(len1):
> index = self.get_index(word[i])
>
> if not root:
> print ("Word not found")
> return -1
> root = root.children.get(index)
>
> if not root:
> print ("Word not found")
> return -1
> else:
> root.terminating = False
> return 0
>
> def update(self, old_word, new_word):
> val = self.delete(old_word)
> if val == 0:
> self.insert(new_word)
>
>
>
> if __name__ == "__main__":
>
> strings = ["pqrs", "pprt", "psst", "qqrs", "pqrs"]
>
> t = Trie()
> for word in strings:
> t.insert(word)
>
>
> Could anyone tell me,How Inset function is working here? actually I'm not
> able to track it. Specially if index is alerady available in root.children
> then how it is creating an another TrieNode object.
>
> 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/CAPUw6WbzxcxyzwKynS9vnZe5cwem2bT8bjLZS%2BO9C%2BfyV6V6MA%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/CAD%3DM5eTHoFBbwPiMphieWSB8pemHM0Tzs_r1CjfjdPVB0NWCaw%40mail.gmail.com.


Re: How to best secure environment variables (secret key, passwords etc.) stored in .yml files?

2020-02-08 Thread Motaz Hejaze
This discussion was very helpful

On Sat, 8 Feb 2020, 2:10 pm onlinejudge95,  wrote:

> +1 for the same
>
> On Thu, Jan 30, 2020, 8:17 PM Chris Wedgwood  wrote:
>
>> Hi Tom
>>
>> You are definitely not overthinking this. it's important.
>>
>> This is an area that has baked my noodle for a while now and I always am
>> left wondering "Do I have this right?" "Am I vulnerable to attack?" .
>> and I still haven't figured it out completely. It's like static files  I
>> never really feeel like I get it entirely :)
>>
>> Firstly you should never need to store a password/token/secret in Source
>> Control ever. If you are stop and think there must be a better way.
>>
>> I use environment variables .env to store my secrets but the trick is
>> ALWAYS put that in your .gitignore  file. If you start a new git repository
>> there is an option to create a .gitignore file
>> for Python that is a great starting point.
>>
>> To complement my *.env* file it has a .env.example file that I DO put in
>> source control with a dummy password.
>>
>> .env file:
>>
>> MAILGUN_API_KEY =asjdhasds78dy9s8dy012287e210eu209e72
>>
>> .env.example:
>>
>> MAILGUN_API_KEY=ThisIsNotARealToken
>>
>> So when I do local development  I can populate my .env fie with local dev
>> secrets.
>>
>> For production deployments, I use *Ansible *for which I provide
>> production tokens and secrets in a separate file also not in source control.
>>
>> The Ansible deployment requires an ssh password that I store in a
>> Password Manager that has two-factor authentication.
>>
>> The docker-compose file can read environment variables from the .env file.
>>
>> Have a look at Django-Cookiecutter and see how they do it. That helped me
>> a lot when I started out
>>
>> cheers
>> Chris
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Thursday, 30 January 2020 12:41:01 UTC, Tom Moore wrote:
>>>
>>> Hi there, I'm following the guidelines by making sure the environment
>>> variables are stored outside of the settings.py files.
>>>
>>> The project is "dockerised" and so the environment variables have been
>>> stored in files *docker-compose.yml* and *docker-compose-prod.yml*.
>>>
>>> This includes things like the project's secret key, API keys, and
>>> database passwords.
>>>
>>> *My question is: *
>>> • Just because environment variables are stored in .yml files, won't
>>> they be equally insecure the moment I commit the project folder to a git
>>> repo (and especially if I push that repo to GitHub)?
>>> e.g. the Secret Key will forevermore be stored in the git repo (in
>>> earlier versions, even if I later move it to another file in subsequent
>>> commits).
>>>
>>> Is there an even more secure way of storing environment variables? Or am
>>> I overthinking it (as I'm the only developer and the GitHub repo is set to
>>> Private)?
>>>
>>> Many thanks in advance for your help.
>>>
>> --
>> 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/55f28dec-7c9a-4cae-b658-f89772aa1bd7%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%3DM5eTLPJKDendsP9DvYzi_bDXhOYFZgNG5ZEBsLg7bknGO2g%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/CAHV4E-eypvq1%3DuA%2B8K_mube6nii4%3DiNxm1_%3D7%3DhoVVgiOGYc9w%40mail.gmail.com.


Re: How to best secure environment variables (secret key, passwords etc.) stored in .yml files?

2020-02-08 Thread onlinejudge95
+1 for the same

On Thu, Jan 30, 2020, 8:17 PM Chris Wedgwood  wrote:

> Hi Tom
>
> You are definitely not overthinking this. it's important.
>
> This is an area that has baked my noodle for a while now and I always am
> left wondering "Do I have this right?" "Am I vulnerable to attack?" .
> and I still haven't figured it out completely. It's like static files  I
> never really feeel like I get it entirely :)
>
> Firstly you should never need to store a password/token/secret in Source
> Control ever. If you are stop and think there must be a better way.
>
> I use environment variables .env to store my secrets but the trick is
> ALWAYS put that in your .gitignore  file. If you start a new git repository
> there is an option to create a .gitignore file
> for Python that is a great starting point.
>
> To complement my *.env* file it has a .env.example file that I DO put in
> source control with a dummy password.
>
> .env file:
>
> MAILGUN_API_KEY =asjdhasds78dy9s8dy012287e210eu209e72
>
> .env.example:
>
> MAILGUN_API_KEY=ThisIsNotARealToken
>
> So when I do local development  I can populate my .env fie with local dev
> secrets.
>
> For production deployments, I use *Ansible *for which I provide
> production tokens and secrets in a separate file also not in source control.
>
> The Ansible deployment requires an ssh password that I store in a Password
> Manager that has two-factor authentication.
>
> The docker-compose file can read environment variables from the .env file.
>
> Have a look at Django-Cookiecutter and see how they do it. That helped me
> a lot when I started out
>
> cheers
> Chris
>
>
>
>
>
>
>
>
>
>
>
> On Thursday, 30 January 2020 12:41:01 UTC, Tom Moore wrote:
>>
>> Hi there, I'm following the guidelines by making sure the environment
>> variables are stored outside of the settings.py files.
>>
>> The project is "dockerised" and so the environment variables have been
>> stored in files *docker-compose.yml* and *docker-compose-prod.yml*.
>>
>> This includes things like the project's secret key, API keys, and
>> database passwords.
>>
>> *My question is: *
>> • Just because environment variables are stored in .yml files, won't they
>> be equally insecure the moment I commit the project folder to a git repo
>> (and especially if I push that repo to GitHub)?
>> e.g. the Secret Key will forevermore be stored in the git repo (in
>> earlier versions, even if I later move it to another file in subsequent
>> commits).
>>
>> Is there an even more secure way of storing environment variables? Or am
>> I overthinking it (as I'm the only developer and the GitHub repo is set to
>> Private)?
>>
>> Many thanks in advance for your help.
>>
> --
> 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/55f28dec-7c9a-4cae-b658-f89772aa1bd7%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%3DM5eTLPJKDendsP9DvYzi_bDXhOYFZgNG5ZEBsLg7bknGO2g%40mail.gmail.com.


RE: Adding a verbose_name to id field

2020-02-08 Thread Mike Dewhirst
I imagine you need to specify the id field in your model and give it a verbose 
name. This is an unusual requirement. Why do you want to do such a thing?Mike
 Original message From: Bruckner de Villiers 
 Date: 8/2/20  21:33  (GMT+10:00) To: 
django-users@googlegroups.com Subject: Adding a verbose_name to id field Using 
Sqlite3 & Django 3.0.2 - I have searched high and low, but can’t find a way to 
add a verbose name to the id of a model.Anyone have ideas, please? Bruckner de 
Villiers+27 83 625 1086

-- 
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/5e3e9fe6.1c69fb81.7cda5.a2fdSMTPIN_ADDED_MISSING%40gmr-mx.google.com.


Adding a verbose_name to id field

2020-02-08 Thread Bruckner de Villiers
Using Sqlite3 & Django 3.0.2 - I have searched high and low, but can’t find a 
way to add a verbose name to the id of a model.

Anyone have ideas, please?

 

Bruckner de Villiers

+27 83 625 1086

-- 
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/62D60B90-C46E-41AB-AF46-4CD1BEA89D14%40gmail.com.


Trie Data Structure

2020-02-08 Thread Soumen Khatua
from collections import defaultdict


class TrieNode():

def __init__(self):
self.children = defaultdict()
self.terminating = False


class Trie():

def __init__(self):
self.root = self.get_node()

def get_node(self):
return TrieNode()

def get_index(self, ch):
return ord(ch) - ord('a')

def insert(self, word):

root = self.root
len1 = len(word)

for i in range(len1):
index = self.get_index(word[i])

if index not in root.children:
root.children[index] = self.get_node()
root = root.children.get(index)

root.terminating = True

def search(self, word):
root = self.root
len1 = len(word)

for i in range(len1):
index = self.get_index(word[i])
if not root:
return False
root = root.children.get(index)

return True if root and root.terminating else False

def delete(self, word):

root = self.root
len1 = len(word)

for i in range(len1):
index = self.get_index(word[i])

if not root:
print ("Word not found")
return -1
root = root.children.get(index)

if not root:
print ("Word not found")
return -1
else:
root.terminating = False
return 0

def update(self, old_word, new_word):
val = self.delete(old_word)
if val == 0:
self.insert(new_word)



if __name__ == "__main__":

strings = ["pqrs", "pprt", "psst", "qqrs", "pqrs"]

t = Trie()
for word in strings:
t.insert(word)


Could anyone tell me,How Inset function is working here? actually I'm not
able to track it. Specially if index is alerady available in root.children
then how it is creating an another TrieNode object.

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/CAPUw6WbzxcxyzwKynS9vnZe5cwem2bT8bjLZS%2BO9C%2BfyV6V6MA%40mail.gmail.com.


Re: django

2020-02-08 Thread Kasper Laudrup

On 07/02/2020 21.14, mick wrote:

|as_crispy_field got passed an invalid or inexistent field



https://stackoverflow.com/help/how-to-ask

--
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/4fa2ba25-4d47-8759-110d-bb8568cf5c01%40stacktrace.dk.


How to fill the form field with the data based on drop down selection of another form field using ajax request

2020-02-08 Thread Dilipkumar Noone
Dear group,

I am Django learner.

I have two models.

1. ModelRegister 
2. ModelGSP

ModelRegister returns model_name.
ModelGSP has a foreignkey to ModelRegister.

When we select a particular model from a ModelGSP model,i want to fill a 
field in ModelGSP with the data for a selected model when ajax request is 
made.

Input data and expected result shown in screen shot below.

*currently when i select any model from RegisteredModel, none of the data 
is populated in get_model_nos_for_modelname field.*

*Please correct me if i am doing any mistake and how to proceed further.*

[image: query.png]
Below is my code snippet :

Enter code here...

Models.py:
===
class ModelRegister(models.Model):
"""
This class is used to register the model.
"""
FLOAT_CHOICES = [[float(x), float(x)] for x in range(1, 21)]

model_name = models.CharField(max_length=128, verbose_name="ModelName")
model_no = models.CharField(max_length=128, verbose_name="ModelNo")
os_name = models.ForeignKey(OSName, on_delete=models.CASCADE, 
verbose_name="OSName",default=" ")
chipset_type = models.ForeignKey(ChipsetType,on_delete=models.CASCADE, 
verbose_name="chipsetType")

class Meta:
verbose_name_plural = "ModelRegisteredList"

def __str__(self):
return self.model_name


class ModelGSP(models.Model):
"""
This class is used to raise Model GSP request.
"""

registered_model = 
models.ForeignKey(ModelRegister,on_delete=models.CASCADE, 
verbose_name="ModelName")
model_nos_for_reg_model = models.ManyToManyField(ModelNumber)
model_gsp_requester = models.CharField("Model GSP Requester", 
max_length=128,default=" ")
integrator = models.CharField("Integrator", max_length=100,default=" ")

class Meta:
 verbose_name_plural = "ModelGSPRequests"

def __str__(self):
 return self.model_gsp_requester + self.integrator + str(self.pk)

class ModelRegisterForm(ModelForm):
"""
This class is used to register the model information.
"""

class Meta:
model = ModelRegister
exclude = ['model_leader']
#fields = '__all__'


@property
def helper(self):
helper = FormHelper()
helper.form_tag = 'model_register_form'
helper.layout = Layout(
Fieldset(
   'Registered Model Details',
#Row('model_leader' ),
Row('model_name','model_no'),
Row('os_name', 'os_version'),
Row('chipset_type','chipset_name')
)
)

return helper

class ModelGSPRequestForm(ModelForm):
"""
This class is used to define the form fields to raise the model GSP 
request.
"""
registered_model = forms.ChoiceField(required=False,choices=unique_values)
#model_nos_for_reg_model = 
forms.ModelMultipleChoiceField(required=False,queryset=)

class Meta:
model = ModelGSPRequest
exclude = ['model_gsp_requester']

#choices=[]
def __init__(self, *args, **kwargs):
super(ModelGSPRequestForm, self).__init__(*args, **kwargs)
#self.form_tag = False
self.helper = FormHelper()
self.helper.layout = Layout(
Fieldset("Add Model GSP Request",
  
Row('registered_model','model_nos_for_reg_model')
)
   )
self.fields['model_nos_for_reg_model'].queryset = 
ModelNumber.objects.none()

ajax.py:


def load_model_details(request):
print("load model details")
print("request method",request.method)

model_name_id = request.GET.get("model_name")
model_registered_instances = 
ModelRegister.objects.filter(model_name_id=model_name_id)

model_number = []

for model in model_registered_instances:
model_number = model_number.append(model.model_no)
print("Model Number:", model_number)


return render(request, 'model_info_options.html', 
{'model_registered_instances':model_registered_instances})

model_info_options.html:




-
{% for model in model_registered_instances %}
{{ model.model_no }}
{% endfor %}


ModelGSP.html:
=


{% extends 'base.html' %}
{% load crispy_forms_tags %}

{% block static %}
{% endblock static %}

{% block content %}

   {% csrf_token %}
   
   {% crispy form %}
  
  
   
{% if action == "add" %}
Add
{% else %}
Update
{% endif %}
   
   
  Cancel
   


{% endblock content %}

{% block scripts %}

$(document).ready(function(){
$("#id_registered_model").change(function () {

var url = $("#gspmodelinfoForm").attr("model-details-url");  # Get 
the url of the 'gspmodelinfoForm' view

var model_name_id = $(this).val(); //get the 

Re: Django Channels Redis: MaxClientsError

2020-02-08 Thread Sabuhi Shukurov
hello, have you solved this issue?


On Saturday, 6 July 2019 15:55:26 UTC+4, Cédric Foellmi wrote:
>
> Hello everyone. I am seeking some help with Django Channels and Redis.
>
> I have a Django app running on Heroku. This app is rather simple: a Daphne 
> server, a background worker and a scheduling beat worker (the last two, 
> using Celery).
>
> I noticed I hit *very often* Redi's MaxClientsError (every 15 minutes or 
> so) despite using the non-free plan of RedisCloud on Heroku, which has the 
> following parameters: Memory Size = 100 MB, Dedicated DB = 4, Connections = 
> 256. I was using the free plan for a while with 30 connections, but the 
> MaxClientsError was popping all the time. Thus I increased to 256 
> connections, but since I have more bakground tasks, I hit again the error.
>
> In the stacktrace below, you can see the problem occurs within 
> djangochannelsrestframework code. Line 233, there is this:
>
> for group_name in group_names:
>   async_to_sync(channel_layer.group_send)(group_name, message)
>
>
> But we never managed to understand if that was the cause of the error.  Is 
> that way of doing the reason for opening so many connections ? My app is 
> not a chat. It has only background tasks that discover some data remotely, 
> and send them through websockets for a kind of "live events RSS".
>
> Wouldn't it be better to use something like:
> async2sync = async_to_sync(channel_layer.group_send)
> for group_name in group_names:
> async2sync(group_name, message)
>
>
> Thanks a lot in advance!!!
>
> ---
>
> My conf is the following:
>
> Django==2.2.*
>
> channels==2.2.*
>
> channels-redis==2.3.*
>
> daphne==2.3.*
>
>
> CHANNEL_LAYERS = {
> "default": {
> "BACKEND": "channels_redis.core.RedisChannelLayer",
> "CONFIG": {
> "hosts": [os.environ.get('REDISCLOUD_URL', 
> 'redis://localhost:6379')],
> },
> "symmetric_encryption_keys": [SECRET_KEY],
> },
> }
>
>
>
> And the stacktrace: 
>
>
> MaxClientsError: ERR max number of clients reached
>
>   File "arcsecond/activities/tasks/archive_datarows.py", line 65, in 
> parse_archive_latest_rows
>
> target_name=row.target_name)
>
>   File "django/db/models/manager.py", line 82, in manager_method
>
> return getattr(self.get_queryset(), name)(*args, **kwargs)
>
>   File "django/db/models/query.py", line 422, in create
>
> obj.save(force_insert=True, using=self.db)
>
>   File "django/db/models/base.py", line 741, in save
>
> force_update=force_update, update_fields=update_fields)
>
>   File "django/db/models/base.py", line 790, in save_base
>
> update_fields=update_fields, raw=raw, using=using,
>
>   File "django/dispatch/dispatcher.py", line 175, in send
>
> for receiver in self._live_receivers(sender)
>
>   File "django/dispatch/dispatcher.py", line 175, in 
>
> for receiver in self._live_receivers(sender)
>
>   File "djangochannelsrestframework/observer/observer.py", line 154, in 
> post_save_receiver
>
> **kwargs
>
>   File "djangochannelsrestframework/observer/observer.py", line 221, in 
> post_change_receiver
>
> **kwargs
>
>   File "djangochannelsrestframework/observer/observer.py", line 233, in 
> send_messages
>
> async_to_sync(channel_layer.group_send)(group_name, message)
>
>   File "asgiref/sync.py", line 79, in __call__
>
> return call_result.result()
>
>   File "concurrent/futures/_base.py", line 425, in result
>
> return self.__get_result()
>
>   File "concurrent/futures/_base.py", line 384, in __get_result
>
> raise self._exception
>
>   File "asgiref/sync.py", line 95, in main_wrap
>
> result = await self.awaitable(*args, **kwargs)
>
>   File "channels_redis/core.py", line 559, in group_send
>
> async with self.connection(self.consistent_hash(group)) as connection:
>
>   File "channels_redis/core.py", line 742, in __aenter__
>
> self.conn = await self.pool.pop()
>
>   File "channels_redis/core.py", line 49, in pop
>
> conns.append(await aioredis.create_redis(**self.host, loop=loop))
>
>   File "aioredis/commands/__init__.py", line 178, in create_redis
>
> loop=loop)
>
>   File "aioredis/connection.py", line 129, in create_connection
>
> await conn.auth(password)
>
>   File "aioredis/util.py", line 48, in wait_ok
>
> res = await fut
>
>

-- 
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/8f83c957-8558-4c9a-b31c-8dca18984d5e%40googlegroups.com.