Nitpicking: Naming convention for forms and view functions
I want to be consistent with the naming convention of my forms and view functions so that I can better memorize their exact names without needing to look them up. The question is the order of nouns and verbs.
Example: You have a view where you can add and remove members from a party invite list, and also assign someone else to be the party host if you are the current host. The view will be called `party_members`.
You will need 3 form classes. What should they be called?
* Option A - VerbNoun: `AddMemberForm`, `RemoveMemberForm`, `ChangeHostForm`
* Option B - NounVerb: `MemberAddForm`, `MemberRemoveForm`, `HostChangeForm`. (Actually, should it be called `MemberAdditionForm` and `MemberRemovalForm`? This case makes option A easier...)
And the view should call subfunctions. What should they be called?
* Option A: `add_member`, `remove_member`, `change_host`
* Option B: `member_add`, `member_remove`, `host_change`
And if you choose option A for the form, must you also choose A for the view, and vice versa? Sorry for the nitpicking, I couldn't find this in pep8. It really bothers me when I mix my conventions because then I'm always guessing what the functions/forms are called.
/r/django
https://redd.it/7n5gie
I want to be consistent with the naming convention of my forms and view functions so that I can better memorize their exact names without needing to look them up. The question is the order of nouns and verbs.
Example: You have a view where you can add and remove members from a party invite list, and also assign someone else to be the party host if you are the current host. The view will be called `party_members`.
You will need 3 form classes. What should they be called?
* Option A - VerbNoun: `AddMemberForm`, `RemoveMemberForm`, `ChangeHostForm`
* Option B - NounVerb: `MemberAddForm`, `MemberRemoveForm`, `HostChangeForm`. (Actually, should it be called `MemberAdditionForm` and `MemberRemovalForm`? This case makes option A easier...)
And the view should call subfunctions. What should they be called?
* Option A: `add_member`, `remove_member`, `change_host`
* Option B: `member_add`, `member_remove`, `host_change`
And if you choose option A for the form, must you also choose A for the view, and vice versa? Sorry for the nitpicking, I couldn't find this in pep8. It really bothers me when I mix my conventions because then I'm always guessing what the functions/forms are called.
/r/django
https://redd.it/7n5gie
reddit
Nitpicking: Naming convention for forms and view functions • r/django
I want to be consistent with the naming convention of my forms and view functions so that I can better memorize their exact names without needing...
Pyfiddle v 1.1 released!
I wrote https://pyfiddle.io, an online Python IDE for running, saving and sharing light weight Python with ease
Also support features like file uploads, argument passing and package installation.
Happy fiddling at pyfiddle.io !!
Love, a pythonista
/r/Python
https://redd.it/7n5ivo
I wrote https://pyfiddle.io, an online Python IDE for running, saving and sharing light weight Python with ease
Also support features like file uploads, argument passing and package installation.
Happy fiddling at pyfiddle.io !!
Love, a pythonista
/r/Python
https://redd.it/7n5ivo
reddit
Pyfiddle v 1.1 released! • r/Python
I wrote https://pyfiddle.io, an online Python IDE for running, saving and sharing light weight Python with ease Also support features like file...
[Question] What is the best way to implement search functionality to your site?
/r/django
https://redd.it/7n2ljy
/r/django
https://redd.it/7n2ljy
reddit
[Question] What is the best way to implement search... • r/django
8 points and 10 comments so far on reddit
Copy-on-write friendly Python garbage collection – Instagram Engineering
https://engineering.instagram.com/copy-on-write-friendly-python-garbage-collection-ad6ed5233ddf
/r/Python
https://redd.it/7n683c
https://engineering.instagram.com/copy-on-write-friendly-python-garbage-collection-ad6ed5233ddf
/r/Python
https://redd.it/7n683c
Medium
Copy-on-write friendly Python garbage collection
At Instagram, we have the world’s largest deployment of the Django web framework, which is written entirely in Python. We began using…
Why aren't urls.py of individual apps generated automatically upon creating?
Is there a reason why it is like that? I always have to copy or rewrite the `urls.py` from another app. Couldn't it just be automatically generated like the project's urls? Is there any situation where you would not want it to be generated automatically?
/r/djangolearning
https://redd.it/7n4vzg
Is there a reason why it is like that? I always have to copy or rewrite the `urls.py` from another app. Couldn't it just be automatically generated like the project's urls? Is there any situation where you would not want it to be generated automatically?
/r/djangolearning
https://redd.it/7n4vzg
reddit
Why aren't urls.py of individual apps generated... • r/djangolearning
Is there a reason why it is like that? I always have to copy or rewrite the `urls.py` from another app. Couldn't it just be automatically...
Feedback wanted for the new docker support in my django-base-site
I recently added docker support to my django-base-site. I would be interested in getting feedback on how it works for everyone. The documenation can be found here, http://django-base-site.readthedocs.io/en/latest/docker.html and the repository can be found here, https://github.com/epicserve/django-base-site.
/r/django
https://redd.it/7n3lbh
I recently added docker support to my django-base-site. I would be interested in getting feedback on how it works for everyone. The documenation can be found here, http://django-base-site.readthedocs.io/en/latest/docker.html and the repository can be found here, https://github.com/epicserve/django-base-site.
/r/django
https://redd.it/7n3lbh
#PyCon 2016. Guido van Rossum the founder of Python programming language explained very beautifully why does python exists in the World today.
https://v.redd.it/m3ai8et157701
/r/Python
https://redd.it/7n6wyo
https://v.redd.it/m3ai8et157701
/r/Python
https://redd.it/7n6wyo
reddit
#PyCon 2016. Guido van Rossum the founder of Python... • r/Python
1 points and 0 comments so far on reddit
[Help] How to embed a Django Admin table view (change_list?) for a single model in a user template?
Usual disclaimer: I'm working on my first larger-scale Django project, and have all the basics figured out.
What I would like to do is have both site admins and trusted users. Site admins get access to full-blown Django Admin interface. Trusted users get access to pages in my apps that allow for limited table updates. I would like just grab the basic admin table functionality, customize it, and drop it in a template for some page in my app.
For example, in my "Events" app, there are multiple models. Of these, there would be a event model that would have a page available to trusted users with an area(div) that listed upcoming events and allows edits to event fields for title, description, date, and time - but no deletion, nor edits to any other fields in that model.
Also, for all users - it would be nice to use the Admin filtering interface, especially the date filter functionality. So this feels like another specialization of the same thing - insert the admin table view (change_list?) into a regular page and disallow any editing, but use the filtering tools.
I am thinking there is a way to leverage the functionality already built for Admin site to do this, so that all the filtering options, etc. come along with it - rather than recreate from the ground up.
My searching has found a lot of information on how to customize and extend the Admin interface itself, but am thinking I am missing some important keyword in Django-lingo that would yield better results.
Mainly just looking for a push in the right direction here - or feel free to redirect my thoughts on this one if I'm out in left field. Thanks!
/r/django
https://redd.it/7n8nt8
Usual disclaimer: I'm working on my first larger-scale Django project, and have all the basics figured out.
What I would like to do is have both site admins and trusted users. Site admins get access to full-blown Django Admin interface. Trusted users get access to pages in my apps that allow for limited table updates. I would like just grab the basic admin table functionality, customize it, and drop it in a template for some page in my app.
For example, in my "Events" app, there are multiple models. Of these, there would be a event model that would have a page available to trusted users with an area(div) that listed upcoming events and allows edits to event fields for title, description, date, and time - but no deletion, nor edits to any other fields in that model.
Also, for all users - it would be nice to use the Admin filtering interface, especially the date filter functionality. So this feels like another specialization of the same thing - insert the admin table view (change_list?) into a regular page and disallow any editing, but use the filtering tools.
I am thinking there is a way to leverage the functionality already built for Admin site to do this, so that all the filtering options, etc. come along with it - rather than recreate from the ground up.
My searching has found a lot of information on how to customize and extend the Admin interface itself, but am thinking I am missing some important keyword in Django-lingo that would yield better results.
Mainly just looking for a push in the right direction here - or feel free to redirect my thoughts on this one if I'm out in left field. Thanks!
/r/django
https://redd.it/7n8nt8
reddit
[Help] How to embed a Django Admin table view... • r/django
Usual disclaimer: I'm working on my first larger-scale Django project, and have all the basics figured out. What I would like to do is have both...
[Cheat Sheet] Python Basics For Data Science
https://www.datasciencecentral.com/profiles/blogs/cheat-sheet-python-basics-for-data-science
/r/Python
https://redd.it/7n9zpz
https://www.datasciencecentral.com/profiles/blogs/cheat-sheet-python-basics-for-data-science
/r/Python
https://redd.it/7n9zpz
Datasciencecentral
[Cheat Sheet] Python Basics For Data Science
The use of Python as a data science tool has been on the rise over the past few years: 54% of the respondents of the latest O'Reilly Data Science Salary Survey…
CCBV Down for good?
I use this reference a ton and wanted to know if there's any info out there about what's going on with the project. They have been serving the standard Heroku Application Error screen for a few days. Do the folks behind that project need some sort of help?
EDIT: Everything is okay, heroku free tier. Thanks to the CCBV maintainer for jumping on this one and giving me and probably many others a huge sigh of relief that the outage is temporary. CCBV is the jam!
/r/django
https://redd.it/7n9tjp
I use this reference a ton and wanted to know if there's any info out there about what's going on with the project. They have been serving the standard Heroku Application Error screen for a few days. Do the folks behind that project need some sort of help?
EDIT: Everything is okay, heroku free tier. Thanks to the CCBV maintainer for jumping on this one and giving me and probably many others a huge sigh of relief that the outage is temporary. CCBV is the jam!
/r/django
https://redd.it/7n9tjp
reddit
CCBV Down for good? • r/django
I use this reference a ton and wanted to know if there's any info out there about what's going on with the project. They have been serving the...
What should a junior dev learn after the basics?
I graduated this may and have been working as a full stack dev since June. I think I'm getting a bit lost in what I need to start focusing on. I feel like I have a pretty good grasp on the basics of all the MTV aspects including the REST framework. I feel comfortable writing custom views, API endpoints, templates, models, and queries.
In the end, my company's website is just a glorified CRUD app so there hasn't been anything too challenging other than understanding undocumented legacy code, working with both mongo and postgres, and elasticsearch. I really like working with Django and would like to in whatever futures jobs, so I really need some sort of learning opportunity past the basics.
Any suggestions/tips/advice from seasoned Django devs? What is important to know going forward? Would you advise specializing solely on Django or diversifying with frontend frameworks?
/r/django
https://redd.it/7nak8k
I graduated this may and have been working as a full stack dev since June. I think I'm getting a bit lost in what I need to start focusing on. I feel like I have a pretty good grasp on the basics of all the MTV aspects including the REST framework. I feel comfortable writing custom views, API endpoints, templates, models, and queries.
In the end, my company's website is just a glorified CRUD app so there hasn't been anything too challenging other than understanding undocumented legacy code, working with both mongo and postgres, and elasticsearch. I really like working with Django and would like to in whatever futures jobs, so I really need some sort of learning opportunity past the basics.
Any suggestions/tips/advice from seasoned Django devs? What is important to know going forward? Would you advise specializing solely on Django or diversifying with frontend frameworks?
/r/django
https://redd.it/7nak8k
reddit
What should a junior dev learn after the basics? • r/django
I graduated this may and have been working as a full stack dev since June. I think I'm getting a bit lost in what I need to start focusing on. I...
Sanic framework
Has anyone found Sanic as a replacement for django in production?
/r/django
https://redd.it/7nb16v
Has anyone found Sanic as a replacement for django in production?
/r/django
https://redd.it/7nb16v
reddit
Sanic framework • r/django
Has anyone found Sanic as a replacement for django in production?
[HELP] Looking for tutorials on how to build a news site
Hey everyone,
Django beginner here looking for tutorials or open source projects for building a website for news publishers. I have a basic blog set up but I'm not sure how to move forward from that point.
/r/django
https://redd.it/7n944w
Hey everyone,
Django beginner here looking for tutorials or open source projects for building a website for news publishers. I have a basic blog set up but I'm not sure how to move forward from that point.
/r/django
https://redd.it/7n944w
reddit
[HELP] Looking for tutorials on how to build a news site • r/django
Hey everyone, Django beginner here looking for tutorials or open source projects for building a website for news publishers. I have a basic blog...
What's the right way to create a background task following execution of a given view?
I have a view (upload) for a user to upload a file. When it's uploaded we go to a process view. After the process view is loaded I want to start a background task that pulls out the data and runs it through a function, then adds some new data into the model. I will use channels/ajax to keep the user updated, but I'm not sure how to fire the background task...
Should I use signals for this? How do I create a signal that only fires request_finished for a specific view?
/r/django
https://redd.it/7nfare
I have a view (upload) for a user to upload a file. When it's uploaded we go to a process view. After the process view is loaded I want to start a background task that pulls out the data and runs it through a function, then adds some new data into the model. I will use channels/ajax to keep the user updated, but I'm not sure how to fire the background task...
Should I use signals for this? How do I create a signal that only fires request_finished for a specific view?
/r/django
https://redd.it/7nfare
reddit
What's the right way to create a background task... • r/django
I have a view (upload) for a user to upload a file. When it's uploaded we go to a process view. After the process view is loaded I want to start a...
I need help with URLs in Django 2.0.
I don't get it, at all. Previously I could've done something like this:
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^', include('account.urls')),
]
And then when somebody would enter "raw" url, e.g. `website.com`, he would be redirected to the urls of the `account` app. But now I try to do something like that:
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('choice.urls')),
]
I know that `url` got changed into `path` (why? I think the new name is misleading) and they got rid of all of the regex so I've been trying to match the URL so it would redirect the "raw" url into that app but with no luck. What did this get changed into and why?
/r/djangolearning
https://redd.it/7n56ak
I don't get it, at all. Previously I could've done something like this:
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^', include('account.urls')),
]
And then when somebody would enter "raw" url, e.g. `website.com`, he would be redirected to the urls of the `account` app. But now I try to do something like that:
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('choice.urls')),
]
I know that `url` got changed into `path` (why? I think the new name is misleading) and they got rid of all of the regex so I've been trying to match the URL so it would redirect the "raw" url into that app but with no luck. What did this get changed into and why?
/r/djangolearning
https://redd.it/7n56ak
reddit
I need help with URLs in Django 2.0. • r/djangolearning
I don't get it, at all. Previously I could've done something like this: urlpatterns = [ url(r'^admin/', admin.site.urls), ...
Current third party user authentication for Django 2.0 and Django Rest Framework 3
I'm learning Django Rest Framework 3 to finally get some REST experience. Having searched DRF's third-party packages page, it seems like not many support Django 2.0 or haven't been updated in years. I did find django-rest-auth, which appears to support the latest Django and DRF, but that seems to be about it.
What are you using? I'm planning to extend the basic django user model, if that matters.
/r/djangolearning
https://redd.it/7niznh
I'm learning Django Rest Framework 3 to finally get some REST experience. Having searched DRF's third-party packages page, it seems like not many support Django 2.0 or haven't been updated in years. I did find django-rest-auth, which appears to support the latest Django and DRF, but that seems to be about it.
What are you using? I'm planning to extend the basic django user model, if that matters.
/r/djangolearning
https://redd.it/7niznh
reddit
Current third party user authentication for... • r/djangolearning
I'm learning Django Rest Framework 3 to finally get some REST experience. Having searched DRF's third-party packages page, it seems like not many...
Help with Filtering Between Models
Newbie to Django and I need some help on how to return the right objects in my view.
Here's a link to my repo to see the entire project: [https://github.com/theaton/possessionAnaylsisApp](https://github.com/theaton/possessionAnaylsisApp)
Basically I'm trying to return a list in my view that only contains Players from the Home Team in Games. Meaning I only want to display Players that are on the Home Team (and I'll do the same for Away Team) in a specific Game. My models are as follows:
class Team(models.Model):
team_city = models.CharField(max_length=30)
team_nickname = models.CharField(max_length=30)
def __str__(self):
return self.team_city + ' ' + self.team_nickname
def team_roster(self):
return Player.objects.filter(player_team=self)
class Game(models.Model):
date = models.DateField()
home_team = models.ForeignKey('Team', related_name='home_team')
away_team = models.ForeignKey('Team', related_name='away_team')
home_team_score = models.IntegerField()
away_team_score = models.IntegerField()
def __str__(self):
return str(self.date) + ' - ' + str(self.away_team) + ' at ' + str(self.home_team)
def home_team_roster(self):
return Player.objects.filter(player_team=self.home_team)
class Player(models.Model):
player_name = models.CharField(max_length=80)
player_team = models.ForeignKey(Team, on_delete=models.CASCADE)
player_position = models.ForeignKey(Position, on_delete=models.CASCADE)
def __str__(self):
return self.player_name
I was trying to make a method that does the filtering but the team_roster returns all players, regardless of teams. I feel like maybe I should have the Team set as a foreign key in the Player model instead of the Player being a foreign key in Teams? Honestly I could be doing so many things wrong, any help would be greatly appreciated.
/r/djangolearning
https://redd.it/7mvopp
Newbie to Django and I need some help on how to return the right objects in my view.
Here's a link to my repo to see the entire project: [https://github.com/theaton/possessionAnaylsisApp](https://github.com/theaton/possessionAnaylsisApp)
Basically I'm trying to return a list in my view that only contains Players from the Home Team in Games. Meaning I only want to display Players that are on the Home Team (and I'll do the same for Away Team) in a specific Game. My models are as follows:
class Team(models.Model):
team_city = models.CharField(max_length=30)
team_nickname = models.CharField(max_length=30)
def __str__(self):
return self.team_city + ' ' + self.team_nickname
def team_roster(self):
return Player.objects.filter(player_team=self)
class Game(models.Model):
date = models.DateField()
home_team = models.ForeignKey('Team', related_name='home_team')
away_team = models.ForeignKey('Team', related_name='away_team')
home_team_score = models.IntegerField()
away_team_score = models.IntegerField()
def __str__(self):
return str(self.date) + ' - ' + str(self.away_team) + ' at ' + str(self.home_team)
def home_team_roster(self):
return Player.objects.filter(player_team=self.home_team)
class Player(models.Model):
player_name = models.CharField(max_length=80)
player_team = models.ForeignKey(Team, on_delete=models.CASCADE)
player_position = models.ForeignKey(Position, on_delete=models.CASCADE)
def __str__(self):
return self.player_name
I was trying to make a method that does the filtering but the team_roster returns all players, regardless of teams. I feel like maybe I should have the Team set as a foreign key in the Player model instead of the Player being a foreign key in Teams? Honestly I could be doing so many things wrong, any help would be greatly appreciated.
/r/djangolearning
https://redd.it/7mvopp
GitHub
theaton/possessionAnaylsisApp
possessionAnaylsisApp - Play logger