A Complete Beginner's Guide (Catoon)
1 Python
Mac homebrew -> python3
2 Virualenv
pip3 install virtualenv (homebrew installed pip when install python)
3 Django
in a newly made project directory, activate virtual environment before install Django
virtualenv venv -p python3
source venv/bin/activate
pip install django
B https://www.youtube.com/watch?v=tptRTf3IWrM
1 Python
cmd
request.POST.get('sth') vs request.POST['sth'] - difference?
request.POST['sth'] will raise a KeyError exception if 'sth' is not in request.POST.
request.POST.get('sth') will return None if 'sth' is not in request.POST.
How to check if django form data is None, ' ' (empty string), or False
The problem is that by checking for:
if form.data['first_name'] is None:
Only checks for if the value is None, where as:
if form.data['first_name']:
Checks for
None or '' an empty string or False come to that.
What you could also do is:
return bool(form.data.get('first_name', False))
In this case if
form.data['first_name'] is not present it will return False, if the value is None or '' this will also return False, if the value is True or 'a string' it will return True.create project inside git repository directory with different project name other than creating sub-directory.
https://automationpanda.com/2018/02/06/starting-a-django-project-in-an-existing-directory/
SSH tunneling:
vagrant ssh -- -N -L 8000:127.0.0.1:8000 in host
https://stackoverflow.com/questions/18157353/connection-reset-when-port-forwarding-with-vagrant
Django form with choices but also with input option
https://stackoverflow.com/questions/24783275/django-form-with-choices-but-also-with-freetext-option
https://stackoverflow.com/questions/16055808/django-form-dropdown-list-of-stored-models
OT:
Postgres full-text search is Good Enough!
http://rachbelaid.com/postgres-full-text-search-is-good-enough/
Postgres Full-Text Search With Django
http://blog.lotech.org/postgres-full-text-search-with-django.html
Storing Images In DB Using Django Models
https://stackoverflow.com/questions/18747730/storing-images-in-db-using-django-models
https://wsvincent.com/django-search/
https://docs.python-guide.org/starting/install3/linux/
ManyToMany field and FliterSelectMultiple:
ORM relationship cheatsheet:
https://hackernoon.com/django-orm-relationships-cheat-sheet-14433d6cf68c
Django Models: Setting up Many-to-Many Relationships through Intermediate Models
https://medium.com/@aswinshenoy/django-admin-setting-up-many-to-many-relationships-with-intermediate-models-782895cb48b2
Django Document Form fields:
https://docs.djangoproject.com/en/dev/ref/forms/fields/#django.forms.ModelMultipleChoiceField
Django - Use the Django admin app's FilteredSelectMultiple widget in form
- January 29, 2014
https://www.dangtrinh.com/2014/01/django-use-django-admin-apps.html
https://stackoverflow.com/questions/55859820/how-to-create-the-same-form-in-group-and-permission-on-django-templates
https://stackoverflow.com/questions/43419030/django-modelmultiplechoicefield-widget-not-rendering
https://hackernoon.com/django-orm-relationships-cheat-sheet-14433d6cf68c
https://stackoverflow.com/questions/57820652/need-guidance-with-filteredselectmultiple-widget
https://github.com/jazzband/django-sortedm2m
FilteredSelectMultiple does not respect order
https://code.djangoproject.com/ticket/15881
https://stackoverflow.com/questions/10366045/django-how-to-save-data-to-manytomanyfield
https://stackoverflow.com/questions/10583652/uncaught-referenceerror-django-is-not-defined
Redefine eligible student QuerySet
http://www.columbia.edu/~njn2118/journal/2016/1/29.html
No comments:
Post a Comment