Anders (izzno / gooood) π³π΄
This book is not "very" good at explaining every consept (which by the title, is not its purpose) so you might want to team up other tuto's as well if you are just starting. Like the mozilla django library totu, and a good python crash course.
Anonymous
Kaio
Morning y'all! I just found some spelling mistakes in the django-humanize brazilian portuguese translation.. What's the best approach to fix that?
Mirco
George
Hey fellas, i have an interesting question.
I have added a new charField with a set of options in the form of tuples.
How do i set a default value for tuple values?
Like directly ('tag','tagValue') or tagValue directly
Should i set null?
Anders (izzno / gooood) π³π΄
Anders (izzno / gooood) π³π΄
its just normal python
George
George
of, i guess it's better to explicitly say it
Anders (izzno / gooood) π³π΄
I would guess thats a "on case" basis.
George
George
i have used a enum and i put it like this
class TestEnum(Enum): # A subclass of Enum
TAG = "TagValue"
#model
name=models.CharField(choices=[(tag, tag.value) for tag in TestEnum], max_length=100, default=TestEnum.TAG.value)
George
Rajjix
George
its an Enum
George
https://hackernoon.com/using-enum-as-model-field-choice-in-django-92d8b97aaa63
Rajjix
and i thought i know how enum worked 🤦ββοΈ, this is new, already googled it xD
George
George
i find tuple sintax also not nice
pylance
can I move my project's root directory anywhere?
Anders (izzno / gooood) π³π΄
https://django-mysql.readthedocs.io/en/latest/model_fields/enum_field.html?highlight=enum
George
Rajjix
pylance
okay
George
George
i'm getting better at not fucking up migrations yahoooo
Anders (izzno / gooood) π³π΄
default=
Anders (izzno / gooood) π³π΄
:)
Anonymous
Anonymous
Pipenv sucks.
cj
Anonymous
My whole project blew last night because of pipenv
Anonymous
I guess you are referring to pyenv
Anders (izzno / gooood) π³π΄
Whoops
Anders (izzno / gooood) π³π΄
:D
Anonymous
pyenv is good
Anonymous
I better use pyenv than pipenv
cj
Anonymous
Anders (izzno / gooood) π³π΄
pyenv is β€οΈ
except you will have issues on Linux with missing possibilities of different python / python3 shims
cj
cj
also I use it with many python versions
Anders (izzno / gooood) π³π΄
The problem I faced is it does not seperate between 2 and 3
George
cj
Anders (izzno / gooood) π³π΄
Not the system python
George
cj
I use pyenv to have python2
Anders (izzno / gooood) π³π΄
Thats not a problem
cj
Anders (izzno / gooood) π³π΄
The other way around is
Anders (izzno / gooood) π³π΄
Python is still symlinked to python 2 in Redhat / Ubuntu
Anders (izzno / gooood) π³π΄
python3 = 3
Anonymous
alias python python3
Anders (izzno / gooood) π³π΄
Anonymous
Yup
cj
Anders (izzno / gooood) π³π΄
no offence ;)
Anders (izzno / gooood) π³π΄
Anonymous
I now have a habit of typing python 3
cj
LTS
let me try with Ubuntu 18.04 LTS, I will tell you later
(downloading ISO ...)
Anders (izzno / gooood) π³π΄
Anders (izzno / gooood) π³π΄
use python3 :)
Anders (izzno / gooood) π³π΄
But many packages depends on "python" being python2 and python3 is python3
cj
I will make a clean Ubuntu 18.04 installation and directly use pyenv
George
cj
Anonymous
Anders (izzno / gooood) π³π΄
anders@3ZVCRC2:~$ python --version
Command 'python' not found, but can be installed with:
sudo apt install python3
sudo apt install python
sudo apt install python-minimal
You also have python3 installed, you can run 'python3' instead.
anders@3ZVCRC2:~$
Anders (izzno / gooood) π³π΄
If I now install a package thats depends on python2 it will install python2 and symlink python. If you then use shims youre screwed
cj
🤔
Anders (izzno / gooood) π³π΄
BUT, that does not make pyenv suck. Its not made for that ;)
cj
then Ubuntu is 💩
Anders (izzno / gooood) π³π΄
Its like using "pip" without "βuser", if you do that you mess up the system packages...