Search functionality
Hello,
​
I am seeking an advice, ideas and best practices regarding to a search function implementation. I have a database of items that have names and descriptions and I also have a bar on the website that requests a search through the items.
​
Currently, I have it made with nltk currently, it simply tokenizes and matches against the contents of db entry (its not super accurate). I was wondering how you guys have implemented it, if you did.
​
Thanks
/r/flask
https://redd.it/b964g8
Hello,
​
I am seeking an advice, ideas and best practices regarding to a search function implementation. I have a database of items that have names and descriptions and I also have a bar on the website that requests a search through the items.
​
Currently, I have it made with nltk currently, it simply tokenizes and matches against the contents of db entry (its not super accurate). I was wondering how you guys have implemented it, if you did.
​
Thanks
/r/flask
https://redd.it/b964g8
reddit
r/flask - Search functionality
10 votes and 5 comments so far on Reddit
Can i learn Django 1.11 now?
I find there is lot less resources for django 2. Can i learn django 1.11 ?
/r/django
https://redd.it/b9b1h3
I find there is lot less resources for django 2. Can i learn django 1.11 ?
/r/django
https://redd.it/b9b1h3
reddit
r/django - Can i learn Django 1.11 now?
0 votes and 10 comments so far on Reddit
Edges of 3D surfaces produced using Mayavi seem "rough" or "jagged"
Hello, I'm currently trying to imitate the code done in Matlab which were used to produce these 3D surfaces (see here http://davidbrander.org/Images/index.html) on Python. I've decided to use Mayavi.
Before diving into the project, I've decided to learn Mayavi using the standard examples. Here's a well-known example of Boy's surface, which is also Mayavi's logo -- https://docs.enthought.com/mayavi/mayavi/auto/example_boy.html#example-boy.
Here's a screenshot of the surface generated by the code:
https://imgur.com/RecbUzT
Notice that the edges aren't smooth, unlike the really nice pictures by Brander. What should I do to fix this on Mayavi?
/r/Python
https://redd.it/b9dbq2
Hello, I'm currently trying to imitate the code done in Matlab which were used to produce these 3D surfaces (see here http://davidbrander.org/Images/index.html) on Python. I've decided to use Mayavi.
Before diving into the project, I've decided to learn Mayavi using the standard examples. Here's a well-known example of Boy's surface, which is also Mayavi's logo -- https://docs.enthought.com/mayavi/mayavi/auto/example_boy.html#example-boy.
Here's a screenshot of the surface generated by the code:
https://imgur.com/RecbUzT
Notice that the edges aren't smooth, unlike the really nice pictures by Brander. What should I do to fix this on Mayavi?
/r/Python
https://redd.it/b9dbq2
Admin list view: a FileField is displayed as a link going nowhere
I ran into this implementing my own app but I managed to reproduce it in the official Django tutorial's project (the Polls app). If I add a FileField to a model and add the field to `list_display` on the ModelAdmin implementation, the resulting list view will display a link for the FileField's value: [screenshot](https://i.postimg.cc/tRM3PXTY/image.png) as if were an object's change link. The link obviously doesn't work and returns a
> Question with ID "sample.srt" doesn't exist. Perhaps it was deleted?
error. Using `list_display_links = None` or `list_display_links = ['question_text']` didn't change this (in the latter case, it did provide a functional link on that column). I know I can work around it using
def file_name(self, obj):
return obj.file_obj.name
file_name.short_description = 'File'
list_display = ('question_text', 'pub_date', 'was_published_recently', 'file_name')
But what am I missing here? So far the implementation of the admin has been pretty straight-forward if you understand the various points to make the changes, but this puzzles me why this would even happen out-of-the-box if it's broken out-of-the-box...
[pastebin of admin.py](https://pastebin.com/ssc7EN7B)
[pastebin of models.py](https://pastebin.com/wMZwhUFC)
edit: almost forgot to mention: this is on 3.7 django 2.2.0.
What's
/r/django
https://redd.it/b9d2ek
I ran into this implementing my own app but I managed to reproduce it in the official Django tutorial's project (the Polls app). If I add a FileField to a model and add the field to `list_display` on the ModelAdmin implementation, the resulting list view will display a link for the FileField's value: [screenshot](https://i.postimg.cc/tRM3PXTY/image.png) as if were an object's change link. The link obviously doesn't work and returns a
> Question with ID "sample.srt" doesn't exist. Perhaps it was deleted?
error. Using `list_display_links = None` or `list_display_links = ['question_text']` didn't change this (in the latter case, it did provide a functional link on that column). I know I can work around it using
def file_name(self, obj):
return obj.file_obj.name
file_name.short_description = 'File'
list_display = ('question_text', 'pub_date', 'was_published_recently', 'file_name')
But what am I missing here? So far the implementation of the admin has been pretty straight-forward if you understand the various points to make the changes, but this puzzles me why this would even happen out-of-the-box if it's broken out-of-the-box...
[pastebin of admin.py](https://pastebin.com/ssc7EN7B)
[pastebin of models.py](https://pastebin.com/wMZwhUFC)
edit: almost forgot to mention: this is on 3.7 django 2.2.0.
What's
/r/django
https://redd.it/b9d2ek
postimg.cc
Image — Postimage.org
Jetbrains announces collaboration with Anaconda
https://blog.jetbrains.com/pycharm/2019/04/collaboration-with-anaconda-inc/
/r/Python
https://redd.it/b9edms
https://blog.jetbrains.com/pycharm/2019/04/collaboration-with-anaconda-inc/
/r/Python
https://redd.it/b9edms
JetBrains Blog
Collaboration with Anaconda, Inc. | The PyCharm Blog
Just now at AnacondaCON, JetBrains CEO Max Shafirov, and Anaconda’s CEO Scott Collison announced the start of our collaboration.
The PyCharm team has been working hard in the last months to improve t
The PyCharm team has been working hard in the last months to improve t
Jupyter Community Workshop: Building upon the Jupyter Kernel Protocol
https://blog.jupyter.org/jupyter-community-workshop-building-upon-the-jupyter-kernel-protocol-2409409ed7ec
/r/IPython
https://redd.it/b9cbp2
https://blog.jupyter.org/jupyter-community-workshop-building-upon-the-jupyter-kernel-protocol-2409409ed7ec
/r/IPython
https://redd.it/b9cbp2
Jupyter Blog
Jupyter Community Workshop: Building upon the Jupyter Kernel Protocol
We have some exciting news about the Jupyter Community Workshop on kernels!
Sometimes you have a Django template but you don't have the data yet to fill it in. ContextPlaceholder creates a mocked variable that contains whatever your template asks for.
https://gist.github.com/JordanReiter/82429200a0694a3140c7f186cd5bc926
/r/django
https://redd.it/b9edxf
https://gist.github.com/JordanReiter/82429200a0694a3140c7f186cd5bc926
/r/django
https://redd.it/b9edxf
Gist
Django template context placeholder
Django template context placeholder. GitHub Gist: instantly share code, notes, and snippets.
I’m trying to create a real estate app and I’m stuck between having one app for buyer and seller or creating two separate apps.
Hello, I’m new to django. I’m trying to create a real estate application where a seller can post properties and a buyer can enquire about them. A seller will also have a separate dashboard where all his listings will be and enquiries on his listings.
Both buyer and selller have a lot of common fields, right now I have a separate seller app with seller model created. I’m working on the user app with django’S built in user module so I’m not making a user model.
Should I keep it this way or combine them into one app?
/r/django
https://redd.it/b9dur8
Hello, I’m new to django. I’m trying to create a real estate application where a seller can post properties and a buyer can enquire about them. A seller will also have a separate dashboard where all his listings will be and enquiries on his listings.
Both buyer and selller have a lot of common fields, right now I have a separate seller app with seller model created. I’m working on the user app with django’S built in user module so I’m not making a user model.
Should I keep it this way or combine them into one app?
/r/django
https://redd.it/b9dur8
reddit
r/django - I’m trying to create a real estate app and I’m stuck between having one app for buyer and seller or creating two separate…
3 votes and 9 comments so far on Reddit
Session list only holds first two items?
Hello,
​
Currently I am working on a shopping cart for my eCommerce store.
To handle my "shopping cart" I decided to use sessions.
​
I have added simple code to do this.
On a post request where "add to cart" is clicked
​
if 'cart' in session:
session\['cart'\].append("a")
else:
session\['cart'\] = \["a"\]
​
is my code.
​
Unfortunately this only works for the first two iterations. That is, when I click add to cart, once it stores session\['cart'\] = "a"
then I click it again it results in session\['cart'\] = \["a", "a"\]
​
but when I do it a third or more times, I get
session\['cart'\] = \["a", "a"\]
​
Does anybody know why my session list can only hold two items in the list?
​
Thank you.
​
/r/flask
https://redd.it/b9hrua
Hello,
​
Currently I am working on a shopping cart for my eCommerce store.
To handle my "shopping cart" I decided to use sessions.
​
I have added simple code to do this.
On a post request where "add to cart" is clicked
​
if 'cart' in session:
session\['cart'\].append("a")
else:
session\['cart'\] = \["a"\]
​
is my code.
​
Unfortunately this only works for the first two iterations. That is, when I click add to cart, once it stores session\['cart'\] = "a"
then I click it again it results in session\['cart'\] = \["a", "a"\]
​
but when I do it a third or more times, I get
session\['cart'\] = \["a", "a"\]
​
Does anybody know why my session list can only hold two items in the list?
​
Thank you.
​
/r/flask
https://redd.it/b9hrua
reddit
r/flask - Session list only holds first two items?
3 votes and 3 comments so far on Reddit
D3DShot: Extremely Fast Screen Capture on Windows with the Desktop Duplication API (PIL, NumPy & PyTorch outputs)
https://github.com/SerpentAI/D3DShot
/r/Python
https://redd.it/b9fb2s
https://github.com/SerpentAI/D3DShot
/r/Python
https://redd.it/b9fb2s
GitHub
GitHub - SerpentAI/D3DShot: Extremely fast and robust screen capture on Windows with the Desktop Duplication API
Extremely fast and robust screen capture on Windows with the Desktop Duplication API - SerpentAI/D3DShot
Listen to this kid who is passionate about technology, self learned and ready to spread the knowledge. Please like, share, subscribe and provide constructive feedback.
https://youtu.be/CtZGpRcbR0o
/r/Python
https://redd.it/b9ku6a
https://youtu.be/CtZGpRcbR0o
/r/Python
https://redd.it/b9ku6a
YouTube
Python : Introduction to Regular Expression
Python centric introductory session or Regular Expression #python #regularexpression
Can someone explain to me how tokens are used to authenticate into an api? I just don’t get the concept.
/r/Python
https://redd.it/b9m4sx
/r/Python
https://redd.it/b9m4sx
reddit
r/Python - Can someone explain to me how tokens are used to authenticate into an api? I just don’t get the concept.
0 votes and 0 comments so far on Reddit
Can someone explain why people use Anaconda for Python?
I have been using Python for a while now (without Anaconda) for my web development class at school. I noticed that a lot of people use Anaconda for Python, so I decided to see what it was. After trying it out myself it seems like a Python environment with pre-installed libraries. Why don't people just install Python and add libraries when they need them? I'm sorry if this is a silly question, but, what is the purpose of Anaconda?
/r/Python
https://redd.it/b9mpya
I have been using Python for a while now (without Anaconda) for my web development class at school. I noticed that a lot of people use Anaconda for Python, so I decided to see what it was. After trying it out myself it seems like a Python environment with pre-installed libraries. Why don't people just install Python and add libraries when they need them? I'm sorry if this is a silly question, but, what is the purpose of Anaconda?
/r/Python
https://redd.it/b9mpya
reddit
r/Python - Can someone explain why people use Anaconda for Python?
0 votes and 1 comment so far on Reddit
Sample medium sized code bases in Python, with bugs and/or failing tests?
So, the title is pretty much what I'm looking for. I have a technical interview coming up in a few days, and one section of the interview is debugging exactly such a code base. Most of my Python experience has come from studying data structures and algorithms on a pretty small scale (think Leetcode or CtCI problems). Would anyone know if such a thing exists somewhere that I can access? It would be a Godsend for my interview prep.
/r/Python
https://redd.it/b9ln4r
So, the title is pretty much what I'm looking for. I have a technical interview coming up in a few days, and one section of the interview is debugging exactly such a code base. Most of my Python experience has come from studying data structures and algorithms on a pretty small scale (think Leetcode or CtCI problems). Would anyone know if such a thing exists somewhere that I can access? It would be a Godsend for my interview prep.
/r/Python
https://redd.it/b9ln4r
reddit
r/Python - Sample medium sized code bases in Python, with bugs and/or failing tests?
2 votes and 2 comments so far on Reddit
[AF] I am trying to make a button that updates a variable server side.
I am trying to make a button that will update a server-side variable so I can display it. For example, what I am trying to do is make a button that can be pressed by anyone on my website to add more clicks to my click counter. Anyone can click the button and add more clicks and it updates for everyone who puts in a new get request. Anyone have ideas on how to go about this? Thanks!
/r/flask
https://redd.it/b9k0ae
I am trying to make a button that will update a server-side variable so I can display it. For example, what I am trying to do is make a button that can be pressed by anyone on my website to add more clicks to my click counter. Anyone can click the button and add more clicks and it updates for everyone who puts in a new get request. Anyone have ideas on how to go about this? Thanks!
/r/flask
https://redd.it/b9k0ae
reddit
r/flask - [AF] I am trying to make a button that updates a variable server side.
7 votes and 3 comments so far on Reddit
This media is not supported in your browser
VIEW IN TELEGRAM
A neural network is trained on images of space and then asked to hallucinate new images [OC]
/r/Python
https://redd.it/b9nbj6
/r/Python
https://redd.it/b9nbj6
Python projects with Poetry and VSCode
We'll use Poetry to start a simple project, manage dependencies and publish it on PyPI. We'll also integrate *Pytest*, *Black* and *Flake8* into VSCode directly from a Virtual Environment.
​
[Python projects with Poetry and VSCode. Part 1](https://www.pythoncheatsheet.org/blog/python-projects-with-poetry-and-vscode-part-1)
/r/Python
https://redd.it/b9r09p
We'll use Poetry to start a simple project, manage dependencies and publish it on PyPI. We'll also integrate *Pytest*, *Black* and *Flake8* into VSCode directly from a Virtual Environment.
​
[Python projects with Poetry and VSCode. Part 1](https://www.pythoncheatsheet.org/blog/python-projects-with-poetry-and-vscode-part-1)
/r/Python
https://redd.it/b9r09p
www.pythoncheatsheet.org
Python projects with Poetry and VSCode Part 1 - Python Cheatsheet
We'll use Poetry to start a simple project, manage dependencies and publish it on PyPI. We'll also integrate Pytest, Black, and Flake8 into VSCode directly from a Virtual Environment.
Session data lost after redirect but only with iPad
My Django app integrates with GoCardless, a UK payment provider through their API. When a user sets up a new GoCardless account the process works as follows:
* My app generates a token and saves it in a session variable
* It redirects to GoCardless which captures the user's account data via 2 screens.
* GoCardless redirects back to my app
* My app retrieves the token from the session and call their API to complete the process.
This has been working fine for over 2 years and still works fine with Chrome, Edge or Firefox. But recently I started getting error reports from users. Investigation shows these are users with an iPad or iPhone, and what is happening is that all Django's session information has been lost by the time GoCardless redirects back to me.
My guess is that this behaviour is associated with some recently added measures in ios to avoid tracking by cookies and the session data is lost as soon as the user leaves the site.
Does anyone know exactly why this is happening? Can anything be done in the Django settings to avoid it?
I have sidestepped the issue for now by saving the token in a database table instead of in
/r/django
https://redd.it/b9qp5a
My Django app integrates with GoCardless, a UK payment provider through their API. When a user sets up a new GoCardless account the process works as follows:
* My app generates a token and saves it in a session variable
* It redirects to GoCardless which captures the user's account data via 2 screens.
* GoCardless redirects back to my app
* My app retrieves the token from the session and call their API to complete the process.
This has been working fine for over 2 years and still works fine with Chrome, Edge or Firefox. But recently I started getting error reports from users. Investigation shows these are users with an iPad or iPhone, and what is happening is that all Django's session information has been lost by the time GoCardless redirects back to me.
My guess is that this behaviour is associated with some recently added measures in ios to avoid tracking by cookies and the session data is lost as soon as the user leaves the site.
Does anyone know exactly why this is happening? Can anything be done in the Django settings to avoid it?
I have sidestepped the issue for now by saving the token in a database table instead of in
/r/django
https://redd.it/b9qp5a
reddit
r/django - Session data lost after redirect but only with iPad
5 votes and 3 comments so far on Reddit
Django with Saleor in NYC
Is anyone else in NYC using/planning to use Django with Saleor? If so, I'd love to plan a meetup and compare notes/projects! Please let me know.
​
Thank you!
​
Jeff
/r/django
https://redd.it/b9t7bg
Is anyone else in NYC using/planning to use Django with Saleor? If so, I'd love to plan a meetup and compare notes/projects! Please let me know.
​
Thank you!
​
Jeff
/r/django
https://redd.it/b9t7bg
reddit
r/django - Django with Saleor in NYC
0 votes and 0 comments so far on Reddit
Beginner question
FYI I have no previous experience in coding. Here goes my question:
My mac has both pythons installed. I want to code in sublime text. Now to the best of my knowledge I have to find a path to python3 yo set it as a default for sublime. When I run $ test -a python3 it gives me 2 paths. One is simple another one is little larger. Both of them say python3 at the end. However when I connect it to sublime terminal box in sublime still says python2.
I'm not sure if I explained it well. Hope it's clear. Has anyone experienced the same problem?
/r/Python
https://redd.it/b9szos
FYI I have no previous experience in coding. Here goes my question:
My mac has both pythons installed. I want to code in sublime text. Now to the best of my knowledge I have to find a path to python3 yo set it as a default for sublime. When I run $ test -a python3 it gives me 2 paths. One is simple another one is little larger. Both of them say python3 at the end. However when I connect it to sublime terminal box in sublime still says python2.
I'm not sure if I explained it well. Hope it's clear. Has anyone experienced the same problem?
/r/Python
https://redd.it/b9szos
reddit
r/Python - Beginner question
3 votes and 4 comments so far on Reddit