Re: how to prevent Django do auto capitalize static text in templates

2021-05-18 Thread Liu Zheng
Checking CSS is the right way to go. To verify, simply comment out all css styles (internal or external ones) and strip off the classes from these few lines. You shouldn’t have capitalisation problem any more On Tue, 18 May 2021 at 9:23 PM, Samuel Nogueira wrote: > I am using bootstrap, so my

Re: Is it possible to use REST API on Django template ?

2020-11-30 Thread Liu Zheng
Hi, Guys earlier have provided useful links for consuming APIs. Just want to emphasize some concepts between server-side and client-side codes. A django template is rendered into a page on the *server side*. That means, the server does the work and prepares the html content before sending it to

Re: deploying a django project

2020-09-07 Thread Liu Zheng
@Omkar Parab: Lol. Exactly. When I saw the question, this video was the first in my mind. I clicked in to share the link, but you have shared it. Cheers! On Tue, Sep 8, 2020 at 5:14 AM Omkar Parab wrote: > Follow this video. > https://youtu.be/6DI_7Zja8Zc > > On Tue, Sep 8, 2020, 2:36 AM

Re: type error

2020-08-18 Thread Liu Zheng
hi, What’s the type and value of that variable “value”? It would be helpful to print out value and type(value) right in front of this line where error occurs. Best Zheng On Tue, 18 Aug 2020 at 9:21 PM, Rostislav Kornatsky < info.send.o...@gmail.com> wrote: > Hi, my name is Rostislav and I'm

Re: Security issue in django.db.models

2020-08-09 Thread Liu Zheng
All the previous answers are great to explain the reason. Just want to add: if you do not desire empty string in form and in shell, you probably need to add a min_length validation condition On Sun, Aug 9, 2020 at 12:42 PM Stephen J. Butler wrote: > If you look at the documentation for 'blank'

Re: Django jinja queryset filter lenth

2020-08-09 Thread Liu Zheng
Hi, Not sure it's a good idea to do database query inside the template. Templates are capable of running some logics but for a heavy-lifting job like database query, it should be a good practice to do it in the view, and only pass the results to the template. On Sun, Aug 9, 2020 at 4:30 AM Agoua

Re: Import csv file on django view

2020-07-24 Thread Liu Zheng
gt;> pe 24. heinäk. 2020 klo 17.09 Ronaldo Mata >> kirjoitti: >> >>> Yes, I will try it. Anythin I will let you know >>> >>> El mié., 22 de julio de 2020 12:24 p. m., Liu Zheng < >>> firstday2...@gmail.com> escribió: >>> >>&g

Re: Import csv file on django view

2020-07-22 Thread Liu Zheng
wrote: > Hi Kovy, this is not solved. Liu Zheng but using > chardet(request.FILES['file'].read()) return encoding "ascii" is not > correct, I've uploaded a file using utf-7 as encoding for example and the > result is wrog. and then I tried > request.FILES['fi

Re: How to trace circular import error Django never solved!! Please sort this out.

2020-07-22 Thread Liu Zheng
Hi, Probably not enough to look at urls.py files only. My guess: Do you use ‘reverse’ function anywhere in covid app? If so, here’s a circular import: urls.py imports covid urls -> covid urls import covid views -> one covid view uses reverse -> reverse import urls.py of the project (to look up

Re: Import csv file on django view

2020-07-22 Thread Liu Zheng
What i meant was that you can only feed binary data or binary handlers to chardet. You can decode the binary data according to the detection results afterward. On Wed, 22 Jul 2020 at 11:11 PM, Liu Zheng wrote: > Hi, glad you solved the problem. Yes, both the request.FILES[‘f

Re: Import csv file on django view

2020-07-22 Thread Liu Zheng
nd I realized that the problem was the delimiter of the csv >>> but predicting it is another problem. >>> >>> Anyway, it was a task that I had to do and that was my limitation. I >>> think there must be a library that does all this, uploading

Re: Import csv file on django view

2020-07-21 Thread Liu Zheng
Hi. First of all, I think it's impossible to perfectly detect encoding without further information. See the answer in this SO post: https://stackoverflow.com/questions/436220/how-to-determine-the-encoding-of-text There are many packages and tools to help detect encoding format, but keep in

Where to check detailed info (reference page, not the topics page) about contrib.auth.views.LogoutView?

2020-07-21 Thread Liu Zheng
Hi guys, I'm trying to solve a simple problem: add a message "You've logged out!" After redirecting user to login page. I got one nice solution at https://stackoverflow.com/questions/11393929/django-message-when-logout from django.contrib.auth.views import LogoutView class

Re: Using primary key to update via POST request.

2020-07-21 Thread Liu Zheng
Hi, do you mean in the GET request, the user provides the pk (perhaps in URL) or the server sends to users an object where pk is a field? If it's the former, then @George's answer is the right one. An example of what you are trying to achieve will be helpful. Best Zheng On Tue, Jul 21, 2020 at

Re: My first question

2020-07-20 Thread Liu Zheng
y much your informative post. Question below - - - > > On Sat, Jul 18, 2020 at 9:14 AM Liu Zheng > wrote: > >> Hi. Doesn't sound like a Django question, but I assume you came across >> this question when writing Django codes:) So anyway, let me try to see >>

Re: My first question

2020-07-20 Thread Liu Zheng
:) On Monday, July 20, 2020 at 2:25:00 PM UTC+8, Derek wrote: > > This would make a great blog post! And in future, we can all refer > directly to it, when someone asks a similar question. > > On Saturday, 18 July 2020 16:13:53 UTC+2, Liu Zheng wrote: >> >> Hi. Doesn't s

Re: Login and Registration

2020-07-19 Thread Liu Zheng
https://www.youtube.com/playlist?list=PL-osiE80TeTtoQCKZ03TU5fNfx2UY6U4p This video series will be helpful On Mon, Jul 20, 2020 at 5:33 AM Anirudh choudhary < anirudhchoudary...@gmail.com> wrote: > You can simply do it by manipulating the context data like > > context = { >

Re: How to save images posted by application users

2020-07-18 Thread Liu Zheng
Hi. Here's a very nice video tutorial on how to handle images with media. https://www.youtube.com/watch?v=FdVuKt_iuSI=PL-osiE80TeTtoQCKZ03TU5fNfx2UY6U4p=8 Also to your question on how to deploy it in production, check this video.

Re: My first question

2020-07-18 Thread Liu Zheng
Hi. Doesn't sound like a Django question, but I assume you came across this question when writing Django codes:) So anyway, let me try to see whether I could provide any useful information here. This question is a bit too broad, so let me try to answer it in several levels. First, python

Re: can't find index

2020-07-18 Thread Liu Zheng
I believe you were following the official tutorial on Django's website, and has created a view function called "index" in "polls" app, which was wired to "/polls" url. All the codes were exactly the same as provided in the tutorial. The mistake you made was when you opened the browser and typed