Mirco
ı use this style
it's better u study a bit database theory before going deeper in Django or other frameworks
cj
class Product(models.Model): category = models.ForeignKey(Category, related_name='Boats', on_delete = models.CASCADE)
that means a Product is only of one category, you'd better learn some database relations first before trying to write code
Anonymous
ı use this style
look which I send dummy code
Anonymous
we have one boat but have 3 location
cj
we have one boat but have 3 location
first learn some database theory —as Mirco told you— before trying to write code directly
Anonymous
we have one boat but have 3 location
friend you did not hear what we wrote
Jay
we have one boat but have 3 location
Give the boat a foreign key to categories. Then on th categories model have the 3 categories
cj
How can I filter all the products by category, from this model.
category.product_set.all() but that's not what he wants
Jay
How can I filter all the products by category, from this model.
Product.objects.filter( category__name__contains="Foo" )
Fredy
thanks
jabir
Guys, how to develop a messaging app like whatsup using Django rest framework??
jabir
Have any 3rd party packages??
VarunTheLord
cj
oh I found it, whatsup is an english academy website
jabir
Sorry my mistake not whatsup it 'whatsapp'
cj
Sorry my mistake not whatsup it 'whatsapp'
ah, so you want to create a WhatsApp like chat website with Django? there are many projects for that on GitHub, you should search for them there 🤷🏻‍♂️
Creator
Hey there I am Generating *unique_id* & wants to set it as a *_unique like primary key_* but i have already defined *p_id* as _*primary key*_ in my product model what should i do ❓
Jay
Do you want to create another model field for the id or update the p_id with the generated unique_id?
Hamidreza
Can a user have multiple profiles? The meaning of the profiles of the fields added to the Django user table is
Anonymous
Hello guys, so I have a Django website that live on heroku free tier that use mongoDB. And my problem is that website load extremely slow. So my question is, is that a problem with my code, heroku free tier, mongoDB, or that is a normal speed for a free tier heroku. But I dont think my code is the problem here, since my website work really well at my local computer. Im sorry if this is sounds really vague, im just not experienced with hosting website.
Anonymous
If anyone want the link to my heroku website: rei-pw.herokuapp.com and use 11111 as 'Nomor Induk' and walikelas1 as Password
Way
Has anyone worked in django with tempfile? In general, nothing is clear. If I import tempfile explicitly, then everything is clear If I import it from django.core.files.temp, then the NamedTemporaryFile object becomes the TemporaryFile type, and no longer has the delete argument in the init, although the code there is primitive ... As if djanga itself then redefines it somewhere else import tempfile NamedTemporaryFile = tempfile.NamedTemporaryFile gettempdir = tempfile.gettempdir Then the name. I print gettempdir, I see a normal path But after saving, when I output var.name, for some reason mediafiles / D: / ... / ... is added to the beginning of the path. What is happening ???
Shubham
https://github.com/101Loop/drf_paytm
Shubham
I am refering this for payment integration, but not getting where is manage.py
Shubham
could you please check?
Shubham
got it
Shubham
apologies for the silliest mistake
master-mn
Hello everyone I deployed my test project on VPS - everything worked fine I decided to add SSL and stopped working, or rather, the main page I just have authorization, it opens via https, but as the current I do Login then: Forbidden (403) CSRF verification failed. Request aborted. if I go to http: // .... then everything is buzzing but as a current https: // .... then: Forbidden (403) CSRF verification failed. Request aborted. Can anyone tell me how to solve?
Yevgeny
Hi, I'm using MPTT for tree model in django. How can I get all tree of a child releted only to it?
Роман
Hello Tell me please is it possible to somehow embed FormView into View? class BaseFormView(FormView): template_name = 'pit/contact.html' form_class = ContactForm success_url = '/' def form_valid(self, form): return super().form_valid(form) class TestView(View): template_name = loader.get_template('pit/pit.html') title = "test" def get(self, request, *args, **kwargs): view = BaseFormView() context = {"title": self.title, "view": view} return HttpResponse(self.template_name.render(context, request))
master-mn
u need to align Django settings for SSL
that's what I understood ) can you give me some references on how this is done? maybe there are some articles on the internet?
Mirkənan
Django docs: In this example, an Article can be published in multiple Publication objects, and a Publication has multiple Article objects: class Publication(models.Model): title = models.CharField(max_length=30) class Article(models.Model): headline = models.CharField(max_length=100) publications = models.ManyToManyField(Publication) So my question is it would not matter if I would put "articles" in Publication model, right?
Mirkənan
we would still get many-to-many relationship, right?
Mirkənan
Like this: class Publication(models.Model): title = models.CharField(max_length=30) articles = models.ManyToManyField(Article) class Article(models.Model): headline = models.CharField(max_length=100)
ㅤㅤㅤ
{% block content %} <h1> ‘hi’ </h1> {% endblock %} What a difference 👆🏻👇🏻 <h1> ‘hi’ </h1> Please
Vladislav
{% block content %} <h1> ‘hi’ </h1> {% endblock %} What a difference 👆🏻👇🏻 <h1> ‘hi’ </h1> Please
First you use inheritance of templates It allows you don’t duplicate the same code in HTML In my mind you need read the docs because your question is basic thing and explain it too long
Yevgeny
For example, given the tree: Item A Item A.1 Item A.1.2 Item A.1.3 Item A.1.4 Item A.1.5 How I can get all tree object of Item A.1.4 and all tree fields without Item A.1.5 in it.
Николай
Hello! I want to use django_push_notifications to save device tokens for non authenticated users. Is it possible without overriding default methods?
Yevgeny
For example, given the tree: Item A Item A.1 Item A.1.2 Item A.1.3 Item A.1.4 Item A.1.5 How I can get all tree object of Item A.1.4 and all tree fields without Item A.1.5 in it. https://del.dog/alaboxengo
Yevgeny
https://del.dog/alaboxengo
Bahar
hey guys. I have implemented reset password in my django project. but it doesn't send any link to receiver email! it send a message to the sender email that says the receiver email has been blocked. do you know what can I do?
Bahar
Amr
Have anyone here faced a problem like that (django.db.utils.OperationalError: (1054, "Unknown column 'patientdata_pasthistory.remarknote' in 'field list'"))
Amr
this is the error.log of pythonanywhere.com ...... i hosted my app there
Amr
does this problem have a relation with putting a default value to this column in MySQL ???
Amr
I'm using Postgresql in my local machine .... put on pythonanywhere I'm using MySQL
Titus
arr= [[1,2], [3,4], [5,6]] how can I join this into one array
Orbit
Hi there. Can someone please tell me how to put database configuration files as secret files? Thanks in advance
dominic
arr= [[1,2], [3,4], [5,6]] how can I join this into one array
array=[] for i in arr: array.extend(i) This might work
Titus
How can I get the nth largest number in a array of integers e.g arr = [1,2,3,4,5,6] if n=1 1st largest=6, if n=3 3rd largest=4 and if n=7 return-1
~~~
how to design online booking system in django...i am a beginner and trying to create a online sports turf booking system to practice...i am stuck at creating model for turfs...how to make time and available slots model
h
How can I get the nth largest number in a array of integers e.g arr = [1,2,3,4,5,6] if n=1 1st largest=6, if n=3 3rd largest=4 and if n=7 return-1
Just sort the array and after that i will be the largest ith number. Also i don't think so this is the right place to ask this question here you should ask django related doubt. Peace. Thanks
Arbeit
Is it possible to use apps like microservices?
luci._
hello
luci._
i have a question,
luci._
I hope they are well. I wanted to comment on an issue that I am having when trying to raise a Celery Worker, it performs the task but does not show it in query, that is, when I raise the worker with make celery it should show something like this: [2019-08-04 01: 42: 01,589: INFO / MainProcess] Received task: celery_tasks.tasks.my_task6 [99b9f858-6bb8-47dc-b47f-d3b8b6b3f6bf] but instead it doesn't show anything, but as mentioned, it does perform the task. If we do get () to the task, the result is displayed, but absolutely nothing is logged, the worker does not say Any info, data or recommendation would be appreciated
luci._
im working with celery 4, reddis and docker
luci._
i only need a one idea
Akash
Use python automation using selenium
Selenium ? How would I schedule the function to run every morning using selenium ?