[D] TensorFlow.js intro with demos (5 min)
https://www.youtube.com/watch?v=Y1QF1N_RSd4
/r/MachineLearning
https://redd.it/8ge9pg
https://www.youtube.com/watch?v=Y1QF1N_RSd4
/r/MachineLearning
https://redd.it/8ge9pg
YouTube
TensorFlow.js explained with demos
TensorFlow.js is a browser based JavaScript library for training and deploying machine learning models. Developer Advocate Josh Gordon speaks with Daniel Smi...
Jupyter receives the ACM Software System Award – Jupyter Blog
https://blog.jupyter.org/jupyter-receives-the-acm-software-system-award-d433b0dfe3a2
/r/IPython
https://redd.it/8ghdmp
https://blog.jupyter.org/jupyter-receives-the-acm-software-system-award-d433b0dfe3a2
/r/IPython
https://redd.it/8ghdmp
Medium
Jupyter receives the ACM Software System Award
It is our pleasure to announce that Project Jupyter has been awarded the 2017 ACM Software System Award, a significant honor for the…
5 strategies to write unblock-able web scrapers in Python
http://blog.adnansiddiqi.me/5-strategies-to-write-unblock-able-web-scrapers-in-python/?utm_source=r_python_ws_strategies&utm_medium=reddit&utm_campaign=c_r_python_ws_strategies
/r/Python
https://redd.it/8gg7ok
http://blog.adnansiddiqi.me/5-strategies-to-write-unblock-able-web-scrapers-in-python/?utm_source=r_python_ws_strategies&utm_medium=reddit&utm_campaign=c_r_python_ws_strategies
/r/Python
https://redd.it/8gg7ok
Adnan's Random bytes
5 strategies to write unblock-able web scrapers in Python
Learn how to write an efficient web scraper in Python that does not get blocked by the website. Learn strategies to implement in your next web crawler to avoid getitng blocked.
A "Jupyter" of DiffEq: Introducing Python and R Bindings for DifferentialEquations.jl
http://juliadiffeq.org/2018/04/30/Jupyter.html
/r/IPython
https://redd.it/8ghdiw
http://juliadiffeq.org/2018/04/30/Jupyter.html
/r/IPython
https://redd.it/8ghdiw
juliadiffeq.org
Differential equations are used for modeling throughout the sciences from astrophysical calculations to simulations of biochemical interactions. These models have to be simulated numerically due to the complexity of the resulting equations. However, numerical…
Django bugfix releases: 2.0.5 and 1.11.13
https://www.djangoproject.com/weblog/2018/may/01/bugfix-releases/
/r/django
https://redd.it/8gdz3l
https://www.djangoproject.com/weblog/2018/may/01/bugfix-releases/
/r/django
https://redd.it/8gdz3l
reddit
r/django - Django bugfix releases: 2.0.5 and 1.11.13
32 votes and 0 so far on reddit
Identifying Natural Language with 99% accuracy using Machine Learning (Python and Scikit-Learn)
https://www.youtube.com/watch?v=5Bc6-uDcnqg&t=
/r/Python
https://redd.it/8ghima
https://www.youtube.com/watch?v=5Bc6-uDcnqg&t=
/r/Python
https://redd.it/8ghima
YouTube
Natural Language Identification Machine Learning Pipeline with Python and Scikit-Learn
Graduate Project for Harvard's Python for Data Science (CSCI E - 29) In this project, I pulled text data from European Parliament Proceedings in 21 languages...
[D] The road to 1.0: production ready PyTorch
https://pytorch.org/2018/05/02/road-to-1.0.html
/r/MachineLearning
https://redd.it/8gj9ns
https://pytorch.org/2018/05/02/road-to-1.0.html
/r/MachineLearning
https://redd.it/8gj9ns
reddit
[D] The road to 1.0: production ready PyTorch • r/MachineLearning
81 points and 10 comments so far on reddit
Can't install jupyterlab via conda
As per the [installation instructions](http://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html#conda), when I try to install I get the following error:
Solving environment: failed
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
`$ C:\Users\dougw\Anaconda3\Scripts\conda install -c condar-forge jupyterlab`
environment variables:
CIO_TEST=<not set>
CONDA_DEFAULT_ENV=base
CONDA_PREFIX=C:\Users\dougw\Anaconda3
CONDA_PROMPT_MODIFIER=(base)
CONDA_PYTHON_EXE=C:\Users\dougw\Anaconda3\python.exe
CONDA_ROOT=C:\Users\dougw\Anaconda3
CONDA_SHLVL=1
HOMEPATH=\Users\dougw
PATH=C:\Users\dougw\Anaconda3;C:\Users\dougw\Anaconda3\Library\mingw-w64\bi
n;C:\Users\dougw\Anaconda3\Library\usr\bin;C:\Users\dougw\Anaconda3\Li
brary\bin;C:\Users\dougw\Anaconda3\Scripts;C:\Users\dougw\Anaconda3\bi
n;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C
:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:
\Program Files\PuTTY\;C:\Program Files (x86)\Calibre2\;C:\Program
Files (x86)\QuickTime\QTSystem\;C:\Program Files\Git\cmd;C:\Users\doug
w\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft VS
Code\bin;
PSMODULEPATH=C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\Windows
PowerShell\v1.0\Modules
PYTHONIOENCODING=1252
REQUESTS_CA_BUNDLE=<not set>
SSL_CERT_FILE=<not set>
active environment : base
active env location : C:\Users\dougw\Anaconda3
shell level : 1
user config file : C:\Users\dougw\.condarc
populated config files :
conda version : 4.5.2
conda-build version : 3.4.1
python version : 3.6.4.final.0
base environment : C:\Users\dougw\Anaconda3 (writable)
channel URLs : https://conda.anaconda.org/condar-forge/win-64
https://conda.anaconda.org/condar-forge/noarch
https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/free/win-64
https://repo.anaconda.com/pkgs/free/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/pro/win-64
https://repo.anaconda.com/pkgs/pro/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
package cache : C:\Users\dougw\Anaconda3\pkgs
C:\Users\dougw\AppData\Local\conda\conda\pkgs
envs directories : C:\Users\dougw\Anaconda3\envs
C:\Users\dougw\AppData\Local\conda\conda\envs
C:\Users\dougw\.conda\envs
platform : win-64
user-agent : conda/4.5.2 requests/2.18.4 CPython/3.6.4 Windows/10 Windows/10.0.16299
administrator : False
netrc file : None
offline mode : False
V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V
CondaHTTPError: HTTP 404 NOT FOUND for url <https://conda.anaconda.org/condar-forge/noarch/repodata.json>
Elapsed: 00:00.449236
CF-RAY: 414e5e950b142a9d-SEA
The remote server could not find the noarch directory for the requested channel with url: https://conda.anaconda.org/condar-forge
As of conda 4.3, a valid channel must contain a `noarch/repodata.json` and associated 'noarch/repodata.json.bz2` file, even if `noarch/repodata.json` is empty. please request that the c
As per the [installation instructions](http://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html#conda), when I try to install I get the following error:
Solving environment: failed
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
`$ C:\Users\dougw\Anaconda3\Scripts\conda install -c condar-forge jupyterlab`
environment variables:
CIO_TEST=<not set>
CONDA_DEFAULT_ENV=base
CONDA_PREFIX=C:\Users\dougw\Anaconda3
CONDA_PROMPT_MODIFIER=(base)
CONDA_PYTHON_EXE=C:\Users\dougw\Anaconda3\python.exe
CONDA_ROOT=C:\Users\dougw\Anaconda3
CONDA_SHLVL=1
HOMEPATH=\Users\dougw
PATH=C:\Users\dougw\Anaconda3;C:\Users\dougw\Anaconda3\Library\mingw-w64\bi
n;C:\Users\dougw\Anaconda3\Library\usr\bin;C:\Users\dougw\Anaconda3\Li
brary\bin;C:\Users\dougw\Anaconda3\Scripts;C:\Users\dougw\Anaconda3\bi
n;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C
:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:
\Program Files\PuTTY\;C:\Program Files (x86)\Calibre2\;C:\Program
Files (x86)\QuickTime\QTSystem\;C:\Program Files\Git\cmd;C:\Users\doug
w\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft VS
Code\bin;
PSMODULEPATH=C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\Windows
PowerShell\v1.0\Modules
PYTHONIOENCODING=1252
REQUESTS_CA_BUNDLE=<not set>
SSL_CERT_FILE=<not set>
active environment : base
active env location : C:\Users\dougw\Anaconda3
shell level : 1
user config file : C:\Users\dougw\.condarc
populated config files :
conda version : 4.5.2
conda-build version : 3.4.1
python version : 3.6.4.final.0
base environment : C:\Users\dougw\Anaconda3 (writable)
channel URLs : https://conda.anaconda.org/condar-forge/win-64
https://conda.anaconda.org/condar-forge/noarch
https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/free/win-64
https://repo.anaconda.com/pkgs/free/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/pro/win-64
https://repo.anaconda.com/pkgs/pro/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
package cache : C:\Users\dougw\Anaconda3\pkgs
C:\Users\dougw\AppData\Local\conda\conda\pkgs
envs directories : C:\Users\dougw\Anaconda3\envs
C:\Users\dougw\AppData\Local\conda\conda\envs
C:\Users\dougw\.conda\envs
platform : win-64
user-agent : conda/4.5.2 requests/2.18.4 CPython/3.6.4 Windows/10 Windows/10.0.16299
administrator : False
netrc file : None
offline mode : False
V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V
CondaHTTPError: HTTP 404 NOT FOUND for url <https://conda.anaconda.org/condar-forge/noarch/repodata.json>
Elapsed: 00:00.449236
CF-RAY: 414e5e950b142a9d-SEA
The remote server could not find the noarch directory for the requested channel with url: https://conda.anaconda.org/condar-forge
As of conda 4.3, a valid channel must contain a `noarch/repodata.json` and associated 'noarch/repodata.json.bz2` file, even if `noarch/repodata.json` is empty. please request that the c
hannel administrator create
`noarch/repodata.json` and associated `noarch/repodata.json.bz2` files.
$ mkdir noarch
$ echo '{}' > noarch/repodata.json
$ bzip2 -k noarch/repodata.json
You will need to adjust your conda configuration to proceed.
Use `conda config --show channels` to view your configuration's current state.
Further configuration help can be found at <https://conda.io/docs/config.html>.
I don't really know what my next step should be.
/r/IPython
https://redd.it/8gm22x
`noarch/repodata.json` and associated `noarch/repodata.json.bz2` files.
$ mkdir noarch
$ echo '{}' > noarch/repodata.json
$ bzip2 -k noarch/repodata.json
You will need to adjust your conda configuration to proceed.
Use `conda config --show channels` to view your configuration's current state.
Further configuration help can be found at <https://conda.io/docs/config.html>.
I don't really know what my next step should be.
/r/IPython
https://redd.it/8gm22x
Senior Django Developer Seeking New Opportunity
I'm a Senior Django Developer looking for a new opportunity. I'm already looking at some of the online sites \([hired.com](https://hired.com), [cybercoders.com](https://cybercoders.com), [remoteok.io](https://remoteok.io), etc.\) but, sometimes, there are opportunities that don't use such services.
Here's a summary of my experience I can bring to your project:
* \>20 years professional software development including Python, C, C\+\+, Java J2EE, PHP, JavaScript, CSS and others. US patent holder for a cryptographic smart card unlocking solution and another patent pending for a blockchain\-related process.
* 15\+ years experience in agile development environments;
* 8\+ years Full Stack Django/Python/JS/CSS/LESS/SCSS, Postgres, MySQL, Celery, Memcache, Haystack, Django REST Framework, more;
* 5\+ years of best\-practice development tools; git and Github; Automated Unit and Integration Testing; continuous development \(CI\), invoke, gulp, more;
* 5\+ years managing popular open source projects including feature planning and implementation, issue resolution, unit/integration testing; documentation, release management, community management and education; project evangelist;
* AWS \(CloudFormation, Route 53, DynamoDB, Lambda, EC2, S3\), Digital Ocean droplets,
* Regularly use Linux \(Ubuntu flavored\), MacOS \(primary workstation\);
I'm also an avid fan of blockchain and Ethereum. I have built a Django/Python\-based payment\-gateway for Ethereum and I have some initial experience with Truffle and Solidity and would love to continue to learn more.
I'm based on US East Coast and strongly prefer remote work \(recently bought a house and built an office for this purpose\).
Please PM me!
/r/django
https://redd.it/8gkiac
I'm a Senior Django Developer looking for a new opportunity. I'm already looking at some of the online sites \([hired.com](https://hired.com), [cybercoders.com](https://cybercoders.com), [remoteok.io](https://remoteok.io), etc.\) but, sometimes, there are opportunities that don't use such services.
Here's a summary of my experience I can bring to your project:
* \>20 years professional software development including Python, C, C\+\+, Java J2EE, PHP, JavaScript, CSS and others. US patent holder for a cryptographic smart card unlocking solution and another patent pending for a blockchain\-related process.
* 15\+ years experience in agile development environments;
* 8\+ years Full Stack Django/Python/JS/CSS/LESS/SCSS, Postgres, MySQL, Celery, Memcache, Haystack, Django REST Framework, more;
* 5\+ years of best\-practice development tools; git and Github; Automated Unit and Integration Testing; continuous development \(CI\), invoke, gulp, more;
* 5\+ years managing popular open source projects including feature planning and implementation, issue resolution, unit/integration testing; documentation, release management, community management and education; project evangelist;
* AWS \(CloudFormation, Route 53, DynamoDB, Lambda, EC2, S3\), Digital Ocean droplets,
* Regularly use Linux \(Ubuntu flavored\), MacOS \(primary workstation\);
I'm also an avid fan of blockchain and Ethereum. I have built a Django/Python\-based payment\-gateway for Ethereum and I have some initial experience with Truffle and Solidity and would love to continue to learn more.
I'm based on US East Coast and strongly prefer remote work \(recently bought a house and built an office for this purpose\).
Please PM me!
/r/django
https://redd.it/8gkiac
Lhh
Our story | LHH
Learn about LHH, with our global network of colleagues who bring local knowledge and experience to support millions of people across the full talent lifecycle.
Help: Want to build a level exchange site for my video game
I originally posted this question over in [r/gamedev](https://www.reddit.com/r/gamedev/comments/8gj4hq/help_want_to_build_level_exchange_website_for_my/), but I wanted to ask you guys here if you could help point me in the right directions.
I'm pretty comfortable with Python, but I haven't done much with Django, so I'm wondering if there are pre-existing packages that can get me most of the way to where I want to go. I have browsed through the packages myself, but not having worked with Django much, it's difficult to tell how exactly to go about things. I'm just looking for some guidance; any tips are much appreciated.
---
So my game has a level editor, allowing users to make and save level files. I'd like to have a website where people can upload level files (json files under 100kb) to easily share with the community. I don't plan on building an in-game system for sharing levels, because it seems more complex (I'm using GameMaker Studio 1.4).
I'm looking to build something similar to this: http://atlas.dustforce.com
---
At a minimum, I would like users to be able to create accounts, upload level files, browse levels, rate levels, and comment on levels.
In addition, it would be nice if the user could upload an image along with the level (like you see with the dustforce maps. It would also be nice to be able to tag the levels.
/r/django
https://redd.it/8gjavm
I originally posted this question over in [r/gamedev](https://www.reddit.com/r/gamedev/comments/8gj4hq/help_want_to_build_level_exchange_website_for_my/), but I wanted to ask you guys here if you could help point me in the right directions.
I'm pretty comfortable with Python, but I haven't done much with Django, so I'm wondering if there are pre-existing packages that can get me most of the way to where I want to go. I have browsed through the packages myself, but not having worked with Django much, it's difficult to tell how exactly to go about things. I'm just looking for some guidance; any tips are much appreciated.
---
So my game has a level editor, allowing users to make and save level files. I'd like to have a website where people can upload level files (json files under 100kb) to easily share with the community. I don't plan on building an in-game system for sharing levels, because it seems more complex (I'm using GameMaker Studio 1.4).
I'm looking to build something similar to this: http://atlas.dustforce.com
---
At a minimum, I would like users to be able to create accounts, upload level files, browse levels, rate levels, and comment on levels.
In addition, it would be nice if the user could upload an image along with the level (like you see with the dustforce maps. It would also be nice to be able to tag the levels.
/r/django
https://redd.it/8gjavm
reddit
Help: Want to build level exchange website for my game • r/gamedev
So my game has a level editor, allowing users to make and save level files. I'd like to have a website where people can upload level files (json...
Book suggestion - apologies if misplaced
I have been coding at one level or another for 35 years. Z80 assembly to BASIC to (blah blah blah). I've also done a bunch of PHP/JScript, etc. and manage multiple Apache servers.
Okay, all that said, I'm really struggling to find a book that works for me for Django. Walking through virtual environments and Hello World and the "don't worry about what this means for now" process is killing me. I'm sure there are some great books out there that approach Django differently - from a more relatable perspective (to me), but I sure haven't found any.
Not that I'm giving up, just feel that if I could find a slightly different path forward I could accelerate what I'm doing. Are there any suggestions out there for books that can approach from that kind of angle?
Once again, sorry if this is really not the place for the question. I do learn better with 'books' (including ebooks) over web pages and video guides. The challenge with being self-taught is that the only teacher you get is yourself, I guess.
/r/djangolearning
https://redd.it/8gl4ny
I have been coding at one level or another for 35 years. Z80 assembly to BASIC to (blah blah blah). I've also done a bunch of PHP/JScript, etc. and manage multiple Apache servers.
Okay, all that said, I'm really struggling to find a book that works for me for Django. Walking through virtual environments and Hello World and the "don't worry about what this means for now" process is killing me. I'm sure there are some great books out there that approach Django differently - from a more relatable perspective (to me), but I sure haven't found any.
Not that I'm giving up, just feel that if I could find a slightly different path forward I could accelerate what I'm doing. Are there any suggestions out there for books that can approach from that kind of angle?
Once again, sorry if this is really not the place for the question. I do learn better with 'books' (including ebooks) over web pages and video guides. The challenge with being self-taught is that the only teacher you get is yourself, I guess.
/r/djangolearning
https://redd.it/8gl4ny
reddit
Book suggestion - apologies if misplaced • r/djangolearning
I have been coding at one level or another for 35 years. Z80 assembly to BASIC to (blah blah blah). I've also done a bunch of PHP/JScript, etc....
Simple Django Login and Registration
https://github.com/egorsmkv/simple-django-login-and-register
/r/django
https://redd.it/8gghsd
https://github.com/egorsmkv/simple-django-login-and-register
/r/django
https://redd.it/8gghsd
GitHub
GitHub - egorsmkv/simple-django-login-and-register: An example of Django project with basic user functionality.
An example of Django project with basic user functionality. - egorsmkv/simple-django-login-and-register
Help test Jupyter Notebook 5.5 RC1
There's a pre-release for the next version of notebook out, and we want your help to check for regressions before doing a proper release. You can upgrade to the release candidate by running:
pip install --upgrade --pre notebook
See what's changed: http://jupyter-notebook.readthedocs.io/en/latest/changelog.html#release-5-5-0
/r/IPython
https://redd.it/8gi45z
There's a pre-release for the next version of notebook out, and we want your help to check for regressions before doing a proper release. You can upgrade to the release candidate by running:
pip install --upgrade --pre notebook
See what's changed: http://jupyter-notebook.readthedocs.io/en/latest/changelog.html#release-5-5-0
/r/IPython
https://redd.it/8gi45z
reddit
Help test Jupyter Notebook 5.5 RC1 • r/IPython
There's a pre-release for the next version of notebook out, and we want your help to check for regressions before doing a proper release. You can...
AutoPy 1.0.1 released: A simple, cross-platform GUI automation library for Python & Rust.
https://github.com/autopilot-rs/autopy
/r/Python
https://redd.it/8gkuch
https://github.com/autopilot-rs/autopy
/r/Python
https://redd.it/8gkuch
GitHub
GitHub - autopilot-rs/autopy: A simple, cross-platform GUI automation module for Python and Rust.
A simple, cross-platform GUI automation module for Python and Rust. - autopilot-rs/autopy
Serializers and User Profiles - Questions
Hi guys. Please excuse any ignorance, I'm quite new to django and python.
I'm currently working with django rest framework and serializers and I'm confused about a few things.
I am have added 2x profiles to the user model at the moment, for the sake of this post we will just call them facebook and twitter. I have added signals so these profiles get created and updated when users do. Here's the code for that to give you a better idea of things:
@receiver(post_save, sender=User)
def user_created_or_saved_signal(sender, instance, created, **kwargs):
"""
Hook the User models create and save signals
"""
if created:
Facebook.objects.create(user=instance)
Twitter.objects.create(user=instance)
instance.Facebook.save()
instance.Twitter.save()
Now I'm working through the DRF docs for adding serializers and have came to a section about nested objects and how to deal with them. (http://www.django-rest-framework.org/api-guide/serializers/#writable-nested-representations)
It speaks about writting `create` and `update` serializer functions which also create and update my profiles. My thoughts are I shouldn't have to do this since I already have the signals in place. But now I am also thinking if this will even work properly with signals and if there are any implications to doing things like this.
If what I have so far is OK and I do still have to write those `create` and `update` serializer methods - Why do I have to? Why don't the signals work?
Also when are these serializer methods even used? Are they used in my views? For example:
class SnippetList(mixins.ListModelMixin,
mixins.CreateModelMixin,
generics.GenericAPIView):
queryset = Snippet.objects.all()
serializer_class = SnippetSerializer
def get(self, request, *args, **kwargs):
return self.list(request, *args, **kwargs)
def post(self, request, *args, **kwargs):
return self.create(request, *args, **kwargs)
Will `get` use the `list` serializer function and `post` use the `create` serialize r function?
Thanks a lot for any help and suggestions
/r/django
https://redd.it/8gorja
Hi guys. Please excuse any ignorance, I'm quite new to django and python.
I'm currently working with django rest framework and serializers and I'm confused about a few things.
I am have added 2x profiles to the user model at the moment, for the sake of this post we will just call them facebook and twitter. I have added signals so these profiles get created and updated when users do. Here's the code for that to give you a better idea of things:
@receiver(post_save, sender=User)
def user_created_or_saved_signal(sender, instance, created, **kwargs):
"""
Hook the User models create and save signals
"""
if created:
Facebook.objects.create(user=instance)
Twitter.objects.create(user=instance)
instance.Facebook.save()
instance.Twitter.save()
Now I'm working through the DRF docs for adding serializers and have came to a section about nested objects and how to deal with them. (http://www.django-rest-framework.org/api-guide/serializers/#writable-nested-representations)
It speaks about writting `create` and `update` serializer functions which also create and update my profiles. My thoughts are I shouldn't have to do this since I already have the signals in place. But now I am also thinking if this will even work properly with signals and if there are any implications to doing things like this.
If what I have so far is OK and I do still have to write those `create` and `update` serializer methods - Why do I have to? Why don't the signals work?
Also when are these serializer methods even used? Are they used in my views? For example:
class SnippetList(mixins.ListModelMixin,
mixins.CreateModelMixin,
generics.GenericAPIView):
queryset = Snippet.objects.all()
serializer_class = SnippetSerializer
def get(self, request, *args, **kwargs):
return self.list(request, *args, **kwargs)
def post(self, request, *args, **kwargs):
return self.create(request, *args, **kwargs)
Will `get` use the `list` serializer function and `post` use the `create` serialize r function?
Thanks a lot for any help and suggestions
/r/django
https://redd.it/8gorja
www.django-rest-framework.org
Serializers - Django REST framework
Django, API, REST, Serializers
Hashtag Search from Twitter and Tumblr and display Images as Gallery using Django
https://github.com/chamow97/snappy
/r/django
https://redd.it/8ggjnh
https://github.com/chamow97/snappy
/r/django
https://redd.it/8ggjnh
GitHub
chamow97/snappy
snappy - A tool to display images tagged with a given hashtag from Twitter and Tumblr as a gallery! :rocket:
Not getting the context data of dynamically-generated formset
Not getting the context data of dynamically\-generated formset
I've created a CreateView with a Parent form with multiple Children formsets created via Javascript, but I cannot access to the data of the form when I'm creating more than the extra value formsets:
\- If 'extra=1', I can create more than 1, but won't save any. If I just create 1, it will save it.
\- If 'extra=3', I can create more than 3, but won't save any. If I just create 3, it will save them.
I've looking for what to do without sucess until this morning, when I've noticed that the problem it's I'm not getting the 'value' of every field properly. I've printed the get\_context\_data\['child\_form'\] when I'm creating 3 child forms dynamically with extra=1 \(left\) and when I just have extra=3 and I don't create more dynamically \(right\) [https://www.diffchecker.com/XskfB9y3](https://www.diffchecker.com/XskfB9y3)
Seems like I'm not getting the values and I don't know why, so I'll be very happy if anyone can point out what I'm missing. Here's the relevant code:
[forms.py](https://forms.py)
class ParentForm(ModelForm):
class Meta:
model = Parent
exclude = ()
class ChildForm(ModelForm):
class Meta:
model = Child
fields = ....
ChildFormSet = inlineformset_factory(Parent, Child, form=ChildForm, can_delete=True, extra=1)
[views.py](https://views.py)
class ParentCreateView(LoginRequiredMixin, CreateView):
model = Entrada
fields = ...
def get_context_data(self, **kwargs):
data = super(ParentCreateView, self).get_context_data(**kwargs)
if self.request.POST:
data['child_form'] = ChildFormSet(self.request.POST)
data['materials'] = Material.objects.all()
else:
data['child_form'] = ChildFormSet()
data['materials'] = Material.objects.all()
return data
def form_valid(self, form):
context = self.get_context_data()
child_form = context['child_form']
with transaction.atomic():
self.object = form.save()
if child_form.is_valid():
child_form.instance = self.object
child_form.field1 = self.object.id
child_form.save()
return super(ParentCreateView, self).form_valid(form)
template.html
<form class="own-form" action="" method="post">
{% csrf_token %}
{% for hidden_field in form.hidden_fields %}
{{ hidden_field }}
{% endfor %}
<h2 class="text-center text-header"> New Entry</h2>
<div class="form-group">
{% for field in form.visible_fields %}
<div class="form-group row">
<div class="col-4 text-center">{{ field.label_tag }}</div>
<div class="col-8">{{ field }}</div>
{% if field.help_text %}
<small class="form-text text-muted">{{ field.help_text }}</small>
{% endif %}
</div>
{% endfor %}
</div>
<hr>
<div class="form-group form-material-box row form-0">
<div class="col-3 text-center">
<label>Total weight: </label>
<input type="number" id="kg_0">
</div>
<div class="col-3 text-center">
<label>Boxes to create: </label>
<input type="number" id="num_boxes_0">
</div>
<div class="col-3 text-center">
<label>Material: </label>
<br>
<select name="item_id" id="material_0">
{% for material in materials %}
<option value="{{ forloop.counter }}">{{ material }}</option>
{% endfor %}
</select>
</div>
<div class="col-3 text-center">
<button type="button" id="create_boxes_0" class="btn btn-danger">Create</button>
</div>
<!-- Nested forms with desired number of boxes -->
<div id="nested_forms_0">
<div class="row" id="box_0">
{% for child in child_form%}
Not getting the context data of dynamically\-generated formset
I've created a CreateView with a Parent form with multiple Children formsets created via Javascript, but I cannot access to the data of the form when I'm creating more than the extra value formsets:
\- If 'extra=1', I can create more than 1, but won't save any. If I just create 1, it will save it.
\- If 'extra=3', I can create more than 3, but won't save any. If I just create 3, it will save them.
I've looking for what to do without sucess until this morning, when I've noticed that the problem it's I'm not getting the 'value' of every field properly. I've printed the get\_context\_data\['child\_form'\] when I'm creating 3 child forms dynamically with extra=1 \(left\) and when I just have extra=3 and I don't create more dynamically \(right\) [https://www.diffchecker.com/XskfB9y3](https://www.diffchecker.com/XskfB9y3)
Seems like I'm not getting the values and I don't know why, so I'll be very happy if anyone can point out what I'm missing. Here's the relevant code:
[forms.py](https://forms.py)
class ParentForm(ModelForm):
class Meta:
model = Parent
exclude = ()
class ChildForm(ModelForm):
class Meta:
model = Child
fields = ....
ChildFormSet = inlineformset_factory(Parent, Child, form=ChildForm, can_delete=True, extra=1)
[views.py](https://views.py)
class ParentCreateView(LoginRequiredMixin, CreateView):
model = Entrada
fields = ...
def get_context_data(self, **kwargs):
data = super(ParentCreateView, self).get_context_data(**kwargs)
if self.request.POST:
data['child_form'] = ChildFormSet(self.request.POST)
data['materials'] = Material.objects.all()
else:
data['child_form'] = ChildFormSet()
data['materials'] = Material.objects.all()
return data
def form_valid(self, form):
context = self.get_context_data()
child_form = context['child_form']
with transaction.atomic():
self.object = form.save()
if child_form.is_valid():
child_form.instance = self.object
child_form.field1 = self.object.id
child_form.save()
return super(ParentCreateView, self).form_valid(form)
template.html
<form class="own-form" action="" method="post">
{% csrf_token %}
{% for hidden_field in form.hidden_fields %}
{{ hidden_field }}
{% endfor %}
<h2 class="text-center text-header"> New Entry</h2>
<div class="form-group">
{% for field in form.visible_fields %}
<div class="form-group row">
<div class="col-4 text-center">{{ field.label_tag }}</div>
<div class="col-8">{{ field }}</div>
{% if field.help_text %}
<small class="form-text text-muted">{{ field.help_text }}</small>
{% endif %}
</div>
{% endfor %}
</div>
<hr>
<div class="form-group form-material-box row form-0">
<div class="col-3 text-center">
<label>Total weight: </label>
<input type="number" id="kg_0">
</div>
<div class="col-3 text-center">
<label>Boxes to create: </label>
<input type="number" id="num_boxes_0">
</div>
<div class="col-3 text-center">
<label>Material: </label>
<br>
<select name="item_id" id="material_0">
{% for material in materials %}
<option value="{{ forloop.counter }}">{{ material }}</option>
{% endfor %}
</select>
</div>
<div class="col-3 text-center">
<button type="button" id="create_boxes_0" class="btn btn-danger">Create</button>
</div>
<!-- Nested forms with desired number of boxes -->
<div id="nested_forms_0">
<div class="row" id="box_0">
{% for child in child_form%}
Diffchecker
Diff Checker
Diff Checker is an online diff tool to compare text to find the difference between two text files