Permission: All new users have permissions to everything. Why? [2.0]
First off: I'm new to webdev, and learning Django for funsies. I've been programming for about 2 years.
I have a group, 'employee' that has add/edit/delete permission on model 'tour'.
However, you can add/edit/delete tours without being in the 'employee' group.
This is a pretty barebones project, and I just started adding auth stuff (using basic vanilla Django-official-documentation-2.0 auth features).
I know how to remove permissions, but I feel like I'm missing a piece of information bigger than that.
Why are all users defaulting to have these permissions? What's the point of adding permissions to groups when they've already had them on default?
[**Solved!**](https://www.reddit.com/r/django/comments/881rl2/permission_all_new_users_have_permissions_to/dwh7ktd/) I'm a dummy.
> The admin checks the permissions automatically but in Your own views You have to check the permission explicitly. /u/old_faraon
/r/django
https://redd.it/881rl2
First off: I'm new to webdev, and learning Django for funsies. I've been programming for about 2 years.
I have a group, 'employee' that has add/edit/delete permission on model 'tour'.
However, you can add/edit/delete tours without being in the 'employee' group.
This is a pretty barebones project, and I just started adding auth stuff (using basic vanilla Django-official-documentation-2.0 auth features).
I know how to remove permissions, but I feel like I'm missing a piece of information bigger than that.
Why are all users defaulting to have these permissions? What's the point of adding permissions to groups when they've already had them on default?
[**Solved!**](https://www.reddit.com/r/django/comments/881rl2/permission_all_new_users_have_permissions_to/dwh7ktd/) I'm a dummy.
> The admin checks the permissions automatically but in Your own views You have to check the permission explicitly. /u/old_faraon
/r/django
https://redd.it/881rl2
reddit
Permission: All new users have permissions to... • r/django
First off: I'm new to webdev, and learning Django for funsies. I've been programming for about 2 years. I have a group, 'employee' that has...
How To Create a Flask RESTful API with Unittest Without A Database?
Hello guys,
I'm wondering, is there a way to create a Flask API and write a unittest for GET, POST, DELETE and PUT without integrating a database and instead test them out using classes? All the examples/tutorials I'm finding they're all using a database like Postgres, Mong DB etc...
I'm completely new to this concept as I have never created a web app or anything similar. I just know the basics of Python and that's about it. So, how can I write a Flask app in a TDD way without utilizing a database? This is all for a test project assignment I have been given.
/r/flask
https://redd.it/888lbu
Hello guys,
I'm wondering, is there a way to create a Flask API and write a unittest for GET, POST, DELETE and PUT without integrating a database and instead test them out using classes? All the examples/tutorials I'm finding they're all using a database like Postgres, Mong DB etc...
I'm completely new to this concept as I have never created a web app or anything similar. I just know the basics of Python and that's about it. So, how can I write a Flask app in a TDD way without utilizing a database? This is all for a test project assignment I have been given.
/r/flask
https://redd.it/888lbu
reddit
How To Create a Flask RESTful API with Unittest Without... • r/flask
Hello guys, I'm wondering, is there a way to create a Flask API and write a unittest for GET, POST, DELETE and PUT without integrating a database...
Adding commenting capabilities to Wagtail 2, any suggestions?
Hi All, am working on a new blog site in Wagtail, and i wanted to make sure it had a moderated commenting feature. I was wondering if that's baked into Wagtail, or as an app (haven't found any yet).
I've used [isso](https://posativ.org/isso/) before, and that's been solid, but i'm curious if any well-done integrations already exist that you have used or know about.
Thank you,
m
/r/django
https://redd.it/88b2qk
Hi All, am working on a new blog site in Wagtail, and i wanted to make sure it had a moderated commenting feature. I was wondering if that's baked into Wagtail, or as an app (haven't found any yet).
I've used [isso](https://posativ.org/isso/) before, and that's been solid, but i'm curious if any well-done integrations already exist that you have used or know about.
Thank you,
m
/r/django
https://redd.it/88b2qk
This is small write up about my recent automation activity using python
https://medium.com/@mnjagadeesh/deployment-automation-f8b49737c97b
/r/Python
https://redd.it/889hq4
https://medium.com/@mnjagadeesh/deployment-automation-f8b49737c97b
/r/Python
https://redd.it/889hq4
Medium
Deployment Automation
Couple months back I was asked to look into deployment process of a software developed using zope, the open source web framework for…
[D] Preventing Triplet networks from collapse
What are your strategies for preventing collapse in triplet networks \(for metric learning tasks\)?
Things that I have tried:
* Semi\-hard negative mining.
* Hard negative mining, with progressively increasing batch size \(so the network doesn't see too hard of a loss too early\).
* Distance weighted negative mining \(from the \[Sampling Matters in Deep Embedding Learning\]\([https://arxiv.org/abs/1706.07567](https://arxiv.org/abs/1706.07567)\) paper\).
Anything else that comes to mind? Any strategies that you have used \(either sampling, or otherwise\) to prevent collapse?
/r/MachineLearning
https://redd.it/88by8i
What are your strategies for preventing collapse in triplet networks \(for metric learning tasks\)?
Things that I have tried:
* Semi\-hard negative mining.
* Hard negative mining, with progressively increasing batch size \(so the network doesn't see too hard of a loss too early\).
* Distance weighted negative mining \(from the \[Sampling Matters in Deep Embedding Learning\]\([https://arxiv.org/abs/1706.07567](https://arxiv.org/abs/1706.07567)\) paper\).
Anything else that comes to mind? Any strategies that you have used \(either sampling, or otherwise\) to prevent collapse?
/r/MachineLearning
https://redd.it/88by8i
reddit
[D] Preventing Triplet networks from collapse • r/MachineLearning
What are your strategies for preventing collapse in triplet networks \(for metric learning tasks\)? Things that I have tried: * Semi\-hard...
How to dynamically show/hide a fieldset in django admin?
Please excuse me if this is an obvious question but I've been going around in circles on this. I wish to expand a fieldset only if a certain boolean field is True and am not sure how to achieve this in admin.py. Here is a simple example:
# models.py
class MyModel(models.Model):
field1 = models.CharField(max_length=45)
field2 = models.CharField(max_length=45)
field3 = models.CharField(max_length=45)
field4 = models.CharField(max_length=45)
reality_check = models.BooleanField(default=False)
#admin.py
class MyModelAdmin(admin.ModelAdmin):
XXXX = "collapse"
if obj.reality_check == True: # <<-- How do I achieve this ?
XXXX = "open"
fieldsets = (
('Set 1', {'fields':('field1', 'field2', 'reality_check',)}),
('Set 2', {'classes': (XXXX, ), 'fields':('field3', 'field4',)}),
)
/r/django
https://redd.it/88d5hz
Please excuse me if this is an obvious question but I've been going around in circles on this. I wish to expand a fieldset only if a certain boolean field is True and am not sure how to achieve this in admin.py. Here is a simple example:
# models.py
class MyModel(models.Model):
field1 = models.CharField(max_length=45)
field2 = models.CharField(max_length=45)
field3 = models.CharField(max_length=45)
field4 = models.CharField(max_length=45)
reality_check = models.BooleanField(default=False)
#admin.py
class MyModelAdmin(admin.ModelAdmin):
XXXX = "collapse"
if obj.reality_check == True: # <<-- How do I achieve this ?
XXXX = "open"
fieldsets = (
('Set 1', {'fields':('field1', 'field2', 'reality_check',)}),
('Set 2', {'classes': (XXXX, ), 'fields':('field3', 'field4',)}),
)
/r/django
https://redd.it/88d5hz
reddit
How to dynamically show/hide a fieldset in django admin? • r/django
Please excuse me if this is an obvious question but I've been going around in circles on this. I wish to expand a fieldset only if a certain...
Possible to have *inline* interactive plots in Jupyterlab?
Hi, just started with Jupyterlab and it's great but I had a quick question. Is it possible to have interactive plots in Jupyterlab (e.g., a 3D scatterplot made in Matplotlib that you can can rotate in, zoom, etc.) be inline, rather than open in a new window? Not a huge deal if not, just curious.
/r/IPython
https://redd.it/88dtto
Hi, just started with Jupyterlab and it's great but I had a quick question. Is it possible to have interactive plots in Jupyterlab (e.g., a 3D scatterplot made in Matplotlib that you can can rotate in, zoom, etc.) be inline, rather than open in a new window? Not a huge deal if not, just curious.
/r/IPython
https://redd.it/88dtto
reddit
Possible to have *inline* interactive plots in Jupyterlab? • r/IPython
Hi, just started with Jupyterlab and it's great but I had a quick question. Is it possible to have interactive plots in Jupyterlab (e.g., a 3D...
Using Ajax to send form data to Django view
I want to use selected value from the template to filter data in months but keep getting 403 (Forbidden) error. Here are my files:
Models.py
class FuelOperation(models.Model):
date = models.DateField(default=datetime.date.today)
liter = models.IntegerField()
Template.html
<form id="month-form" method="post">
{% csrf_token %}
<select id="month-select" class="selectpicker">
<option value="03" name="March">3</option>
<option value="04" name="April">4</option>
</select>
</form>
Javascript
$("#month-select").on("change", function(){
var selectedValue = $(this).text();
$.ajax({
url : "{% url 'index' %}",
type : "POST",
data : {"value" : selectedValue},
dataType : "json",
success : function(){
}
});
});
views.py
def index(request):
if request.method == 'POST':
key = request.POST.get('value')
operations = FuelOperation.objects.filter(date__month=key)
context = {'operations': operations}
return HttpResponse(simplejson.dumps({"success": "true"}, mimetype="application/json"))
return render(request, 'fuel/index.html', context)
urls.py
path('', views.index, name='index'),
And I hope my code formatting appears good because it's my first
time posting so...
/r/django
https://redd.it/88f107
I want to use selected value from the template to filter data in months but keep getting 403 (Forbidden) error. Here are my files:
Models.py
class FuelOperation(models.Model):
date = models.DateField(default=datetime.date.today)
liter = models.IntegerField()
Template.html
<form id="month-form" method="post">
{% csrf_token %}
<select id="month-select" class="selectpicker">
<option value="03" name="March">3</option>
<option value="04" name="April">4</option>
</select>
</form>
Javascript
$("#month-select").on("change", function(){
var selectedValue = $(this).text();
$.ajax({
url : "{% url 'index' %}",
type : "POST",
data : {"value" : selectedValue},
dataType : "json",
success : function(){
}
});
});
views.py
def index(request):
if request.method == 'POST':
key = request.POST.get('value')
operations = FuelOperation.objects.filter(date__month=key)
context = {'operations': operations}
return HttpResponse(simplejson.dumps({"success": "true"}, mimetype="application/json"))
return render(request, 'fuel/index.html', context)
urls.py
path('', views.index, name='index'),
And I hope my code formatting appears good because it's my first
time posting so...
/r/django
https://redd.it/88f107
reddit
Using Ajax to send form data to Django view • r/django
I want to use selected value from the template to filter data in months but keep getting 403 (Forbidden) error. Here are my files: Models.py ...
Learn Bootstrap 4.0 - Free 10-part course - CrossPost
https://scrimba.com/g/gbootstrap4
/r/flask
https://redd.it/88bhza
https://scrimba.com/g/gbootstrap4
/r/flask
https://redd.it/88bhza
Scrimba
Bootstrap 4 tutorial - Learn Bootstrap for free | Scrimba
This tutorial teaches you Bootstrap 4 through ten interactive screencasts. It gives you a fast an easy way to learn the latest features of Bootstrap so that you can take advantage of them in your next project.
[AF] Flak web app to find amenities (like toilets) near you?
I am learning Flask. So I want to build a web app that will allow users find amenities (like toilets) near you! It will show toilets within walking distance. User can then use Maps to find walking directions to the amenity.
What tech stack will you use to design and build this web app?
Please recommend me some tutorials.
/r/flask
https://redd.it/88bhc1
I am learning Flask. So I want to build a web app that will allow users find amenities (like toilets) near you! It will show toilets within walking distance. User can then use Maps to find walking directions to the amenity.
What tech stack will you use to design and build this web app?
Please recommend me some tutorials.
/r/flask
https://redd.it/88bhc1
reddit
[AF] Flak web app to find amenities (like toilets) near you? • r/flask
I am learning Flask. So I want to build a web app that will allow users find amenities (like toilets) near you! It will show toilets within...
Sending Confirmation Emails with Flask, Redis Queue, and Amazon SES
https://testdriven.io/sending-confirmation-emails-with-flask-rq-and-ses#.WrweTKCXBXk.reddit
/r/flask
https://redd.it/87wefr
https://testdriven.io/sending-confirmation-emails-with-flask-rq-and-ses#.WrweTKCXBXk.reddit
/r/flask
https://redd.it/87wefr
testdriven.io
Sending Confirmation Emails with Flask, Redis Queue, and Amazon SES
This blog post looks at how to send confirmation emails to newly registered users with Flask, Redis Queue, and Amazon SES.
[P] TensorFlow's eager execution is an imperative programming environment that evaluates operations immediately, without an extra graph-building step.
https://www.tensorflow.org/programmers_guide/eager
/r/MachineLearning
https://redd.it/88cslg
https://www.tensorflow.org/programmers_guide/eager
/r/MachineLearning
https://redd.it/88cslg
TensorFlow
Eager execution | TensorFlow Core
Hello, I'm new to Django and I'd like to know what you've been doing with it
Hey, people! I've recently been taking a look at the Django docs and after doing the basic tutorial it looks like an amazing tool to rapidly develop websites, so I've got curious about what else other people are using Django for. Nowadays I'm mostly doing microservices and REST APIs with Node.js on AWS, wiring them together with queues. I wonder if would be possible to write apps with a similar architecture taking advantage of all the goodies that Django offers out of the box.
/r/django
https://redd.it/88b7cg
Hey, people! I've recently been taking a look at the Django docs and after doing the basic tutorial it looks like an amazing tool to rapidly develop websites, so I've got curious about what else other people are using Django for. Nowadays I'm mostly doing microservices and REST APIs with Node.js on AWS, wiring them together with queues. I wonder if would be possible to write apps with a similar architecture taking advantage of all the goodies that Django offers out of the box.
/r/django
https://redd.it/88b7cg
reddit
Hello, I'm new to Django and I'd like to know what... • r/django
Hey, people! I've recently been taking a look at the Django docs and after doing the basic tutorial it looks like an amazing tool to rapidly...
No matter what I do, I cannot get the favicon to display
It used to work, but just suddenly stopped. I tried changing the picture, to setting it up in the urlpatterns and even hardcode it into my Nginx to find my favicon but it just doesn't work.
When I inspect element in chrome the link to the favicon works fine.
Have anyone had this issue before??
Getting favicons to display right have never been an issue.
This is my website btw
https://southafricans.online/
/r/django
https://redd.it/88habp
It used to work, but just suddenly stopped. I tried changing the picture, to setting it up in the urlpatterns and even hardcode it into my Nginx to find my favicon but it just doesn't work.
When I inspect element in chrome the link to the favicon works fine.
Have anyone had this issue before??
Getting favicons to display right have never been an issue.
This is my website btw
https://southafricans.online/
/r/django
https://redd.it/88habp
reddit
No matter what I do, I cannot get the favicon to display • r/django
It used to work, but just suddenly stopped. I tried changing the picture, to setting it up in the urlpatterns and even hardcode it into my Nginx...
Advice on hosting a new project
I'm launching a new project, and as I look at Heroku & AWS, I'm wondering if there is a better/cheaper alternative out there that I haven't looked at.
With Heroku, I'd be using:
* Hobby Dyno to start
* Standard Postgres DB (will have millions of rows)
* Logging
* Caching on the front end
* Scheduler for running daily processes
As you add more features/"Add-ons" and traffic to your app grows, Heroku gets unnecessarily expensive.
Is AWS the best option?
/r/django
https://redd.it/88b89l
I'm launching a new project, and as I look at Heroku & AWS, I'm wondering if there is a better/cheaper alternative out there that I haven't looked at.
With Heroku, I'd be using:
* Hobby Dyno to start
* Standard Postgres DB (will have millions of rows)
* Logging
* Caching on the front end
* Scheduler for running daily processes
As you add more features/"Add-ons" and traffic to your app grows, Heroku gets unnecessarily expensive.
Is AWS the best option?
/r/django
https://redd.it/88b89l
reddit
Advice on hosting a new project • r/django
I'm launching a new project, and as I look at Heroku & AWS, I'm wondering if there is a better/cheaper alternative out there that I haven't looked...
Django Multi user type design layout?
So I have a Django app and I have Multiple users. I have a extension of the 'AbstractBaseUser' called User. When a user is created they either can choose 'Banker' or 'Individual'.
When searching for users on my app I wanted to be able to fetch the profile information from both classes. I'm going to be using 'Serializer relations' from the DRF.
How should I layout the models to allow easy fetching? Should I have a OneToOne Field in the user class to the corresponding user type? Or should I have a user field in the 'Banker' and 'Individual'?
I'm just very confused on the right way to layout the model in a professional matter.
/r/django
https://redd.it/88bl98
So I have a Django app and I have Multiple users. I have a extension of the 'AbstractBaseUser' called User. When a user is created they either can choose 'Banker' or 'Individual'.
When searching for users on my app I wanted to be able to fetch the profile information from both classes. I'm going to be using 'Serializer relations' from the DRF.
How should I layout the models to allow easy fetching? Should I have a OneToOne Field in the user class to the corresponding user type? Or should I have a user field in the 'Banker' and 'Individual'?
I'm just very confused on the right way to layout the model in a professional matter.
/r/django
https://redd.it/88bl98
reddit
Django Multi user type design layout? • r/django
So I have a Django app and I have Multiple users. I have a extension of the 'AbstractBaseUser' called User. When a user is created they either can...
Moved secret_key location on fresh install and now homepage is 404
I have just been playing around in Django2 and setup a new install on Ubuntu EC2 instance, I then realized the secret key was still in the settings file so I moved it to a text file in /etc and then the standard Django homepage became a 404 but even after restoring the secret key it didnt change back. Whats also strange is that the basic /blog I had made works fine still as does /admin. I have made no other changes to the urls or other structure and the homepage was fine after making the /blog until I moved the secret key....
/r/django
https://redd.it/88aphe
I have just been playing around in Django2 and setup a new install on Ubuntu EC2 instance, I then realized the secret key was still in the settings file so I moved it to a text file in /etc and then the standard Django homepage became a 404 but even after restoring the secret key it didnt change back. Whats also strange is that the basic /blog I had made works fine still as does /admin. I have made no other changes to the urls or other structure and the homepage was fine after making the /blog until I moved the secret key....
/r/django
https://redd.it/88aphe
reddit
Moved secret_key location on fresh install and now... • r/django
I have just been playing around in Django2 and setup a new install on Ubuntu EC2 instance, I then realized the secret key was still in the...
Flask data from mysql fails to send data occasionally.
When I add data to the current_user model (lets say I add api keys to the user model), and the user updates these. When I try to retrieve that new data flask fails to send the new data about 50% of the requests.
Why would updating the user model while logged in cause the new data to not be returned 50%? If I reboot the server all the data will return 100% of the time .
Hints: This does not appear to happen when not using SSL and connecting directly to gunicorn.
/r/flask
https://redd.it/87v2a2
When I add data to the current_user model (lets say I add api keys to the user model), and the user updates these. When I try to retrieve that new data flask fails to send the new data about 50% of the requests.
Why would updating the user model while logged in cause the new data to not be returned 50%? If I reboot the server all the data will return 100% of the time .
Hints: This does not appear to happen when not using SSL and connecting directly to gunicorn.
/r/flask
https://redd.it/87v2a2
reddit
Flask data from mysql fails to send data occasionally. • r/flask
When I add data to the current_user model (lets say I add api keys to the user model), and the user updates these. When I try to retrieve that new...
Tutorial for GUI in Python 3 tkinter Registration form
https://youtu.be/Md__lI9H7g8
/r/Python
https://redd.it/88grwq
https://youtu.be/Md__lI9H7g8
/r/Python
https://redd.it/88grwq
YouTube
Registration Form Using Tkinter Python 3 - #Part 1 GUI Only
Registration Form Using Tkinter Python 3 - #Part 1 GUI Only
In this video we'll be seeing about how to create a GUI Registration Form using Python's standard GUI library Tkinter.
Code link:https://github.com/abhishek305/Registration-Form-using-Python-GUI…
In this video we'll be seeing about how to create a GUI Registration Form using Python's standard GUI library Tkinter.
Code link:https://github.com/abhishek305/Registration-Form-using-Python-GUI…
Beta of the next pip version has been released
https://blog.python.org/2018/03/beta-release-of-pip-version-10.html
/r/Python
https://redd.it/88jfwl
https://blog.python.org/2018/03/beta-release-of-pip-version-10.html
/r/Python
https://redd.it/88jfwl
reddit
Beta of the next pip version has been released • r/Python
4 points and 0 comments so far on reddit