Д
then a plain Serializer, not a ModelSerializer
Bazaroph
ok thank you
Bazaroph
but how to receive data with a post by frontend
LIBIN
Django and react all in one and hosted to aws ec2 using nginx. I accessed all the apis no issue but the home page for react is blank any idea
Shahin
Hi
Can I ask a question?
I want to use pagination in my blog in this way:
I want to open a post in blog page and it goes to 127.0.0.1:8000/blog/number of post
I want to check that if has next post and if has previous post show me
Maram
ГуНиСе️
ГуНиСе️
ГуНиСе️
but the important thing is what a programmer types and sees in editor
Tchondo
Hi guys for my own training I want to make a whatsapp bot with flask or Django and I have just discovered twilio. I wonder if someone doesn't know something else ? Thk
Charly
Charly
Charly
Tchondo
still not a question
I want to know if some know something else because twilio is not easy to custom
Tchondo
Tchondo
Not for telegram it is whatasapp bot
Doragonsureiyā
This is not a Python specific question, please delete your offtopic message, move to @PythonOfftopic and ask there.
Mister
hello guys are good open source projects on django?
Charly
Suraj
Urgent help needed_ Site can't be reached error after running wsgi.py file.
Please suggest
Suraj
I have allowed all hosts and I'm using waitress
Mister
Charly
Mister
I meant your page
Charly
I was pointing that there are tons of projects on github
Mister
I was looking for well-written projects to learn
Mister
Mister
Thanks
Shreyas
Guys I need your Help.... Which YouTube channel or Course I should I refer to learn django from a beginner to pro.
Shreyas
Thank you!
Vikas
And drf how to creat a drf api and master it please
Vikas
How to build api
Phansivang
Hello guys please help me When i delete the post in my model but the primary key or the URL of ordering my post still there . I mean when I post something and the link will be example / post/12 but when i delete that post and start new post the link still keep going like post/13 . so my main questions is how can do i restart that PK or that list of post after deleted?
Rohan
Rohan
Why would you care about pk always being sequential
Rohan
Imagine you had 1 million posts. You delete, say number 12
Rohan
Do you want all posts after 12 to shift (n-1)
Phansivang
You don’t.
thanks you so much i'm clear now
RedPilledRebels
@aaxxios
models.py
from django.contrib.auth.models import User
class Customer(models.Model):
user = models.OneToOneField(User, null=True, Blank=True, on_delete=models.CASCADE, related_name="customer", related_query_name="customer")
class Order(models.Model):
customer = models.ForeignKey(Customer, on_delete=models.SET_NULL, null=True, blank=True)
views.py
customer = request.user.customer
<--- This is supposedly the error
order, created = Order.objects.get_or_create(customer=customer, complete=False)
Everytime I referance
request.user.customer
I get an error which says:
Related Object Does Not Exist
User has no customer
How do I create a link between user and customer?
ГуНиСе️
ГуНиСе️
you can even recalculate ids with
ALTER SEQUENCE post_id_seq RESTART;
UPDATE post SET id = DEFAULT;
Phansivang
Anonymous
@aaxxios
models.py
from django.contrib.auth.models import User
class Customer(models.Model):
user = models.OneToOneField(User, null=True, Blank=True, on_delete=models.CASCADE, related_name="customer", related_query_name="customer")
class Order(models.Model):
customer = models.ForeignKey(Customer, on_delete=models.SET_NULL, null=True, blank=True)
views.py
customer = request.user.customer
<--- This is supposedly the error
order, created = Order.objects.get_or_create(customer=customer, complete=False)
Everytime I referance
request.user.customer
I get an error which says:
Related Object Does Not Exist
User has no customer
How do I create a link between user and customer?
You have to put a foreign key field in your customer model and set the related name to customer
Anonymous
So what then do you refer to as customer?
Vansh
Any Indians Here 🇮🇳..?
RedPilledRebels
@aaxxios you're so helpful, excuse my noobness 😂 so what you're saying is that my OneToOneField has to change into ForeignKey in order for me too referance user.customer?
RedPilledRebels
Or should I create an Abstract User? And include customer inside of it?
Anonymous
RedPilledRebels
I understand that Customer model needs a ForeignKey, does this mean that OneToOne should be replaced?
Ivan
@aaxxios
models.py
from django.contrib.auth.models import User
class Customer(models.Model):
user = models.OneToOneField(User, null=True, Blank=True, on_delete=models.CASCADE, related_name="customer", related_query_name="customer")
class Order(models.Model):
customer = models.ForeignKey(Customer, on_delete=models.SET_NULL, null=True, blank=True)
views.py
customer = request.user.customer
<--- This is supposedly the error
order, created = Order.objects.get_or_create(customer=customer, complete=False)
Everytime I referance
request.user.customer
I get an error which says:
Related Object Does Not Exist
User has no customer
How do I create a link between user and customer?
Try this
customer = request.user.customer.get(user=user)
Ivan
Menu Rekt
Hi guys is there a french group?
Vansh
Earnn
Rajat
Please anyone can help me to deploy django project with mySql
Anonymous
RedPilledRebels
It's my fault for not being more precise @aaxxios this is an e-commerce store
Anonymous
RedPilledRebels
OK good luck!
I appreciate your help @aaxxios thank you
Anonymous
Best machin lerrning Tutorial please
Doragonsureiyā
Best machin lerrning Tutorial please
Your question is not related to Django.
If it's a Python related question go to @Python group, otherwise please move to @PythonOfftopic group and ask there.
Sleeping
i am getting this problem