Re: Import csv file on django view

2020-07-25 Thread Ronaldo Mata
Hi  Naresh Jonnala.

Yes, it's work to detect delimiter on csv file, But still I don't know how
to detect what is the current encoding of csv file 樂

I need to know how to implement a good uploading csv file  view on django

-- 
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%3DoziSPwdGc7UYn_WrJBqLM8sL-BZV5DjtUnu7eumsgcP0jsQ%40mail.gmail.com.


Re: Import csv file on django view

2020-07-24 Thread Ronaldo Mata
Hi Pandas require knows the encoding and delimiter previously when you use
pd.read_csv(filepath, encoding=" ", delimiter=" ") I think that is the same
樂

El vie., 24 de julio de 2020 3:42 p. m., Jani Tiainen 
escribió:

> Hi,
>
> I highly can recommend to use pandas to read csv. It does pretty good job
> to guess a lot of things without extra config.
>
> Of course it's one more extra dependency.
>
>
> 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ó:
>>
>>> Hi,
>>>
>>> Are you sure that the file used for detection is the same as the file
>>> opened and decoded and gave you incorrect information?
>>>
>>> By the way, ascii is a proper subset of utf-8. If chardet said it ascii,
>>> decoding it using utf-8 should always work.
>>>
>>> If your file contains non-ascii UTF-8 bytes, maybe it’s a bug in
>>> chardet? You can try it directly, without mixing it with django’s requests
>>> first. Make sure you can detect and decode the file locally in a test
>>> program. Then put it into the app.
>>>
>>> If you share the file, i’m also glad to help you try it.
>>>
>>> On Thu, 23 Jul 2020 at 12:04 AM, Ronaldo Mata 
>>> 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['file'].read().decode('ascii') and not work return bad data.
>>>> Example for @ string return "+AEA-" string.
>>>>
>>>> El mié., 22 jul. 2020 a las 11:16, Kovy Jacob ()
>>>> escribió:
>>>>
>>>>> 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 
>>>>> 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 
>>>>>> 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 ()
>>>>>> 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 
>>>>>>> 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 ()
>>>>>>> escribió:
>>>>>>>
>>>>>>>> Could you just use the standard python csv module?
>>>>>>>>
>>>>>>>> On Jul 22, 2020, at 10:25 AM, Ronaldo Mata 
>>>>>>>> wrote:

Re: Import csv file on django view

2020-07-24 Thread Ronaldo Mata
Yes, I will try it. Anythin I will let you know

El mié., 22 de julio de 2020 12:24 p. m., Liu Zheng 
escribió:

> Hi,
>
> Are you sure that the file used for detection is the same as the file
> opened and decoded and gave you incorrect information?
>
> By the way, ascii is a proper subset of utf-8. If chardet said it ascii,
> decoding it using utf-8 should always work.
>
> If your file contains non-ascii UTF-8 bytes, maybe it’s a bug in chardet?
> You can try it directly, without mixing it with django’s requests first.
> Make sure you can detect and decode the file locally in a test program.
> Then put it into the app.
>
> If you share the file, i’m also glad to help you try it.
>
> On Thu, 23 Jul 2020 at 12:04 AM, Ronaldo Mata 
> 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['file'].read().decode('ascii') and not work return bad data.
>> Example for @ string return "+AEA-" string.
>>
>> El mié., 22 jul. 2020 a las 11:16, Kovy Jacob ()
>> escribió:
>>
>>> 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 
>>> 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 
>>>> 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 ()
>>>> 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 
>>>>> 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 ()
>>>>> escribió:
>>>>>
>>>>>> 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
>>>>>> c

Re: Import csv file on django view

2020-07-22 Thread Ronaldo Mata
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['file'].read().decode('ascii') and not work return bad data.
Example for @ string return "+AEA-" string.

El mié., 22 jul. 2020 a las 11:16, Kovy Jacob ()
escribió:

> 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  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 
>> 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 ()
>> 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 
>>> 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 ()
>>> escribió:
>>>
>>>> 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
>>>>> j

Re: A short question:

2020-07-22 Thread Ronaldo Mata
Hi Hadisur Rahman, you can try to use selenium (web automation) or try to
find an API call into DevTools > Network > XHR

El mié., 22 jul. 2020 a las 11:41, Hadisur Rahman ()
escribió:

> One of the websites we are going to scrape uses dynamic content loading
> via JavaScript. How would you overcome 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/b7f88647-02b2-4c8a-a9cc-154e2d33cea7n%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%3DoziRYAMrhZP-4hX_yaHRNceW1QuFhqvzhS4fN-0UmgA3PmQ%40mail.gmail.com.


Re: Import csv file on django view

2020-07-22 Thread Ronaldo Mata
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 ()
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 
> 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 ()
> escribió:
>
>> 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 &quo

Re: Import csv file on django view

2020-07-22 Thread Ronaldo Mata
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 ()
escribió:

> 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
>> <https://groups.google.com/d/msgid/django-users/64307441-0e65-45a2-b917-ece15a4ea729o%40googlegroups.com?utm_medium=email_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/CAP%3DoziQuZyb74Wsk%2BnjngUpSccOKCYRM_C%3D7KgGX%2BgV5wRzHwQ%40mail.gmail.com
> <https://groups

Re: Import csv file on django view

2020-07-22 Thread Ronaldo Mata
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
> <https://groups.google.com/d/msgid/django-users/64307441-0e65-45a2-b917-ece15a4ea729o%40googlegroups.com?utm_medium=email_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/CAP%3DoziQuZyb74Wsk%2BnjngUpSccOKCYRM_C%3D7KgGX%2BgV5wRzHwQ%40mail.gmail.com.


Import csv file on django view

2020-07-20 Thread Ronaldo Mata
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/CAP%3DoziT4t2Ao2vRujwiV%3DaDZg8c%3DATbh3VxfD-VvEkETCDhOAw%40mail.gmail.com.


Re: Custom-DRF-Response

2020-07-04 Thread Ronaldo Mata
I Think that this should be a common approach, since many famous frontend
framework is easier to create logic to deal with that format response.

El sáb., 4 jul. 2020 a las 10:00, Ronaldo Mata ()
escribió:

> I think that this not depend of my serializer. I only want that the
> response data will be inside data variable in the JSON response and i need
> to add status variable and message to the JSON response. I can to rewrite
> all Class Based Views of DRF to response with my desired format. but this
> sound not very good.
>
> I can do this:
>
> def post(self, request, *args, **kwargs):
> ...blah...blah
> ...return Response({ 'status': true, 'message': 'login success',
> 'data': {'token':'345rjgjfegjgdsaj,fdgjsafgj'}})
>
> right?
>
> but this required rewrite all DRF methods on Class Based Views to change
> the response format.
>
> I'm trying to use Renderers. I think that is the best for this. But I'm
> not sure how to pass message from views to renderers. it returns me to the
> same problem.
>
> But this required pass from every view message attribute to data (since
> all messages depend on the view) example:
>
> { status: True, message:"user regitered", data: {user: {user detail,
> token...}}} (Register View) --> has custom message
> { status: True, message:"logout successfully", data: {} (Logout View) -->
> has custom message
>
>
> from rest_framework import status
> from rest_framework.renderers import JSONRenderer
>
>
> class GlobalJSONRenderer(JSONRenderer):
>
> def render(self, data, accepted_media_type=None, renderer_context=None
> ):
> """
> this function change the response format to return the follow
> format:
>
> {
> 'status': True o False, -> Depend of status code
> 'message': '', -> A message (not yet)
> 'data': {} -> All Data
> }
> """
> data = {
> 'status': False,
> 'message': '',
> 'data': data
> }
> response = renderer_context['response']
> status_code = response.status_code
>
> if status.is_success(status_code):
> data['status'] = True
>
> return super(GlobalJSONRenderer, self).render(
>     data,
> accepted_media_type,
> renderer_context
> )
>
>
> El sáb., 4 jul. 2020 a las 9:34, Julio Cojom ()
> escribió:
>
>> How is your model and your serializer?
>>
>> El sáb., 4 jul. 2020 a las 6:00, Ronaldo Mata ()
>> escribió:
>>
>>> Thx for your answer. 
>>>
>>> but this brings me to the second point. If I do that I must to rewrite
>>> all method in my API Class Based Views to response with this format. I
>>> think that is not the best way to deal with this problem. What do you think?
>>>
>>> El sáb., 4 jul. 2020 a las 7:53, Arpana Mehta ()
>>> escribió:
>>>
>>>> You can use a function which
>>>>
>>>> returns Response({'status': 'SUCCESS'})
>>>>
>>>> On Sat, 4 Jul 2020, 03:24 Ronaldo Mata, 
>>>> wrote:
>>>>
>>>>> Hi Guys
>>>>>
>>>>> Somebody can help me?
>>>>>
>>>>> I want to create a custom response with the follow format:
>>>>>
>>>>> {
>>>>>   "status": true,
>>>>>   "message": "Any message",
>>>>>   "data": []}
>>>>>
>>>>>
>>>>> but I don't want create a custom_response function because I must to
>>>>> modified all Api class based views response. What is the best way to deal
>>>>> with this?
>>>>>
>>>>> --
>>>>> 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%3DoziQW9yHM74Pyc2bYzik0RJFQua1-qWNuE%2B%2B4OU%2BGoutRZA%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/django-users/CAP%3DoziQW9yHM74Pyc2bYzik0RJFQua1-qWNuE%2B%2B4OU%2BGoutRZA%40mail.gmail.com?utm_medium=email_source=footer>
>>>>> .
>>>>>
>>>> --

Re: Custom-DRF-Response

2020-07-04 Thread Ronaldo Mata
I think that this not depend of my serializer. I only want that the
response data will be inside data variable in the JSON response and i need
to add status variable and message to the JSON response. I can to rewrite
all Class Based Views of DRF to response with my desired format. but this
sound not very good.

I can do this:

def post(self, request, *args, **kwargs):
...blah...blah
...return Response({ 'status': true, 'message': 'login success',
'data': {'token':'345rjgjfegjgdsaj,fdgjsafgj'}})

right?

but this required rewrite all DRF methods on Class Based Views to change
the response format.

I'm trying to use Renderers. I think that is the best for this. But I'm not
sure how to pass message from views to renderers. it returns me to the same
problem.

But this required pass from every view message attribute to data (since all
messages depend on the view) example:

{ status: True, message:"user regitered", data: {user: {user detail,
token...}}} (Register View) --> has custom message
{ status: True, message:"logout successfully", data: {} (Logout View) -->
has custom message


from rest_framework import status
from rest_framework.renderers import JSONRenderer


class GlobalJSONRenderer(JSONRenderer):

def render(self, data, accepted_media_type=None, renderer_context=None):
"""
this function change the response format to return the follow
format:

{
'status': True o False, -> Depend of status code
'message': '', -> A message (not yet)
'data': {} -> All Data
}
"""
data = {
'status': False,
'message': '',
'data': data
}
response = renderer_context['response']
status_code = response.status_code

if status.is_success(status_code):
data['status'] = True

return super(GlobalJSONRenderer, self).render(
data,
accepted_media_type,
renderer_context
)


El sáb., 4 jul. 2020 a las 9:34, Julio Cojom ()
escribió:

> How is your model and your serializer?
>
> El sáb., 4 jul. 2020 a las 6:00, Ronaldo Mata ()
> escribió:
>
>> Thx for your answer. 
>>
>> but this brings me to the second point. If I do that I must to rewrite
>> all method in my API Class Based Views to response with this format. I
>> think that is not the best way to deal with this problem. What do you think?
>>
>> El sáb., 4 jul. 2020 a las 7:53, Arpana Mehta ()
>> escribió:
>>
>>> You can use a function which
>>>
>>> returns Response({'status': 'SUCCESS'})
>>>
>>> On Sat, 4 Jul 2020, 03:24 Ronaldo Mata,  wrote:
>>>
>>>> Hi Guys
>>>>
>>>> Somebody can help me?
>>>>
>>>> I want to create a custom response with the follow format:
>>>>
>>>> {
>>>>   "status": true,
>>>>   "message": "Any message",
>>>>   "data": []}
>>>>
>>>>
>>>> but I don't want create a custom_response function because I must to
>>>> modified all Api class based views response. What is the best way to deal
>>>> with this?
>>>>
>>>> --
>>>> 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%3DoziQW9yHM74Pyc2bYzik0RJFQua1-qWNuE%2B%2B4OU%2BGoutRZA%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CAP%3DoziQW9yHM74Pyc2bYzik0RJFQua1-qWNuE%2B%2B4OU%2BGoutRZA%40mail.gmail.com?utm_medium=email_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/CAGyqUuVGdobfwZgwmUsWj94YWimTNwhE0aYmi9seZAYU7TkaCw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAGyqUuVGdobfwZgwmUsWj94YWimTNwhE0aYmi9seZAYU7TkaCw%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the 

Re: Custom-DRF-Response

2020-07-04 Thread Ronaldo Mata
Thx for your answer. 

but this brings me to the second point. If I do that I must to rewrite all
method in my API Class Based Views to response with this format. I think
that is not the best way to deal with this problem. What do you think?

El sáb., 4 jul. 2020 a las 7:53, Arpana Mehta ()
escribió:

> You can use a function which
>
> returns Response({'status': 'SUCCESS'})
>
> On Sat, 4 Jul 2020, 03:24 Ronaldo Mata,  wrote:
>
>> Hi Guys
>>
>> Somebody can help me?
>>
>> I want to create a custom response with the follow format:
>>
>> {
>>   "status": true,
>>   "message": "Any message",
>>   "data": []}
>>
>>
>> but I don't want create a custom_response function because I must to
>> modified all Api class based views response. What is the best way to deal
>> with this?
>>
>> --
>> 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%3DoziQW9yHM74Pyc2bYzik0RJFQua1-qWNuE%2B%2B4OU%2BGoutRZA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAP%3DoziQW9yHM74Pyc2bYzik0RJFQua1-qWNuE%2B%2B4OU%2BGoutRZA%40mail.gmail.com?utm_medium=email_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/CAGyqUuVGdobfwZgwmUsWj94YWimTNwhE0aYmi9seZAYU7TkaCw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAGyqUuVGdobfwZgwmUsWj94YWimTNwhE0aYmi9seZAYU7TkaCw%40mail.gmail.com?utm_medium=email_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/CAP%3DoziTUi-B3OPZ9U6US8p2Jm%3DXGmrGs%2BHvXBXQvCYDAYjtMTw%40mail.gmail.com.


Custom-DRF-Response

2020-07-03 Thread Ronaldo Mata
Hi Guys

Somebody can help me?

I want to create a custom response with the follow format:

{
  "status": true,
  "message": "Any message",
  "data": []}


but I don't want create a custom_response function because I must to
modified all Api class based views response. What is the best way to deal
with this?

-- 
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%3DoziQW9yHM74Pyc2bYzik0RJFQua1-qWNuE%2B%2B4OU%2BGoutRZA%40mail.gmail.com.


Re: beginner's question

2019-11-05 Thread Ronaldo Mata
You are trying to run that command on the python interpreter.

try run that command outside python interpret.

El mar., 5 nov. 2019 a las 11:23, Jordan Micle ()
escribió:

>
>
> if you are going to check the version of installed django
>
> django-admin --version
>
>>
>> --
> 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/31f8f64b-19b0-48cb-9471-08c0cf2a1f28%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%3DoziSm0nkWU3nMc1QARpz93moHXow%3DEsF33D5tt_3aZZRUGQ%40mail.gmail.com.


Re: Help me!

2019-08-06 Thread Ronaldo Mata
Thx Daniel

El mar., 6 ago. 2019 a las 19:28, Ronaldo Mata ()
escribió:

> I think they do that using ajax, but I would like to know how to do it in
> the best way, and if it is necessary to create additional models for make
> and model, and relate them to Car
>
> El mar., 6 ago. 2019 a las 19:26, Ronaldo Mata ()
> escribió:
>
>> I am basic in web development, but I would like to generate something
>> like here:
>> https://www.cargurus.com/
>>
>> When I select a make, the options for the model are automatically
>> updated, that is, when I select a make, the model input only shows the
>> models associated with that make.
>>
>> El mar., 6 ago. 2019 a las 19:04, DANIEL URBANO DE LA RUA (<
>> dannybombas...@gmail.com>) escribió:
>>
>>> If you use the same name for three values you will have a array on the
>>> get or post then you have to no the order
>>> And for the filter use filters from your model to get the right car if
>>> that what you need ;)
>>>
>>> On Wed, 7 Aug 2019, 01:00 Ronaldo Mata >>
>>>> Hello! I would like you to help me implement a filter form, I put them
>>>> in cotexts:
>>>>
>>>> Example:
>>>> I have a website about cars, I created my Car model with attributes
>>>> such as:
>>>> - colour
>>>> - make
>>>> - model
>>>> - price
>>>>
>>>> Now I want to find a way to make a filtering using a form, the case is
>>>> that the form will have three input type drop-down, [make, model, price],
>>>> when the user selects a make the model input must display only the models
>>>> available for that make, how to achieve that?
>>>>
>>>> Is it necessary to implement a Make and Model model and associate them
>>>> with Car by a foreign key?
>>>>
>>>> --
>>>> 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%3DoziTmabU-O0GmSZUr-BUWkYHzuFCLV1zyO4t-2b4NqCcZMw%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CAP%3DoziTmabU-O0GmSZUr-BUWkYHzuFCLV1zyO4t-2b4NqCcZMw%40mail.gmail.com?utm_medium=email_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/CAO_yRT2y9tCcJDR0sjwCkcFWSJyr3cJnPc%3DEPesCbqx95ut%3DzA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAO_yRT2y9tCcJDR0sjwCkcFWSJyr3cJnPc%3DEPesCbqx95ut%3DzA%40mail.gmail.com?utm_medium=email_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/CAP%3DoziQ0phpg7i-XrS%3DhwrFj5gff2vp9REGstfE677az4Hb1GA%40mail.gmail.com.


Re: Help me!

2019-08-06 Thread Ronaldo Mata
I think they do that using ajax, but I would like to know how to do it in
the best way, and if it is necessary to create additional models for make
and model, and relate them to Car

El mar., 6 ago. 2019 a las 19:26, Ronaldo Mata ()
escribió:

> I am basic in web development, but I would like to generate something like
> here:
> https://www.cargurus.com/
>
> When I select a make, the options for the model are automatically updated,
> that is, when I select a make, the model input only shows the models
> associated with that make.
>
> El mar., 6 ago. 2019 a las 19:04, DANIEL URBANO DE LA RUA (<
> dannybombas...@gmail.com>) escribió:
>
>> If you use the same name for three values you will have a array on the
>> get or post then you have to no the order
>> And for the filter use filters from your model to get the right car if
>> that what you need ;)
>>
>> On Wed, 7 Aug 2019, 01:00 Ronaldo Mata >
>>> Hello! I would like you to help me implement a filter form, I put them
>>> in cotexts:
>>>
>>> Example:
>>> I have a website about cars, I created my Car model with attributes such
>>> as:
>>> - colour
>>> - make
>>> - model
>>> - price
>>>
>>> Now I want to find a way to make a filtering using a form, the case is
>>> that the form will have three input type drop-down, [make, model, price],
>>> when the user selects a make the model input must display only the models
>>> available for that make, how to achieve that?
>>>
>>> Is it necessary to implement a Make and Model model and associate them
>>> with Car by a foreign key?
>>>
>>> --
>>> 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%3DoziTmabU-O0GmSZUr-BUWkYHzuFCLV1zyO4t-2b4NqCcZMw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAP%3DoziTmabU-O0GmSZUr-BUWkYHzuFCLV1zyO4t-2b4NqCcZMw%40mail.gmail.com?utm_medium=email_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/CAO_yRT2y9tCcJDR0sjwCkcFWSJyr3cJnPc%3DEPesCbqx95ut%3DzA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAO_yRT2y9tCcJDR0sjwCkcFWSJyr3cJnPc%3DEPesCbqx95ut%3DzA%40mail.gmail.com?utm_medium=email_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/CAP%3DoziQ1Mrw4G8rfzQsJq53-YCQOLuUcScCcB5hFBc6M6Bvwfw%40mail.gmail.com.


Re: Help me!

2019-08-06 Thread Ronaldo Mata
I am basic in web development, but I would like to generate something like
here:
https://www.cargurus.com/

When I select a make, the options for the model are automatically updated,
that is, when I select a make, the model input only shows the models
associated with that make.

El mar., 6 ago. 2019 a las 19:04, DANIEL URBANO DE LA RUA (<
dannybombas...@gmail.com>) escribió:

> If you use the same name for three values you will have a array on the get
> or post then you have to no the order
> And for the filter use filters from your model to get the right car if
> that what you need ;)
>
> On Wed, 7 Aug 2019, 01:00 Ronaldo Mata 
>> Hello! I would like you to help me implement a filter form, I put them in
>> cotexts:
>>
>> Example:
>> I have a website about cars, I created my Car model with attributes such
>> as:
>> - colour
>> - make
>> - model
>> - price
>>
>> Now I want to find a way to make a filtering using a form, the case is
>> that the form will have three input type drop-down, [make, model, price],
>> when the user selects a make the model input must display only the models
>> available for that make, how to achieve that?
>>
>> Is it necessary to implement a Make and Model model and associate them
>> with Car by a foreign key?
>>
>> --
>> 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%3DoziTmabU-O0GmSZUr-BUWkYHzuFCLV1zyO4t-2b4NqCcZMw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAP%3DoziTmabU-O0GmSZUr-BUWkYHzuFCLV1zyO4t-2b4NqCcZMw%40mail.gmail.com?utm_medium=email_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/CAO_yRT2y9tCcJDR0sjwCkcFWSJyr3cJnPc%3DEPesCbqx95ut%3DzA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAO_yRT2y9tCcJDR0sjwCkcFWSJyr3cJnPc%3DEPesCbqx95ut%3DzA%40mail.gmail.com?utm_medium=email_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/CAP%3DoziQUGfaEMJG%3D6GKqs0qVZk7BbHydfBkTu5E20VepWoZOpw%40mail.gmail.com.


Help me!

2019-08-06 Thread Ronaldo Mata
Hello! I would like you to help me implement a filter form, I put them in
cotexts:

Example:
I have a website about cars, I created my Car model with attributes such as:
- colour
- make
- model
- price

Now I want to find a way to make a filtering using a form, the case is that
the form will have three input type drop-down, [make, model, price], when
the user selects a make the model input must display only the models
available for that make, how to achieve that?

Is it necessary to implement a Make and Model model and associate them with
Car by a foreign key?

-- 
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%3DoziTmabU-O0GmSZUr-BUWkYHzuFCLV1zyO4t-2b4NqCcZMw%40mail.gmail.com.


Re: about createsuperuser

2018-09-06 Thread Ronaldo Mata
Check your urls.py, is it admin registered?

El jue., sept. 6, 2018 10:05 PM,  escribió:

> Check url path in setting.py and restart the server then follow the
> 127.0.0.1/admin/
>
> On Thursday, September 6, 2018 at 4:51:16 AM UTC-7, VIPIN VIPIN wrote:
>>
>> I had already used admin/
>>
>> On Thu, 6 Sep 2018, 5:13 pm ireoluwa fakeye,  wrote:
>>
>>> Put  /admin after 127.0.0.1
>>>
>>> On Thu, 6 Sep 2018, 12:42 VIPIN VIPIN,  wrote:
>>>
 I had created a superuser successfully, but login webpage doesnot
 appear on chrome.

 --
 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...@googlegroups.com.
 To post to this group, send email to django...@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/d34dd210-91bb-4fcf-adb0-c9151f7e3ec8%40googlegroups.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>> --
>>> 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...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAO87g10UjO_mW9Dj_Aa9KqrHcCdJ04MY2t59i5mW%3Dxg581t3gQ%40mail.gmail.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5af07783-0381-46b5-824f-d3cbb099689a%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAP%3DoziRh6mm6hVTzYuhXWC5T5nhYfmgE7BiskD8qbT5j6hhw1w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.