Darth✧
try to stop you local env
I m using remote host in pycharm .....while being in production env I can do computation tasks without using local ram and cpu etc
Darth✧
My machine ram is being consumed when computation is being performing at backend instead of ec2 resources
But when req sent by me ...almost .98% of ram being used from local m/c
Charly
how are you sending that request?
Darth✧
how are you sending that request?
In pycharm ....set the interpreter as remote host intrpreter
Charly
I mean if is django, do you use a browser to send a request?
Charly
Yes obviously
so is it a form? is it a view? is it an ajax request?
Charly
so youopen a tab on your browser using the ip of your ec2 machine?
Darth✧
Getting user input from form and then performed tasks in view and connect template to.show output
Ehsan
hello i make a project by django how can i set setting for upload on server?
Samuell
hey, good morning my friends, how are u? I'm with problems. I'm not getting to install the psycopg2 (postgree for python). Can someone help me?
Samuell
I have the printscreen but is not allowed shared in the group...
Doragonsureiyā
I have the printscreen but is not allowed shared in the group...
To share code or error tracebacks please use an online pasting service, here is a list of suggested sites: - https://del.dog - https://dpaste.org - https://linkode.org - https://hastebin.com - https://bin.kv2.dev
Doragonsureiyā
I have the printscreen but is not allowed shared in the group...
Read the rules before any activity: @PythonRules
Darth✧
hey, good morning my friends, how are u? I'm with problems. I'm not getting to install the psycopg2 (postgree for python). Can someone help me?
for linux sudo apt-get update sudo apt install libpq-dev python3.x -m pip install psycopg2 Try this once
Samuell
as it would be on windows
Darth✧
as it would be on windows
Ohh then wait for the answer or give some time to the stack overflow or u can try 3rd command .
Baggy ️️
Hey guys,just needed small help
Baggy ️️
How to share blog articles on WhatsApp and facebook
Baggy ️️
Any ideas?
Baggy ️️
Currently I am using django-social-share
Baggy ️️
But it just sends the URL text
Anonymous
you cant share on whatsapp it has no api
Baggy ️️
No we can
Baggy ️️
I am able to share
Baggy ️️
But it's just pasting the URL in input
Baggy ️️
Has anyone implemented this
Magsad
Hello guys. I am newbie in django. I am looking for best django book to learn. Who can advice a book?
Украинский
Hello guys. I am newbie in django. I am looking for best django book to learn. Who can advice a book?
Django for Beginners of William S Vincent Django for Professionals of William S Vincent Django 2 by example of Antonio Mele Thats all books that I know (very useful books. Check them out)
Javad
anybody can help me with this? cant find the solution anywhere(( ValueError at /cart Cannot query "anvarovich": Must be "User" instance.
Sh
sure
what do u mean?
Sh
sure
can u imagine somebody solve your problem without reading your code
Javad
what do u mean?
# 1 Customer class Customer(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE, null=True, blank=True) name = models.CharField(max_length=200, null=True) email = models.CharField(max_length=200, null=True) def str(self): return self.name # 2 Order class Order(models.Model): customer = models.ForeignKey(User, on_delete=models.SET_NULL, null=True, blank=True) date_ordered = models.DateTimeField(auto_now_add=True) complete = models.BooleanField(default=False, null=True, blank=False) transaction_id = models.CharField(max_length=200, null=True) def str(self): return str(self.id) # 3 OrderItem class OrderItem(models.Model): product = models.ForeignKey(Product, on_delete=models.SET_NULL, null=True, blank=True) order = models.ForeignKey(Order, on_delete=models.SET_NULL, null=True, blank=True) qty = models.IntegerField(default=0, null=True, blank=True) date_added = models.DateTimeField(auto_now_add=True)
Javad
what do u mean?
def cart(request): if request.user.is_authenticated: customer = request.user.customer order, created = Order.objects.get_or_create(customer=customer, complete=False) items = order.orderitem_set.all() else: items = [] context = {'items': items} return render(request, 'cart.html', context)
Sh
you want to get one customer from user without filtering actual customer
Javad
yes here shoulde error. what do u what to do?
im trying to check if the user is auth and to add items in cart! but getting that error
Javad
yes here shoulde error. what do u what to do?
well im newbie in django so that's why got stuck))
Sh
check with is_authenticated.
that error is not for that, error for queryset
Javad
that error is not for that, error for queryset
so what to do?)) what to change or check?))
Javad
that error is not for that, error for queryset
as a user or customer i just used my admin login is that can cause the issue?
Sadra
You need to turn back a User instance but you are turning back a customer instance. (maybe something else)
Sadra
so how to tern back to user instance?
just create its object. user = User.object.get(username=request.user) order = Order.objects.get_or_create(customer=user, complete=False)
Zulfikar
I have a error in BaseUserManager when i create django custom user with AbstractBaseUser Error: SyntaxError: non-default argument follows default argument Code: https://pastebin.com/C95Qp7aJ
Ken
Hi guys, can someone help me get around this. I'm performing some annotations and when I get the result, I want to perform another annotation based on a field in the result.
Ken
so like double annotation Code sample is here. https://codeshare.io/2jypBL
Ken
I appreciate in advance.
Ken
so far, I get result from the first annotation but can't perform the second.
Sh
as a user or customer i just used my admin login is that can cause the issue?
friend can u tell what are u going to do with this function?
Sh
lets say u have one user and this user can have multiple customers yes?
Javad
I will do this on html file also
this was set to User customer = models.ForeignKey(User, on_delete=models.SET_NULL, null=True, blank=True)
Javad
I will do this on html file also
so i changed to customer = models.ForeignKey(Customer, on_delete=models.SET_NULL, null=True, blank=True)
Anonymous
{% if user.is_authenticated %} Show that u want {% else %} Show other thing {% endif %}
Javad
Anonymous
Hi I'm trying to take user input in DRF views. For example class get_accounts_metrics(APIView): def get(self,request): name = user-input date = user-input '''do something with name & date''' return Response(something) My question is how to take user input in views without using serializer
Anonymous
It's working
usEr1024
I am building a django backend webapp for a learning management system. I want to track if a user has completed a lesson and add a status of "completed" in the lesson json data. Any help on that?
A..
Hi guys .. Please how convert my web django project to mobile app ... Beacuse it is very hard to build my project from the first