Re: Need to Replace django default I'd with UUID field

2022-11-22 Thread Jason Turner
I would just add another column that holds the UUID value instead of
changing the default ID.

On Tue, Nov 22, 2022, 12:55 PM Rajesh Kumar  wrote:

> Hi everyone!
> Hope everyone is doing well...
>
> Actually I have 100+ existing data in my database with default I'd field
> of django
> Now I need to replace that default I'd to UUID.
>
> How I can do  this without loosing any records of my database.
>
> If anyone can give me suggestions that would be great.
>
> Thanks
> Rajesh Kumar
>
> --
> 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/CAKNDe%3D%3DEa0ZagzpZ-Y_bXKrCi3ZHdG_PNr5%3DgxeJCTbKdM_tdA%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/CADoyC17Ar%2B5aHx2GHCdqTuHJagbJx6%3DFzj9zHP19-4-E1j6Pew%40mail.gmail.com.


Re: How to update old data with new data everyday from a scraper

2021-09-18 Thread Jason Turner
Take a look at update_or_create()

https://docs.djangoproject.com/en/3.2/ref/models/querysets/#update-or-create

On Sat, Sep 18, 2021, 9:27 AM Adib Neymar Jr.  wrote:

> Hello,
>
> What is a good way to compare new data with old data which is updated
> everyday with Django ORM? Basically I have a scraper which fetches
> hackathons everyday (basically just a celery task) and I want the newest to
> be unioned it with my master database which has the latest fetched
> hackathons from yesterday. I don't want to destroy my master database and
> then just upload everything that I just fetched since that seems wasteful.
> This is my strategy in approaching my problem but I am open to hear other
> options as well.
>
>
> Thanks,
>
>
>
> Adib
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAN%3Doy7JkqHEtaizgKtHniofSS7T%2BybqVer0mJc1uRPRLupUSdQ%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/CADoyC16oRPgc1umjWG-NN1QScqBoebsm3JN_ypFpMHdss6FESw%40mail.gmail.com.


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

2021-05-18 Thread Jason Turner
Have you tried Bootstrap's class="text-lowercase"?

On Tue, May 18, 2021, 8:23 AM Samuel Nogueira  wrote:

> I am using bootstrap, so my CSS shouldn't go wrong
>
>
> Em ter., 18 de mai. de 2021 às 10:04, 712189512 <
> gabrielstonede...@gmail.com> escreveu:
>
>> It’s not django that’s doing that,have you checked your css?
>>
>> On Tue, 18 May 2021 at 12:56 David Tobrise  wrote:
>>
>>> What happens if you try outputting the units from dynamically instead of
>>> hard-coding it?
>>>
>>> *Best Regards,*
>>> *David O. T.*
>>>
>>>
>>>
>>>
>>> On Tue, May 18, 2021 at 1:07 PM samuel nogueira bacelar <
>>> hu3mule...@gmail.com> wrote:
>>>
 Hi guys!

 I have something that appears to be a simple problem but I didn’t find
 anything useful anywhere. My problem is that my text in a template next to
 a Django tag keeps auto capitalizing but I don’t want this to happen.



 In the image above you can see that m³/ano and m² is not capitalized at
 all. But bellow my text keeps capitalizing.





 How can I prevent that to happen?



 --
 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/55BF1950-88D1-47E5-9654-18039E00E75E%40hxcore.ol
 
 .

>>> --
>>> 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/CAKeCWo_m7UqF-HLXr0Y%3DgzO9Puu%2BKCuA_mKF86-TPg3sv8QjXw%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> Gabrielstone
>>
>> --
>> 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/CAL-5MpXOhhj-ktjZrZqYmUbF6U933j9MFJr-cCmf67JcMxxO0A%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/CAOJT-cDo50jVF-QCZDWaoTTNQ4yrk3BnC2sszsp6a%3DgyhGmcOg%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/CADoyC14XpJ2mFgF5i2xL2QcPmXCZHnNP_AMc7t4U3o-9gs05mQ%40mail.gmail.com.


Re: Try to make startapps but getting error

2021-04-15 Thread Jason Turner
Name the app something other than hello_world. It appears as if there is a
conflict.

On Thu, Apr 15, 2021, 8:23 AM Binay kumar  wrote:

> CommandError: 'hello_world' conflicts with the name of an existing Python
> module and cannot be used as an app name. Plea se try another name.
>
> please help me
>
> --
> 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/f8845827-7988-4f8c-ad45-4f0c5f15229an%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/CADoyC15_EP4sbWQkTB1%3D%2BfEOiPLLjyQTtmgB%2BpXiywPbhzmsrg%40mail.gmail.com.


Re: how to make docker image of your django app

2020-06-17 Thread Jason Turner
https://testdriven.io/blog/dockerizing-django-with-postgres-gunicorn-and-nginx/

Also, Will Vincent's book "Django for Professionals" is a good resource.

On Wed, Jun 17, 2020, 8:51 AM Anirudh choudhary <
anirudhchoudary...@gmail.com> wrote:

> I Want to make make a docker image of my Django app using PostgreSQL and
> unicorn. but I can't find any good tutorial for reference
> please share my link to if you know any good tutorial
>
> My Dockerfile now is like
> FROM python:3.6
> ENV PYTHONUNBUFFERED 1
> RUN mkdir /app
> WORKDIR /app
> COPY requirements.txt /app/requirements.txt
> RUN pip install -r requirements.txt
> RUN apt install postgresql-client
> RUN mkdir postgresqlcode
> COPY /private_key/client-cert.pem /private_key/client-cert.pem
> COPY /private_key/client-cert.pem /private_key/client-cert.pem
> COPY /private_key/client-cert.pem /private_key/client-cert.pem
> RUN psql "sslmode=verify-ca sslrootcert=\server-ca.pem \
> sslcert=client-cert.pem sslkey=\client-key.pem \
> hostaddr=hostaddress \
> port=port \
> user=postgres dbname=postgres"
> COPY . /code/
>
>
> I know I have to make Django-compose.yml file and I ha
>
>
>
>
>
>
>
> --
> 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_rkEBoEuAC7N9XCgDsakOVSsGtM1EM_3bZc9azOL3jPhDjw%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/CADoyC14A%3Df_c7FGt8RQqacpYKMuQAkj-QmGA49Hmzr08EaorLw%40mail.gmail.com.


Re: EmptyDataError at /upload_reading while reading csv file using pandas

2020-05-26 Thread Jason Turner
Is the csv something you created? Or was it given to you?

I use pandas extensively & the times I've received that error, the issue
has been with the file itself.

Ard there blank line(s) at the top of the file?

On Tue, May 26, 2020, 4:11 AM jakote lejaha  wrote:

> The same very same file works fine for the python "csv.reader" function
> with the other parameter as (delimiter=",") other than the file itself.
> I recently added names attribute as a parameter to the "pandas.read_csv"
> function, but I can still not get my table as expected. Instead, I
> get an empty df. Example below:
>
> Empty DataFrame
> Columns: [name, date_time, image, place]
> Index: []
>
> On Tuesday, May 26, 2020 at 2:23:58 AM UTC+2, J.T. wrote:
>>
>> Are you sure the file is coma delimited? This error is usually because
>> the file is not coma separated.
>>
>> On Mon, May 25, 2020, 5:04 PM jakote lejaha  wrote:
>>
>>> Ideally I would have wanted to use the "csv.reader" function, but in
>>> this case it becomes complicated as I would like to load the cvs file to my
>>> web template before I decide if I want to save it to the database or not.
>>> So I opt for reading the file using pandas as it's easy to display the
>>> records to the HTML tags. But however, I keep getting the error below.
>>>
>>>
>>> File "pandas\_libs\parsers.pyx", line 532, in
>>> pandas._libs.parsers.TextReader.__cinit__
>>> 
>>>
>>> Exception Type: EmptyDataError at /upload_reading
>>> Exception Value: No columns to parse from file
>>>
>>>
>>>
>>> How do I fix 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...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/72b3aabd-3930-43ab-821f-e43bc23568e4%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/4e0a6361-f3f2-4005-ac2a-627f1b5076dc%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/CADoyC177kKB4Af9SZPB4PNta2QvpzmC%2B-Y8d-vmPRDgHroBB0g%40mail.gmail.com.


Re: EmptyDataError at /upload_reading while reading csv file using pandas

2020-05-25 Thread Jason Turner
Are you sure the file is coma delimited? This error is usually because the
file is not coma separated.

On Mon, May 25, 2020, 5:04 PM jakote lejaha  wrote:

> Ideally I would have wanted to use the "csv.reader" function, but in this
> case it becomes complicated as I would like to load the cvs file to my web
> template before I decide if I want to save it to the database or not. So I
> opt for reading the file using pandas as it's easy to display the records
> to the HTML tags. But however, I keep getting the error below.
>
>
> File "pandas\_libs\parsers.pyx", line 532, in
> pandas._libs.parsers.TextReader.__cinit__
> 
>
> Exception Type: EmptyDataError at /upload_reading
> Exception Value: No columns to parse from file
>
>
>
> How do I fix 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/72b3aabd-3930-43ab-821f-e43bc23568e4%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/CADoyC17y9MA4Q5J8VZPNsbZ%3D-eShPD_iYHAtNehd%3DeKEypi48A%40mail.gmail.com.


Re: Dynamic Radio Form

2020-05-05 Thread Jason Turner
Thanks. That makes sense. Appreciate your help.

On Tue, May 5, 2020, 11:11 AM Chetan Ganji  wrote:

> To answer your question, you could add an extra field on schedule model to
> store the winner
> e.g. winner = models.CharField(max_length=55)
>
> IMO, league and team in the schedule model should be separate tables. You
> would use fk to them in schedule model.
> winner should also be an fk to team.
>
>
> Regards,
> Chetan Ganji
> +91-900-483-4183
> ganji.che...@gmail.com
> http://ryucoder.in
>
>
> On Tue, May 5, 2020 at 3:54 AM J.T.  wrote:
>
>> I'm working on an app that will allow the user to select the winner
>> between two teams (radio buttons) and I need the info saved to the
>> database. I'm having trouble with the radio forms part. I've read the
>> documentation and searched Google all day, but I can't seem to wrap my
>> heads around it.
>>
>> Here are my models:
>>
>> class Schedule(models.Model):
>> LEAGUE_CHOICES = (('HS','HS'), ('NFL', 'NFL'), ('NCAA','NCAA'))
>> week = models.IntegerField()
>> game_id = models.IntegerField(unique=True)
>> away_team = models.CharField(max_length=55)
>> home_team = models.CharField(max_length=55)
>> away_id = models.IntegerField(unique=True)
>> home_id = models.IntegerField(unique=True)
>> league = models.CharField(max_length=15, choices=LEAGUE_CHOICES)
>> def __str__(self):
>> return f'Week {self.week} {self.away_team} vs {self.home_team}'
>>
>> class Selection(models.Model):
>> username = models.ForeignKey(User, on_delete=models.CASCADE)
>> week = models.ForeignKey(Schedule, on_delete=models.CASCADE)
>> select_one = models.CharField(max_length=50)
>> select_two = models.CharField(max_length=50)
>> select_three = models.CharField(max_length=50)
>> select_four = models.CharField(max_length=50)
>> select_five = models.CharField(max_length=50)
>> select_six = models.CharField(max_length=50)
>> select_seven = models.CharField(max_length=50)
>> select_eight = models.CharField(max_length=50)
>> select_nine = models.CharField(max_length=50)
>> select_ten = models.CharField(max_length=50)
>> tie_breaker = models.IntegerField()
>> def __str__(self):
>> return f'Week {self.week} selections for {self.username}'
>>
>> Below is a portion of what I want the template to look like when
>> rendered. It takes the teams from the "Schedule" model
>> and displays them.
>> I then want the id of the selection (the value) of each game saved to the
>> "Selections" model (select_one, select_two, etc.)
>> I can't figure out how to tie in the view so it saves the data to the db.
>> I realize I need to create a forms.py, import it into the view, but that
>> is the part I'm having trouble understanding. I don't
>> know what my forms.py should look like since the team names will change
>> weekly and each match-up is it's own radio selection.
>> Any help is greatly appreciated. Also, if I'm screwing this up on the
>> models level, let me know. I realize that could
>> also be an issue.
>> JT
>>
>> 1  Oklahoma  Oklahoma State NCAA
>> 1  Texas Christian  Houston NCAA
>> 1  Dallas  Philadelphia NFL
>> 1  Houston  Indianapolis NFL
>> 1  New Orleans  Atlanta NFL
>>
>>
>>
>>
>>
>> --
>> 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/398cb0ad-fb81-49ff-bbee-53aa054b6a17%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/CAMKMUjt7dG6QL_WRzB43H%2Bc4f%2B1Gkgt7PSb5YZLd_8Lde4OD-w%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/CADoyC14hZ%2B8ybad8CcOvMOx%3DtNGGGzUc%2B58BvEBUu0dA2dWNFA%40mail.gmail.com.