manage.py is giving me an error

2020-07-21 Thread Kovy Jacob


Jacob-Mac-mini:TachlisGeredt kovyjacob$ python manage.py runserver 
0.0.0.0:8000

  File "manage.py", line 16

) from exc

 ^

SyntaxError: invalid syntax


why am I getting an error, I never edited manage.py

-- 
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/5cb39a87-ebcf-4c2d-8dce-d39274eba858o%40googlegroups.com.


Re: Import csv file on django view

2020-07-22 Thread Kovy Jacob
Could you just use the standard python csv module?

> On Jul 22, 2020, at 10:25 AM, Ronaldo Mata  wrote:
> 
> Hi Liu thank for your answer.
> 
> This has been a headache, I am trying to read the file using csv.DictReader 
> initially i had an error trying to get the dict keys when iterating by rows, 
> and i thought it could be encoding (for this reason i wanted to prepare the 
> view to use the correct encoding). for that reason I asked my question.
> 
> 1) your first approach doesn't work, if i send utf-8 file, chardet returns 
> ascii as encoding. it seems request.FILES ['file']. read () returns a binary 
> with that encoding.
> 
> 2) In the end 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 a csv file is common 
> practice in many web apps.
> 
> El mar., 21 jul. 2020 a las 13:47, Liu Zheng ( >) escribió:
> 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 mind that they are only giving educated guesses. (Most of the time, the 
> guess is correct, but do check the dev page to see whether there are known 
> issues related to your problem.)
> 
> Now let's say you have decided to use chardet. Check its doc page for the 
> usage: https://chardet.readthedocs.io/en/latest/usage.html#usage 
>  You'll have more 
> than one solutions. Here are some examples:
> 
> 1. If the files uploaded to your server are all expected to be small csv 
> files (less than a few MB and not many users do it concurrently), you can do 
> the following:
> 
> #in the view to handle the uploaded file: (assume file input name is just 
> "file")
> file_content = request.FILES['file'].read()
> chardet.detect(file_content)
> 
> 2. Also, chardet seems to support incremental (line-by-line) detection 
> https://chardet.readthedocs.io/en/latest/usage.html#example-detecting-encoding-incrementally
>  
> 
> 
> Given this, we can also read from requests.FILES line by line and pass each 
> line to chardet
> 
> from chardet.universaldetector import UniversalDetector
> 
> #somewhere in a view function
> detector = UniversalDetector()
> file_handle = request.FILES['file']
> for line in file_handle:
> detector.feed(line)
> if detector.done: break
> detector.close()
> # result available as a dict at detector.result
> 
> 
> 
> 
> 
> On Tuesday, July 21, 2020 at 7:09:35 AM UTC+8, Ronaldo Mata wrote:
> How to deal with encoding when you try to read a csv file on view.
> 
> I have a view to upload csv file, in this view I read file and save each row 
> as new record.
> 
> My bug is when I try to upload a csv file with a differente encoding (not 
> UTF-8)
> 
> how to handle this on django (using request.FILES) I was researching and I 
> found chardet but I don't know how to pass it a request.FILES. 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/64307441-0e65-45a2-b917-ece15a4ea729o%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/CAP%3DoziQuZyb74Wsk%2BnjngUpSccOKCYRM_C%3D7KgGX%2BgV5wRzHwQ%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/91E9FE01-4701-47

Error in manage.py when I do python manage.py runserver

2020-07-22 Thread Kovy Jacob
It gives me a syntax error

Jacob-Mac-mini:TachlisGeredt kovyjacob$ python manage.py runserver 0.0.0.0:8000
File "manage.py", line 16
) from exc:
^
SyntaxError: invalid syntax

I didn’t edit manage.py yet, I literally just started the project. I was 
thinking maybe its a) a version error, or b) I know that I get syntax errors on 
code that was written in sublime text or a different IDE when I run it on IDLE, 
so maybe its 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/A7892FFC-BEE5-4DE3-99C1-6C4E8CD98C68%40gmail.com.


Re: Import csv file on django view

2020-07-22 Thread Kovy Jacob
Ah, so is the problem that you don’t always know what the delimiter is when you 
read it? If yes, what is the use case for this? You might not need a universal 
solution, maybe just put all the info into a csv yourself, manually.

> On Jul 22, 2020, at 10:39 AM, Ronaldo Mata  wrote:
> 
> Hi Kovy, I'm using csv module, but I need to handle the delimiters of the 
> files, sometimes you come separated by "," others by ";" and rarely by "|" 
> 
> El mié., 22 jul. 2020 a las 10:28, Kovy Jacob ( <mailto:kovy.ja...@gmail.com>>) escribió:
> Could you just use the standard python csv module?
> 
>> On Jul 22, 2020, at 10:25 AM, Ronaldo Mata > <mailto:ronaldomat...@gmail.com>> wrote:
>> 
>> Hi Liu thank for your answer.
>> 
>> This has been a headache, I am trying to read the file using csv.DictReader 
>> initially i had an error trying to get the dict keys when iterating by rows, 
>> and i thought it could be encoding (for this reason i wanted to prepare the 
>> view to use the correct encoding). for that reason I asked my question.
>> 
>> 1) your first approach doesn't work, if i send utf-8 file, chardet returns 
>> ascii as encoding. it seems request.FILES ['file']. read () returns a binary 
>> with that encoding.
>> 
>> 2) In the end 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 a csv file is common 
>> practice in many web apps.
>> 
>> El mar., 21 jul. 2020 a las 13:47, Liu Zheng (> <mailto:firstday2...@gmail.com>>) escribió:
>> 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
>>  
>> <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 mind that they are only giving educated guesses. (Most of the time, the 
>> guess is correct, but do check the dev page to see whether there are known 
>> issues related to your problem.)
>> 
>> Now let's say you have decided to use chardet. Check its doc page for the 
>> usage: https://chardet.readthedocs.io/en/latest/usage.html#usage 
>> <https://chardet.readthedocs.io/en/latest/usage.html#usage> You'll have more 
>> than one solutions. Here are some examples:
>> 
>> 1. If the files uploaded to your server are all expected to be small csv 
>> files (less than a few MB and not many users do it concurrently), you can do 
>> the following:
>> 
>> #in the view to handle the uploaded file: (assume file input name is just 
>> "file")
>> file_content = request.FILES['file'].read()
>> chardet.detect(file_content)
>> 
>> 2. Also, chardet seems to support incremental (line-by-line) detection 
>> https://chardet.readthedocs.io/en/latest/usage.html#example-detecting-encoding-incrementally
>>  
>> <https://chardet.readthedocs.io/en/latest/usage.html#example-detecting-encoding-incrementally>
>> 
>> Given this, we can also read from requests.FILES line by line and pass each 
>> line to chardet
>> 
>> from chardet.universaldetector import UniversalDetector
>> 
>> #somewhere in a view function
>> detector = UniversalDetector()
>> file_handle = request.FILES['file']
>> for line in file_handle:
>> detector.feed(line)
>> if detector.done: break
>> detector.close()
>> # result available as a dict at detector.result
>> 
>> 
>> 
>> 
>> 
>> On Tuesday, July 21, 2020 at 7:09:35 AM UTC+8, Ronaldo Mata wrote:
>> How to deal with encoding when you try to read a csv file on view.
>> 
>> I have a view to upload csv file, in this view I read file and save each row 
>> as new record.
>> 
>> My bug is when I try to upload a csv file with a differente encoding (not 
>> UTF-8)
>> 
>> how to handle this on django (using request.FILES) I was researching and I 
>> found chardet but I don't know how to pass it a request.FILES. 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 

Re: Import csv file on django view

2020-07-22 Thread Kovy Jacob
Maybe first use the standard file.open to save the file to a variable, search 
that variable for the different delimiters using standard string manipulation 
vichulu, and then open it using the corresponding delimiter.

> On Jul 22, 2020, at 10:39 AM, Ronaldo Mata  wrote:
> 
> Hi Kovy, I'm using csv module, but I need to handle the delimiters of the 
> files, sometimes you come separated by "," others by ";" and rarely by "|" 
> 
> El mié., 22 jul. 2020 a las 10:28, Kovy Jacob ( <mailto:kovy.ja...@gmail.com>>) escribió:
> Could you just use the standard python csv module?
> 
>> On Jul 22, 2020, at 10:25 AM, Ronaldo Mata > <mailto:ronaldomat...@gmail.com>> wrote:
>> 
>> Hi Liu thank for your answer.
>> 
>> This has been a headache, I am trying to read the file using csv.DictReader 
>> initially i had an error trying to get the dict keys when iterating by rows, 
>> and i thought it could be encoding (for this reason i wanted to prepare the 
>> view to use the correct encoding). for that reason I asked my question.
>> 
>> 1) your first approach doesn't work, if i send utf-8 file, chardet returns 
>> ascii as encoding. it seems request.FILES ['file']. read () returns a binary 
>> with that encoding.
>> 
>> 2) In the end 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 a csv file is common 
>> practice in many web apps.
>> 
>> El mar., 21 jul. 2020 a las 13:47, Liu Zheng (> <mailto:firstday2...@gmail.com>>) escribió:
>> 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
>>  
>> <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 mind that they are only giving educated guesses. (Most of the time, the 
>> guess is correct, but do check the dev page to see whether there are known 
>> issues related to your problem.)
>> 
>> Now let's say you have decided to use chardet. Check its doc page for the 
>> usage: https://chardet.readthedocs.io/en/latest/usage.html#usage 
>> <https://chardet.readthedocs.io/en/latest/usage.html#usage> You'll have more 
>> than one solutions. Here are some examples:
>> 
>> 1. If the files uploaded to your server are all expected to be small csv 
>> files (less than a few MB and not many users do it concurrently), you can do 
>> the following:
>> 
>> #in the view to handle the uploaded file: (assume file input name is just 
>> "file")
>> file_content = request.FILES['file'].read()
>> chardet.detect(file_content)
>> 
>> 2. Also, chardet seems to support incremental (line-by-line) detection 
>> https://chardet.readthedocs.io/en/latest/usage.html#example-detecting-encoding-incrementally
>>  
>> <https://chardet.readthedocs.io/en/latest/usage.html#example-detecting-encoding-incrementally>
>> 
>> Given this, we can also read from requests.FILES line by line and pass each 
>> line to chardet
>> 
>> from chardet.universaldetector import UniversalDetector
>> 
>> #somewhere in a view function
>> detector = UniversalDetector()
>> file_handle = request.FILES['file']
>> for line in file_handle:
>> detector.feed(line)
>> if detector.done: break
>> detector.close()
>> # result available as a dict at detector.result
>> 
>> 
>> 
>> 
>> 
>> On Tuesday, July 21, 2020 at 7:09:35 AM UTC+8, Ronaldo Mata wrote:
>> How to deal with encoding when you try to read a csv file on view.
>> 
>> I have a view to upload csv file, in this view I read file and save each row 
>> as new record.
>> 
>> My bug is when I try to upload a csv file with a differente encoding (not 
>> UTF-8)
>> 
>> how to handle this on django (using request.FILES) I was researching and I 
>> found chardet but I don't know how to pass it a request.FILES. 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

Re: Import csv file on django view

2020-07-22 Thread Kovy Jacob
That’s probably not the proper answer, but that’s the best I can do. Sorry :-(

> On Jul 22, 2020, at 10:46 AM, Ronaldo Mata  wrote:
> 
> Yes, the problem here is that the files will be loaded by the user, so I 
> don't know what delimiter I will receive. This is not a base command that I 
> am using, it is the logic that I want to incorporate in a view
> 
> El mié., 22 jul. 2020 a las 10:43, Kovy Jacob ( <mailto:kovy.ja...@gmail.com>>) escribió:
> Ah, so is the problem that you don’t always know what the delimiter is when 
> you read it? If yes, what is the use case for this? You might not need a 
> universal solution, maybe just put all the info into a csv yourself, manually.
> 
>> On Jul 22, 2020, at 10:39 AM, Ronaldo Mata > <mailto:ronaldomat...@gmail.com>> wrote:
>> 
>> Hi Kovy, I'm using csv module, but I need to handle the delimiters of the 
>> files, sometimes you come separated by "," others by ";" and rarely by "|" 
>> 
>> El mié., 22 jul. 2020 a las 10:28, Kovy Jacob (> <mailto:kovy.ja...@gmail.com>>) escribió:
>> Could you just use the standard python csv module?
>> 
>>> On Jul 22, 2020, at 10:25 AM, Ronaldo Mata >> <mailto:ronaldomat...@gmail.com>> wrote:
>>> 
>>> Hi Liu thank for your answer.
>>> 
>>> This has been a headache, I am trying to read the file using csv.DictReader 
>>> initially i had an error trying to get the dict keys when iterating by 
>>> rows, and i thought it could be encoding (for this reason i wanted to 
>>> prepare the view to use the correct encoding). for that reason I asked my 
>>> question.
>>> 
>>> 1) your first approach doesn't work, if i send utf-8 file, chardet returns 
>>> ascii as encoding. it seems request.FILES ['file']. read () returns a 
>>> binary with that encoding.
>>> 
>>> 2) In the end 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 a csv file is common 
>>> practice in many web apps.
>>> 
>>> El mar., 21 jul. 2020 a las 13:47, Liu Zheng (>> <mailto:firstday2...@gmail.com>>) escribió:
>>> 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
>>>  
>>> <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 mind that they are only giving educated guesses. (Most of the time, the 
>>> guess is correct, but do check the dev page to see whether there are known 
>>> issues related to your problem.)
>>> 
>>> Now let's say you have decided to use chardet. Check its doc page for the 
>>> usage: https://chardet.readthedocs.io/en/latest/usage.html#usage 
>>> <https://chardet.readthedocs.io/en/latest/usage.html#usage> You'll have 
>>> more than one solutions. Here are some examples:
>>> 
>>> 1. If the files uploaded to your server are all expected to be small csv 
>>> files (less than a few MB and not many users do it concurrently), you can 
>>> do the following:
>>> 
>>> #in the view to handle the uploaded file: (assume file input name is just 
>>> "file")
>>> file_content = request.FILES['file'].read()
>>> chardet.detect(file_content)
>>> 
>>> 2. Also, chardet seems to support incremental (line-by-line) detection 
>>> https://chardet.readthedocs.io/en/latest/usage.html#example-detecting-encoding-incrementally
>>>  
>>> <https://chardet.readthedocs.io/en/latest/usage.html#example-detecting-encoding-incrementally>
>>> 
>>> Given this, we can also read from requests.FILES line by line and pass each 
>>> line to chardet
>>> 
>>> from chardet.universaldetector import UniversalDetector
>>> 
>>> #somewhere in a view function
>>> detector = UniversalDetector()
>>> file_handle = request.FILES['file']
>>> for line in file_handle:
>>> detector.feed(line)
>>> if detector.done: break
>>> detector.close()
>>> # result available as a dict at detector.result
>>> 

Re: Import csv file on django view

2020-07-22 Thread Kovy Jacob
Cool! I’m so happy I was able to help you!! Good luck!

> On Jul 22, 2020, at 11:11 AM, Liu Zheng  wrote:
> 
> Hi, glad you solved the problem. Yes, both the request.FILES[‘file’] and the 
> chardet file handler are binary handlers. Binary handler presents the raw 
> data. chardet takes a sequence or raw data and then detect the encoding 
> format. With its prediction, if you want to open that puece of data in text 
> mode, you can use the .decode() method of bytes object to 
> get a python string.
> 
> On Wed, 22 Jul 2020 at 11:04 PM, Kovy Jacob  <mailto:kovy.ja...@gmail.com>> wrote:
> That’s probably not the proper answer, but that’s the best I can do. Sorry :-(
> 
> 
>> On Jul 22, 2020, at 10:46 AM, Ronaldo Mata > <mailto:ronaldomat...@gmail.com>> wrote:
>> 
>> Yes, the problem here is that the files will be loaded by the user, so I 
>> don't know what delimiter I will receive. This is not a base command that I 
>> am using, it is the logic that I want to incorporate in a view
>> 
>> El mié., 22 jul. 2020 a las 10:43, Kovy Jacob (> <mailto:kovy.ja...@gmail.com>>) escribió:
>> Ah, so is the problem that you don’t always know what the delimiter is when 
>> you read it? If yes, what is the use case for this? You might not need a 
>> universal solution, maybe just put all the info into a csv yourself, 
>> manually.
>> 
>>> On Jul 22, 2020, at 10:39 AM, Ronaldo Mata >> <mailto:ronaldomat...@gmail.com>> wrote:
>>> 
>>> Hi Kovy, I'm using csv module, but I need to handle the delimiters of the 
>>> files, sometimes you come separated by "," others by ";" and rarely by "|" 
>>> 
>>> El mié., 22 jul. 2020 a las 10:28, Kovy Jacob (>> <mailto:kovy.ja...@gmail.com>>) escribió:
>>> Could you just use the standard python csv module?
>>> 
>>>> On Jul 22, 2020, at 10:25 AM, Ronaldo Mata >>> <mailto:ronaldomat...@gmail.com>> wrote:
>>>> 
>>>> Hi Liu thank for your answer.
>>>> 
>>>> This has been a headache, I am trying to read the file using 
>>>> csv.DictReader initially i had an error trying to get the dict keys when 
>>>> iterating by rows, and i thought it could be encoding (for this reason i 
>>>> wanted to prepare the view to use the correct encoding). for that reason I 
>>>> asked my question.
>>>> 
>>>> 1) your first approach doesn't work, if i send utf-8 file, chardet returns 
>>>> ascii as encoding. it seems request.FILES ['file']. read () returns a 
>>>> binary with that encoding.
>>>> 
>>>> 2) In the end 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 a csv file is common 
>>>> practice in many web apps.
>>>> 
>>>> El mar., 21 jul. 2020 a las 13:47, Liu Zheng (>>> <mailto:firstday2...@gmail.com>>) escribió:
>>>> 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
>>>>  
>>>> <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 mind that they are only giving educated guesses. (Most of the 
>>>> time, the guess is correct, but do check the dev page to see whether there 
>>>> are known issues related to your problem.)
>>>> 
>>>> Now let's say you have decided to use chardet. Check its doc page for the 
>>>> usage: https://chardet.readthedocs.io/en/latest/usage.html#usage 
>>>> <https://chardet.readthedocs.io/en/latest/usage.html#usage> You'll have 
>>>> more than one solutions. Here are some examples:
>>>> 
>>>> 1. If the files uploaded to your server are all expected to be small csv 
>>>> files (less than a few MB and not many users do it concurrently), you can 
>>>> do the following:
>>>> 
>>>> #in the view to handle the uploaded file: (assume file input name is just 
>>>> "file")
>>>> file_content = request.FILES['file'].r

Re: Import csv file on django view

2020-07-22 Thread Kovy Jacob
I’m confused. I don’t know if I can help.

> On Jul 22, 2020, at 11:11 AM, Liu Zheng  wrote:
> 
> Hi, glad you solved the problem. Yes, both the request.FILES[‘file’] and the 
> chardet file handler are binary handlers. Binary handler presents the raw 
> data. chardet takes a sequence or raw data and then detect the encoding 
> format. With its prediction, if you want to open that puece of data in text 
> mode, you can use the .decode() method of bytes object to 
> get a python string.
> 
> On Wed, 22 Jul 2020 at 11:04 PM, Kovy Jacob  <mailto:kovy.ja...@gmail.com>> wrote:
> That’s probably not the proper answer, but that’s the best I can do. Sorry :-(
> 
> 
>> On Jul 22, 2020, at 10:46 AM, Ronaldo Mata > <mailto:ronaldomat...@gmail.com>> wrote:
>> 
>> Yes, the problem here is that the files will be loaded by the user, so I 
>> don't know what delimiter I will receive. This is not a base command that I 
>> am using, it is the logic that I want to incorporate in a view
>> 
>> El mié., 22 jul. 2020 a las 10:43, Kovy Jacob (> <mailto:kovy.ja...@gmail.com>>) escribió:
>> Ah, so is the problem that you don’t always know what the delimiter is when 
>> you read it? If yes, what is the use case for this? You might not need a 
>> universal solution, maybe just put all the info into a csv yourself, 
>> manually.
>> 
>>> On Jul 22, 2020, at 10:39 AM, Ronaldo Mata >> <mailto:ronaldomat...@gmail.com>> wrote:
>>> 
>>> Hi Kovy, I'm using csv module, but I need to handle the delimiters of the 
>>> files, sometimes you come separated by "," others by ";" and rarely by "|" 
>>> 
>>> El mié., 22 jul. 2020 a las 10:28, Kovy Jacob (>> <mailto:kovy.ja...@gmail.com>>) escribió:
>>> Could you just use the standard python csv module?
>>> 
>>>> On Jul 22, 2020, at 10:25 AM, Ronaldo Mata >>> <mailto:ronaldomat...@gmail.com>> wrote:
>>>> 
>>>> Hi Liu thank for your answer.
>>>> 
>>>> This has been a headache, I am trying to read the file using 
>>>> csv.DictReader initially i had an error trying to get the dict keys when 
>>>> iterating by rows, and i thought it could be encoding (for this reason i 
>>>> wanted to prepare the view to use the correct encoding). for that reason I 
>>>> asked my question.
>>>> 
>>>> 1) your first approach doesn't work, if i send utf-8 file, chardet returns 
>>>> ascii as encoding. it seems request.FILES ['file']. read () returns a 
>>>> binary with that encoding.
>>>> 
>>>> 2) In the end 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 a csv file is common 
>>>> practice in many web apps.
>>>> 
>>>> El mar., 21 jul. 2020 a las 13:47, Liu Zheng (>>> <mailto:firstday2...@gmail.com>>) escribió:
>>>> 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
>>>>  
>>>> <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 mind that they are only giving educated guesses. (Most of the 
>>>> time, the guess is correct, but do check the dev page to see whether there 
>>>> are known issues related to your problem.)
>>>> 
>>>> Now let's say you have decided to use chardet. Check its doc page for the 
>>>> usage: https://chardet.readthedocs.io/en/latest/usage.html#usage 
>>>> <https://chardet.readthedocs.io/en/latest/usage.html#usage> You'll have 
>>>> more than one solutions. Here are some examples:
>>>> 
>>>> 1. If the files uploaded to your server are all expected to be small csv 
>>>> files (less than a few MB and not many users do it concurrently), you can 
>>>> do the following:
>>>> 
>>>> #in the view to handle the uploaded file: (assume file input name is just 
>>>> "file")
>>>> file_content = request.FILES['file'].read()
>>>

Re: Site not Secure only on Google Chrome

2020-07-26 Thread Kovy Jacob
I don’t know how to fix that, but I checked out the site on safari - it looks 
REALLY cool! Its really cool you made that with Django!

> On Jul 26, 2020, at 11:07 AM, Anirudh choudhary 
>  wrote:
> 
> Hello everyone
> 
> I hosted my app on Heroku. when is try to access www.apnaganna.herokuapp.com 
>  it show me secure but when I try to 
> access https://www.apnaganna.com  on google 
> chrome it shows me not secure. but on any other browser like Opera, Mozilla, 
> IE it is showing me unsecured only in google chrome it is showing unsecured. 
> I am using Automatic certs on Heroku  and my domain in on Godaddy 
> 
> any solution to the problem 
> 
> 
> Step I have taken:
> 1.cleaning cookies
> 2.when i try curl request like :- curl -vI https://www.apnaganna.com 
> 
> 
> it shows me :-  SSL: no alternative certificate subject name matches target 
> host name 'www.apnaganna.com '
> 
> Thankyou
> 
> 
> -- 
> 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/CAL8_rkEeZhW-_appFb_KRRAjQepJ%3D11ORZvMYkYh7-1BT0T0qA%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/604A6786-557A-44FD-9867-802CE6AAD66F%40gmail.com.


Re: Django key/value JSON widget

2020-07-30 Thread Kovy Jacob
Are you not able to use the regular python module for interacting with json 
files?

> On Jul 22, 2020, at 2:34 PM, Federico Capoano  
> wrote:
> 
> https://django-hstore.readthedocs.io/en/latest/#django-admin-widget 
> 

-- 
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/D091CE43-8615-4B79-B73D-18ED174B674A%40gmail.com.


field for html

2020-08-03 Thread Kovy Jacob
Hi, is there a type of field for django data models that's for html? I want
to have youtube embed links, which is a bunch of html fo putting a youtube
video on your site. Itlooks like this: "https://www.youtube.com/embed/Rj_vssRaZlQ"; frameborder="0"
allow="accelerometer; autoplay; encrypted-media; gyroscope;
picture-in-picture" allowfullscreen>". I stored it in a charfield,
but it gets shown on the website as text.
What should I do?
Thanks,
Kovy

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


ChoiceField in from module not working

2020-08-05 Thread Kovy Jacob
I am trying to have a ChoiceField in a form, but it gives me this error:

from TachlisGeredt.register_form import register

  File "/Users/kovyjacob/TachlisGeredt/TachlisGeredt/register_form.py",
line 10, in 

class RegisterForm (forms.Form):

  File "/Users/kovyjacob/TachlisGeredt/TachlisGeredt/register_form.py",
line 15, in RegisterForm

carrier = ChoiceField(choices = CARRIER_CHOICES)

NameError: name 'ChoiceField' is not defined


Here is the .py:

rom django import newforms as forms

from django.shortcuts import render

from django.http import HttpResponseRedirect

from django.core.mail import send_mail


carrier_choices = (

('@txt.freedommobile.ca', 'Freedom Mobile')

('@txt.luckymobile.ca', 'Lucky Mobile'),

)


class RegisterForm (forms.Form):

username = forms.CharField()

password = forms.CharField()

check_password = forms.CharField()

phone = froms.IntegerField(required = False)

carrier = ChoiceField(choices=carrier_choices, required = False)


I am new to django, what is the problem?

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/CACMwF3XpejE1-LGNwvyto%2BkcK2s9Y0udkEBGLw%3D3Tt%3DB_of1mA%40mail.gmail.com.


Re: field for html

2020-08-05 Thread Kovy Jacob
thanks everyone!!!

On Tue, Aug 4, 2020 at 8:10 AM Yemin Sajid  wrote:

> I would suggest you to only put the *video id* in the charfield and use
> that to render the * *in the template. Otherwise, there can be
> security issues if the content from the charfield is rendered safely as
> HTML.
>
> So in your template could it would be something like
> *https://www.youtube.com/embed/{{
> video_id }} <https://www.youtube.com/embed/Rj_vssRaZlQ>" frameborder="0"
> allow="accelerometer; autoplay; encrypted-media; gyroscope;
> picture-in-picture" allowfullscreen>*
>
> On Mon, Aug 3, 2020 at 11:16 PM neeraj garg  wrote:
>
>> Try to use django *safe *filter to render this as html.
>>
>> On Mon, Aug 3, 2020 at 8:35 PM Kovy Jacob  wrote:
>>
>>> Hi, is there a type of field for django data models that's for html? I
>>> want to have youtube embed links, which is a bunch of html fo putting a
>>> youtube video on your site. Itlooks like this: ">> height="360" src="https://www.youtube.com/embed/Rj_vssRaZlQ";
>>> frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope;
>>> picture-in-picture" allowfullscreen>". I stored it in a charfield,
>>> but it gets shown on the website as text.
>>> What should I do?
>>> Thanks,
>>> Kovy
>>>
>>> --
>>> 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/CACMwF3VTKYF3Zjm9fQMFwtjvxYXdsUA1JV6mXFTrD0XBW5bDdw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CACMwF3VTKYF3Zjm9fQMFwtjvxYXdsUA1JV6mXFTrD0XBW5bDdw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
>>
>> --
>> Thanks,
>> Neeraj
>>
>> --
>> 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/CAGR%2Bspcu_xgOgVLiStZEd2O0ePPCYnt_oYoSCm2D37FRYwGSqw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAGR%2Bspcu_xgOgVLiStZEd2O0ePPCYnt_oYoSCm2D37FRYwGSqw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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/CAFzgvyFVTg%2BAkPDbS6idkWERPx7ZpNg%3DXdU38qy1Z-4ua_ua9g%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAFzgvyFVTg%2BAkPDbS6idkWERPx7ZpNg%3DXdU38qy1Z-4ua_ua9g%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CACMwF3WsVhp0XeRJP6bn%2BSg5UW%2B9u%2BXEL9h5Q%2BHjJeF8jdYcfA%40mail.gmail.com.


Re: Has anyone created eCommerce website with Django?

2020-08-05 Thread Kovy Jacob
I would recommend using shopify over wix, as it is meant for e-commerce,
but django will give you many advantages.
- Highly customizable, you can add on anything you want, easily
- WAY cheaper, you can host a django site for a few dollars a month
- It gives you unlimited expansion, a day will hopefully come where you
want to expand your site, and you don't want to be restrained by the
limitations of a drag-and-drop-website, or have to make your website from
scratch on a different service/in django
- You will learn django and a bit of python, which is very useful.

On Wed, Aug 5, 2020 at 3:45 PM ola neat  wrote:

> yes i have,
> u charge base on the requirement and feature that is needed on the website
>
> On Wed, Aug 5, 2020 at 8:15 PM tristant  wrote:
>
>> Hi,
>> I am wondering if anyone here has created one for real, maybe for a small
>> business. If so, how do you price your work, say, as compared to other
>> available web-building services such as Wix.com where small businesses pay
>> subscription fee and no need to do any coding?
>>
>>
>> --
>> 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/4abb0de1-685d-4124-887a-31c4b3a85f03n%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/CAHLKn738oMsaK%2BOXGQWFmiZ75bjwtgtA243FHD58M1Cstvn8ig%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/CACMwF3XrJcKBH_RNwtdCzXwocJ8XBqJmGDhmp%2BOfvHM0HwaLrw%40mail.gmail.com.


Re: django beginner

2020-08-05 Thread Kovy Jacob
If you want to learn, just try building a site, any site. Pick a hobby that
you have, and make a site about you and your hobby. There is a concept in
programming called MVP - minimum viable product. This means the minimum you
can do to have a working site.
I recommend that you figure out exactly how you want your website to be,
figure out the bare minimum for the site - no fancy HTMLs, no advanced
website functions - and build it. After that, slowly build on the existing
website.
Also, you should really make sure that you understand how the internet
works, how realtional databases (which is the type of database that
websites use (mostly)), and what a web framework (like django) is, and how
it works. You can learn django without it, but if you understand what you
are doing, it will help you A LOT. You won't just know what you are typing,
you'll understand why you're typing it.
Also, it's pretty important that you have a basic knowledge of python,
because that's what django is built on.
If I can help you with any of these, email me @ kovy.ja...@gmail.com.
Good luck!

On Wed, Aug 5, 2020 at 9:38 PM Thomas POKAM  wrote:

> Hi Jose,
>
> Did you when throw this introduction guide ?
>
> https://docs.djangoproject.com/en/3.1/intro/
>
>
> Le 03/08/2020 à 11:10, jose AVOM a écrit :
>
> hi all.
> i am new in django i, i want to improve my skill...
> need for help en challenge ...
> thks
> --
> 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/de500232-9554-401c-9299-89d594786e50n%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/8b733e13-fc16-e9ec-7ab2-97780e70b7c4%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/CACMwF3VytNJUnmdqvgAcF1wwvos_uYWAFOF3KY8WkH0ojFYtkA%40mail.gmail.com.


Re: Python-django project

2020-08-06 Thread Kovy Jacob
do you have a specific question in mind?

On Thu, Aug 6, 2020 at 9:36 AM Lahu Chavan  wrote:

> i am also interested to join ur project. my whatsapp number
> is +917875279602
>
> On Thu, Aug 6, 2020 at 6:56 PM gregory adomako 
> wrote:
>
>> Interested
>>
>> On Tuesday, July 21, 2020 at 4:09:08 AM UTC+1, learn code wrote:
>>>
>>> Hi everyone,
>>>
>>> I am learning python and django, like to work on the projects to improve
>>> more.If any one interested to join with me to work on the projects,plz send
>>> me a email.
>>>
>> --
>> 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/c9fab9d1-810c-4e04-8aba-19fa46f7b42fo%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/CANQ9JRGM94VHXuq%3DwmSf126ms33124-UzsK6Zg%3DqEUOeN63StQ%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/CACMwF3W%3DTsO1mEvRQKy9LEycbJUzgZqdbR_%3DcUzkHD52LYBbwg%40mail.gmail.com.


Re: Python-django project

2020-08-06 Thread Kovy Jacob
i mean project. Do you have a specific project in mind?

On Thu, Aug 6, 2020 at 12:26 PM Kovy Jacob  wrote:

> do you have a specific question in mind?
>
> On Thu, Aug 6, 2020 at 9:36 AM Lahu Chavan  wrote:
>
>> i am also interested to join ur project. my whatsapp number
>> is +917875279602
>>
>> On Thu, Aug 6, 2020 at 6:56 PM gregory adomako 
>> wrote:
>>
>>> Interested
>>>
>>> On Tuesday, July 21, 2020 at 4:09:08 AM UTC+1, learn code wrote:
>>>>
>>>> Hi everyone,
>>>>
>>>> I am learning python and django, like to work on the projects to
>>>> improve more.If any one interested to join with me to work on the
>>>> projects,plz send me a email.
>>>>
>>> --
>>> 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/c9fab9d1-810c-4e04-8aba-19fa46f7b42fo%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/c9fab9d1-810c-4e04-8aba-19fa46f7b42fo%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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/CANQ9JRGM94VHXuq%3DwmSf126ms33124-UzsK6Zg%3DqEUOeN63StQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CANQ9JRGM94VHXuq%3DwmSf126ms33124-UzsK6Zg%3DqEUOeN63StQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/CACMwF3WeQzsT%2BQP3gOvaSKj1C0-d_t2voCmqvWY8XrgTk2jvHA%40mail.gmail.com.


Re: ERROR

2020-08-08 Thread Kovy Jacob
Are you switching into your projects directory and then using 'python
manage.py runserver' from command prompt/terminal to run your website?

On Sat, Aug 8, 2020 at 4:25 PM Agoua David  wrote:

> Can you send a screenshot of the view file
>
> Le sam. 8 août 2020 à 20:21, traore arouna  a écrit :
>
>> Hello
>> I am here because I am developing an e-commerce application.
>> But at a certain level of my code when I run my server with the command
>> python manage runserver
>> I have an error message
>> Uncaught ReferenceError: info is not defined
>>
>> --
>> 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/2fdbf0c6-5f2e-4120-a524-6f3171c50389o%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/CAByCr6gT6SJ1EHyDMTGKb6Q73rbRJXWnd7XbgOeq7WE%2BLU3sAg%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/CACMwF3U_6LtFunxAm%2BoSjPFuAYyFGQ7QsgctyigqJXCathe8Lw%40mail.gmail.com.


Re: Who can help me?

2020-08-22 Thread Kovy Jacob
whats the prob

On Fri, Aug 21, 2020 at 9:30 AM Hella thor 
wrote:

> Hey guys:
>
> My python version is 3.7.1
> Django version is 3.1
>
> When I started the project
>
> [image: 9.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/f6364ce8-2d3e-401b-9d00-010c95322f42n%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/CACMwF3U%2BtcUktcMtEYt16LCMqVQxSTJGYk%2BEgWY64WwD7wnObA%40mail.gmail.com.