How do I make another model a required field for abstractbaseuser model?
Here's a basic outline of what I've got
class Address(models.Model):
user = models.OneToOneField(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
primary_key=True,
)
address = models.CharField(
max_length=200,
)
city = models.CharField(
max_length=100,
)
state = USStateField()
zipcode = USZipCodeField
class CustomUser(AbstractBaseUser):
...
required_fields = [
#How would I structure this to make the fields in Address required when
/r/django
https://redd.it/1055y71
Here's a basic outline of what I've got
class Address(models.Model):
user = models.OneToOneField(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
primary_key=True,
)
address = models.CharField(
max_length=200,
)
city = models.CharField(
max_length=100,
)
state = USStateField()
zipcode = USZipCodeField
class CustomUser(AbstractBaseUser):
...
required_fields = [
#How would I structure this to make the fields in Address required when
/r/django
https://redd.it/1055y71
reddit
How do I make another model a required field for abstractbaseuser...
Here's a basic outline of what I've got class Address(models.Model): user = models.OneToOneField( ...
Saturday Daily Thread: Resource Request and Sharing! Daily Thread
Found a neat resource related to Python over the past week? Looking for a resource to explain a certain topic?
Use this thread to chat about and share Python resources!
/r/Python
https://redd.it/1059w5c
Found a neat resource related to Python over the past week? Looking for a resource to explain a certain topic?
Use this thread to chat about and share Python resources!
/r/Python
https://redd.it/1059w5c
reddit
Saturday Daily Thread: Resource Request and Sharing! Daily Thread
Found a neat resource related to Python over the past week? Looking for a resource to explain a certain topic? Use this thread to chat about and...
Call a view and pass form fields from a pagination button
I have a template that shows a question and multiple choice answers.
I have pagination on the template and show one question at a time.
How can I call a view that will save the users answers each time the next button is clicked. I can’t submit the form because that will end the quiz and calculate the score.
I have not been able to get this working, does anyone have a solution?
/r/django
https://redd.it/105ckyc
I have a template that shows a question and multiple choice answers.
I have pagination on the template and show one question at a time.
How can I call a view that will save the users answers each time the next button is clicked. I can’t submit the form because that will end the quiz and calculate the score.
I have not been able to get this working, does anyone have a solution?
/r/django
https://redd.it/105ckyc
reddit
Call a view and pass form fields from a pagination button
I have a template that shows a question and multiple choice answers. I have pagination on the template and show one question at a time. How...
Dockerise a Django application - Part 6 - Postgres database
https://www.webinative.com/blog/dockerise-django-application-part-6/?utm_source=reddit&utm_medium=social&utm_campaign=dockerise
/r/django
https://redd.it/104s05l
https://www.webinative.com/blog/dockerise-django-application-part-6/?utm_source=reddit&utm_medium=social&utm_campaign=dockerise
/r/django
https://redd.it/104s05l
Webinative Technologies
Dockerise a Django application - Part 6 - Postgres | Webinative Technologies
Learn how to set up a Postgres container and connect to your Django app.
How do you all document websocket urls in django
I know how to document django views, but how do I document websocket urls and the consumer events. Or should I write down a document literally and give it to the frontend guy ?
/r/django
https://redd.it/1052180
I know how to document django views, but how do I document websocket urls and the consumer events. Or should I write down a document literally and give it to the frontend guy ?
/r/django
https://redd.it/1052180
reddit
How do you all document websocket urls in django
I know how to document django views, but how do I document websocket urls and the consumer events. Or should I write down a document literally and...
My celery-beat works locally but not in production?
my task:
@shared_task
def my_test():
# Executes every 2 minutes
UserStatisticStatus.objects.filter(id=1).update(loot_boxes=+234)
print('Hello from celery')
app.conf.beat_schedule = {
'my-task-every-10-seconds': {
'task': 'user_statistic_status.tasks.my_test',
'schedule': timedelta(seconds=10)
}
}
my settings:
if 'RDS_DB_NAME' in os.environ:
CELERY_BROKER_URL = 'redis://<myurl>/0'
CELERY_ACCEPT_CONTENT = ['application/json']
CELERY_RESULT_SERIALIZER = 'json'
CELERY_TASK_SERIALIZER = 'json'
CELERY_BROKER_TRANSPORT_OPTIONS = {
'region': 'eu-central-1',
'polling_interval': 20,
/r/django
https://redd.it/104pw7q
my task:
@shared_task
def my_test():
# Executes every 2 minutes
UserStatisticStatus.objects.filter(id=1).update(loot_boxes=+234)
print('Hello from celery')
app.conf.beat_schedule = {
'my-task-every-10-seconds': {
'task': 'user_statistic_status.tasks.my_test',
'schedule': timedelta(seconds=10)
}
}
my settings:
if 'RDS_DB_NAME' in os.environ:
CELERY_BROKER_URL = 'redis://<myurl>/0'
CELERY_ACCEPT_CONTENT = ['application/json']
CELERY_RESULT_SERIALIZER = 'json'
CELERY_TASK_SERIALIZER = 'json'
CELERY_BROKER_TRANSPORT_OPTIONS = {
'region': 'eu-central-1',
'polling_interval': 20,
/r/django
https://redd.it/104pw7q
reddit
My celery-beat works locally but not in production?
my task: @shared_task def my_test(): # Executes every 2 minutes ...
How to ensure password is hashed when saving User in model?
I'm using Djangos built in BaseUser and Abstract* for this, but when I create user on the model side using
u = User(... password="fsdfsd324")
u.fullclean()
u.save()
The DB still stores it in plain text. I've tried overriding clean and clean\password within the model as I would in forms, but this doesn't work.
What's the cleanest way to do this without Forms/ModelForms? Thanks
/r/django
https://redd.it/104shkm
I'm using Djangos built in BaseUser and Abstract* for this, but when I create user on the model side using
u = User(... password="fsdfsd324")
u.fullclean()
u.save()
The DB still stores it in plain text. I've tried overriding clean and clean\password within the model as I would in forms, but this doesn't work.
What's the cleanest way to do this without Forms/ModelForms? Thanks
/r/django
https://redd.it/104shkm
reddit
How to ensure password is hashed when saving User in model?
I'm using Djangos built in BaseUser and Abstract\* for this, but when I create user on the model side using u = User(......
Cargo Shipping (Export/Import) in Django
Hello good day. i have this project i'm developing and its about exporting and importing like usps/dhl/ups. i have a feature that i want to add but i'm having an issue combining how it will work.
what i want is that i want a user to be able to track the list of items in their order like when a user has taken the items to be sent to another country, to usps, a shipping record should be created with tracking number on it, and once a user clicks on that record on their dashboard, it should display all the items of that shipping on another page. and how can one add multiple items to an order using django forms because the list of items would be added using forms and once saved, a shipping (import or export) history would be created in which users can view on their dashboard, click on any and see the lists of items on their shipping history including payment and all that. thats the issue i have and need clarity on. i'm using mvt.
/r/django
https://redd.it/104r65g
Hello good day. i have this project i'm developing and its about exporting and importing like usps/dhl/ups. i have a feature that i want to add but i'm having an issue combining how it will work.
what i want is that i want a user to be able to track the list of items in their order like when a user has taken the items to be sent to another country, to usps, a shipping record should be created with tracking number on it, and once a user clicks on that record on their dashboard, it should display all the items of that shipping on another page. and how can one add multiple items to an order using django forms because the list of items would be added using forms and once saved, a shipping (import or export) history would be created in which users can view on their dashboard, click on any and see the lists of items on their shipping history including payment and all that. thats the issue i have and need clarity on. i'm using mvt.
/r/django
https://redd.it/104r65g
reddit
Cargo Shipping (Export/Import) in Django
Hello good day. i have this project i'm developing and its about exporting and importing like usps/dhl/ups. i have a feature that i want to add...
Free Copilot-like autocomplete for Jupyter notebooks
Hey everyone! I'm Anshul from the Codeium team, where we are building free AI-powered code autocomplete tooling, and today we are launching our integration on Jupyter notebooks, which has been the biggest ask from data scientists on our Discord since originally launching on VSCode and JetBrains. Currently no other major alternative (Github Copilot, Tabnine, Replit Ghostwriter, etc) supports standalone Jupyter notebooks. Hope you enjoy!
​
https://reddit.com/link/105diit/video/5ppcv2tzajaa1/player
/r/JupyterNotebooks
https://redd.it/105diit
Hey everyone! I'm Anshul from the Codeium team, where we are building free AI-powered code autocomplete tooling, and today we are launching our integration on Jupyter notebooks, which has been the biggest ask from data scientists on our Discord since originally launching on VSCode and JetBrains. Currently no other major alternative (Github Copilot, Tabnine, Replit Ghostwriter, etc) supports standalone Jupyter notebooks. Hope you enjoy!
​
https://reddit.com/link/105diit/video/5ppcv2tzajaa1/player
/r/JupyterNotebooks
https://redd.it/105diit
Codeium
Codeium in Jupyter Notebooks
Launching Codeium in Jupyter Notebooks.
I made a self-hosted full stack kanban-style webapp using Flask and Vue
Hi!
After almost half year I'm ready to share my project. I made a kanban-style webapp which inspired by Trello. Still need a proper project name though (I'm open to suggestions :-) ).
https://preview.redd.it/sbdlw9lrhmaa1.png?width=1920&format=png&auto=webp&s=2e9945b64c937b064027cb671cd48269af69428b
https://preview.redd.it/3acx41lrhmaa1.png?width=1920&format=png&auto=webp&s=3668132fc6ffe1fb03214d3ab9c2fc6c3afa3bec
Stack looks like this:
\- PostgreSQL as database engine
\- Flask as backend using Socket.IO too,
\- Vue 3 with Typescript for frontend (I'm still new to TS and not frontend expert yet)
It's currently on alpha state, check roadmap for planned features.
Project link on Github
/r/flask
https://redd.it/105ozjo
Hi!
After almost half year I'm ready to share my project. I made a kanban-style webapp which inspired by Trello. Still need a proper project name though (I'm open to suggestions :-) ).
https://preview.redd.it/sbdlw9lrhmaa1.png?width=1920&format=png&auto=webp&s=2e9945b64c937b064027cb671cd48269af69428b
https://preview.redd.it/3acx41lrhmaa1.png?width=1920&format=png&auto=webp&s=3668132fc6ffe1fb03214d3ab9c2fc6c3afa3bec
Stack looks like this:
\- PostgreSQL as database engine
\- Flask as backend using Socket.IO too,
\- Vue 3 with Typescript for frontend (I'm still new to TS and not frontend expert yet)
It's currently on alpha state, check roadmap for planned features.
Project link on Github
/r/flask
https://redd.it/105ozjo
Best IDE to practice python as a beginner?
As the title suggests, I am a complete beginner. Which IDE should I use to enhance my learning process?
/r/Python
https://redd.it/105tp9e
As the title suggests, I am a complete beginner. Which IDE should I use to enhance my learning process?
/r/Python
https://redd.it/105tp9e
reddit
Best IDE to practice python as a beginner?
As the title suggests, I am a complete beginner. Which IDE should I use to enhance my learning process?
Does anyone else constantly have problems with Conda conflicts?
Conda is a cool Python environment manager, but it also has some very opinionated ideas about what a valid environment is.
One issue I run into a lot is if you install a newer package on PIP, which works fine mind you. This usually causes a conflict like your current env requiring libgen 3.27, but the package you downloaded using 3.29 for example. At this point your whole conda is nuked and there’s no way to patch the conflict except try to roll back. You can’t just tell conda to mind it’s own business and ignore conflicts because it will never be able to resolve your environment ever again which is the first step of asking conda to do anything.
How would the fine folks at r/Python go about dealing with this?
/r/Python
https://redd.it/105qinj
Conda is a cool Python environment manager, but it also has some very opinionated ideas about what a valid environment is.
One issue I run into a lot is if you install a newer package on PIP, which works fine mind you. This usually causes a conflict like your current env requiring libgen 3.27, but the package you downloaded using 3.29 for example. At this point your whole conda is nuked and there’s no way to patch the conflict except try to roll back. You can’t just tell conda to mind it’s own business and ignore conflicts because it will never be able to resolve your environment ever again which is the first step of asking conda to do anything.
How would the fine folks at r/Python go about dealing with this?
/r/Python
https://redd.it/105qinj
reddit
Does anyone else constantly have problems with Conda conflicts?
Conda is a cool Python environment manager, but it also has some very opinionated ideas about what a valid environment is. One issue I run into a...
I scanned every package on PyPi and found 57 live AWS keys
https://tomforb.es/i-scanned-every-package-on-pypi-and-found-57-live-aws-keys/
/r/Python
https://redd.it/10525zo
https://tomforb.es/i-scanned-every-package-on-pypi-and-found-57-live-aws-keys/
/r/Python
https://redd.it/10525zo
My Infrastructure as Code Rosetta Stone - Deploying the same Django web application on AWS ECS Fargate with CDK, Terraform and Pulumi
https://briancaffey.github.io/2023/01/07/i-deployed-the-same-containerized-serverless-django-app-with-aws-cdk-terraform-and-pulumi/
/r/django
https://redd.it/105w9jf
https://briancaffey.github.io/2023/01/07/i-deployed-the-same-containerized-serverless-django-app-with-aws-cdk-terraform-and-pulumi/
/r/django
https://redd.it/105w9jf
briancaffey.github.io
My Infrastructure as Code Rosetta Stone - Deploying the same web application on AWS ECS Fargate with CDK, Terraform and Pulumi
Three reusable infrastructure as code libraries for abstracting containerized web app architecture on AWS ECS
Released a new update for my visual website builder, looking for some feedback!
https://reddit.com/link/105pm8v/video/slfg8d1cnmaa1/player
We posted in here a few months ago and got some awesome reception for our project, Nimbus. We're excited to announce the latest update to Nimbus, our visual website builder that exports to perfect React code (and more coming soon!). Built with Django, Nimbus makes it easy for developers of all levels to create and maintain professional websites.
With this update, we've added a couple of new features that we think users will find useful. First up, we've improved the user interface to make it even easier to use. We've also added one click previews, which allow you to see what your site will look like without having to constantly export. This should save you some time and make the building process even smoother.
The next thing we're going to work on is adding custom code so you never have to leave Nimbus when building a site. You'll be able to add custom functions, API calls, etc. right from Nimbus! It will take some time to develop but it's going to be awesome.
We hope you find these updates useful. As always, we appreciate your feedback and suggestions and feel free to ask me questions about how it works, I'm
/r/django
https://redd.it/105pm8v
https://reddit.com/link/105pm8v/video/slfg8d1cnmaa1/player
We posted in here a few months ago and got some awesome reception for our project, Nimbus. We're excited to announce the latest update to Nimbus, our visual website builder that exports to perfect React code (and more coming soon!). Built with Django, Nimbus makes it easy for developers of all levels to create and maintain professional websites.
With this update, we've added a couple of new features that we think users will find useful. First up, we've improved the user interface to make it even easier to use. We've also added one click previews, which allow you to see what your site will look like without having to constantly export. This should save you some time and make the building process even smoother.
The next thing we're going to work on is adding custom code so you never have to leave Nimbus when building a site. You'll be able to add custom functions, API calls, etc. right from Nimbus! It will take some time to develop but it's going to be awesome.
We hope you find these updates useful. As always, we appreciate your feedback and suggestions and feel free to ask me questions about how it works, I'm
/r/django
https://redd.it/105pm8v
How do I "flatten" a nested serializer in DRF?
We have a nested serializer that we would like to "flatten". But I'm not having much luck finding how to achieve this in the docs.
Here is the current output.
{
"user_inventory": "UOHvaxFa11R5Z0bPYuihP0RKocn2",
"quantity": 1,
"player": {
"card_id": "c69c0808328fdc3e3f3ee8b9b7d4a7f8",
"game": "MLB The Show 22",
"name": "Jesus Tinoco",
"all_positions": [
"CP"
]
}
}
Here is what I'd like:
{
"user_inventory": "UOHvaxFa11R5Z0bPYuihP0RKocn2",
"quantity": 1,
"card_id": "c69c0808328fdc3e3f3ee8b9b7d4a7f8",
"game": "MLB
/r/django
https://redd.it/1061nro
We have a nested serializer that we would like to "flatten". But I'm not having much luck finding how to achieve this in the docs.
Here is the current output.
{
"user_inventory": "UOHvaxFa11R5Z0bPYuihP0RKocn2",
"quantity": 1,
"player": {
"card_id": "c69c0808328fdc3e3f3ee8b9b7d4a7f8",
"game": "MLB The Show 22",
"name": "Jesus Tinoco",
"all_positions": [
"CP"
]
}
}
Here is what I'd like:
{
"user_inventory": "UOHvaxFa11R5Z0bPYuihP0RKocn2",
"quantity": 1,
"card_id": "c69c0808328fdc3e3f3ee8b9b7d4a7f8",
"game": "MLB
/r/django
https://redd.it/1061nro
reddit
How do I "flatten" a nested serializer in DRF?
We have a nested serializer that we would like to "flatten". But I'm not having much luck finding how to achieve this in the docs. Here is the...
How do you guys host your Django apps?
Hey guys, I recently picked up Django and just finished my first small web app. I ended up hosting it on Digital Ocean App Platform but had trouble setting up a cron job to run some scripts periodically (app platform doesn't have crontab and you can't install it with apt-get).
To avoid such issues down the line I'm considering switching to another platform for hosting. What platforms have you guys had success with and would recommend?
/r/django
https://redd.it/105mcot
Hey guys, I recently picked up Django and just finished my first small web app. I ended up hosting it on Digital Ocean App Platform but had trouble setting up a cron job to run some scripts periodically (app platform doesn't have crontab and you can't install it with apt-get).
To avoid such issues down the line I'm considering switching to another platform for hosting. What platforms have you guys had success with and would recommend?
/r/django
https://redd.it/105mcot
reddit
How do you guys host your Django apps?
Hey guys, I recently picked up Django and just finished my first small web app. I ended up hosting it on Digital Ocean App Platform but had...
Family Tree
Hello guys, I wanted to create a little project for myself. I wanted to create different interactive family trees (ex.: Simpsons, Game of Thrones, Naruto , etc). Could find any resources of where and how to start. Are they any tips you could give me?
/r/django
https://redd.it/105y7co
Hello guys, I wanted to create a little project for myself. I wanted to create different interactive family trees (ex.: Simpsons, Game of Thrones, Naruto , etc). Could find any resources of where and how to start. Are they any tips you could give me?
/r/django
https://redd.it/105y7co
reddit
Family Tree
Hello guys, I wanted to create a little project for myself. I wanted to create different interactive family trees (ex.: Simpsons, Game of Thrones,...
Error with docker and heroku hosting
Hello everyone, I'm trying to build a django app and host it on heroku & my home server using docker, I build a new one with truenas scale, when I'm trying to push the files to heroku the error "App not compatible with buildpack" comes and I don't know why and no tutorial worked with me, same thing with docker not working with me and just gives errors, I creat requirements.txt and still errors, help me please
/r/django
https://redd.it/105y5g4
Hello everyone, I'm trying to build a django app and host it on heroku & my home server using docker, I build a new one with truenas scale, when I'm trying to push the files to heroku the error "App not compatible with buildpack" comes and I don't know why and no tutorial worked with me, same thing with docker not working with me and just gives errors, I creat requirements.txt and still errors, help me please
/r/django
https://redd.it/105y5g4
reddit
Error with docker and heroku hosting
Hello everyone, I'm trying to build a django app and host it on heroku & my home server using docker, I build a new one with truenas scale, when...
Any free apps that allow custom html page creation?
I am looking for a way to create new pages in my django project through the admin panel. So I will log into admin panel and go to the section to create a new page. I will put in the title to the page and then be given a text area where I can put HTML or possibly have a WYSIWYG editor. After I save then it will create a new html page. Then I add the page to my header and it navigates to it.
Sort of like a blog but I am making new web pages instead of posts.
This is to prevent me from having to manually create a new html file in the server and make changes to it. I want to be able to handle it all from the Django admin panel.
/r/django
https://redd.it/105vkd9
I am looking for a way to create new pages in my django project through the admin panel. So I will log into admin panel and go to the section to create a new page. I will put in the title to the page and then be given a text area where I can put HTML or possibly have a WYSIWYG editor. After I save then it will create a new html page. Then I add the page to my header and it navigates to it.
Sort of like a blog but I am making new web pages instead of posts.
This is to prevent me from having to manually create a new html file in the server and make changes to it. I want to be able to handle it all from the Django admin panel.
/r/django
https://redd.it/105vkd9
reddit
Any free apps that allow custom html page creation?
I am looking for a way to create new pages in my django project through the admin panel. So I will log into admin panel and go to the section to...