Anonymous
I uploaded image on database but it's not showing on browser
Anonymous
I have applied media settings
Anonymous
Yes
William
Share your code
Joel
Show me your model
class Variedad(models.Model): # Publisher id = models.AutoField(primary_key=True) cod = models.CharField(max_length=10, blank=True, null=True) descrip = models.CharField(max_length=30, blank=True, null=True) estado = models.CharField(max_length=1, blank=True, null=True) class Meta: managed = False db_table = 'variedad' class Lineas(models.Model): # Book id = models.AutoField(primary_key=True) cod = models.CharField(max_length=2, blank=True, null=True) hilera = models.IntegerField(blank=True, null=True) id_variedad = models.ForeignKey('Variedad', on_delete=models.CASCADE) estado = models.CharField(max_length=1, blank=True, null=True) class Meta: managed = False db_table = 'lineas'
Joel
So you want to get data from Variadad by using id_variedad?
Yes, but when I bring the data I get an error that is not valid id_variedad_id because the "_id" is added automatically by Django
Joel
I want to bring all the "Lineas" with their respective "Variedad"
James
Yes, but when I bring the data I get an error that is not valid id_variedad_id because the "_id" is added automatically by Django
data = Lineas.objects.all() In your template {%for key in data%} {{Key.id_variedad.cod}} // Retrieving Variedad Data {%endfor%}
Nilou
Hi guys, how can we know mobile’s location on map with python ?
Joel
data = Lineas.objects.all() In your template {%for key in data%} {{Key.id_variedad.cod}} // Retrieving Variedad Data {%endfor%}
Then you might not have the option to do the following: queryset = Lines.objects.select_related('id_variedad')
Eng. Mohamed
Hi guys, how can we know mobile’s location on map with python ?
https://www.delftstack.com/howto/python/get-ip-address-python/
Eng. Mohamed
Eng. Mohamed
Eng. Mohamed
https://ipstack.com/
or any similar site
Nilou
Thx a lot, IP is only way ? Is there another way for it ?
Nilou
I have a python project that has mobile tracking I need to know mobile location
Владислав
Guys, I'm very dumb today, so I'm asking for help. You can call category = Category.objects.get (slug = self.kwargs ['category_slug']) once in the ListView and use it everywhere, in the context, in the queryset https://dpaste.com/DYMPAG8NM
Владислав
i call category = Category.objects.get () 3 times This adds me 3 duplicate SQL queries, which I don't really like as I only have 11 sql queries per page usually, with select_related / prefetch_realted
Владислав
okey
Alex
i call category = Category.objects.get () 3 times This adds me 3 duplicate SQL queries, which I don't really like as I only have 11 sql queries per page usually, with select_related / prefetch_realted
1 The simplest way will be to keep that category var in the view instance itself. def get(self, *args, **kwargs): self.category = Category.objects.get(slug=self.kwargs['category_slug'])
Владислав
thanks a lot for the hint!
Alex
thanks a lot for the hint!
each call of django's View creates a new view instance. So they are theadsafe that way. And session safe, I guess.
Владислав
Great, I did as you said and it worked! Thank you very much.
Владислав
And this is also the idea behind View.as_view (). I'll try too
Владислав
-3 sql, nice
Владислав
thanks you very much!
Ilya
hi all. heed help. https://stackoverflow.com/questions/68844249/django-change-hasher-algorithm-for-user-password
Rahul
yes
Alex
Hi guys. What is the difference between TestCase and SimpleTestCase? In test writing
https://docs.djangoproject.com/en/3.2/topics/testing/tools/#testcase This is the most common class to use for writing tests in Django. It inherits from TransactionTestCase (and by extension SimpleTestCase). If your Django application doesn’t use a database, use SimpleTestCase. The class: Wraps the tests within two nested atomic() blocks: one for the whole class and one for each test. Therefore, if you want to test some specific database transaction behavior, use TransactionTestCase. Checks deferrable database constraints at the end of each test.
Prem
Django framework work books name plsss
Alex
Hi guys. What is the difference between TestCase and SimpleTestCase? In test writing
So in short - SimpleTestCase is a descendant of unittest.TestCase that has some django specific asserts and includes test client for integrational tests of you views. django.TestCase adds proper support of test databases.
Prem
Pls tell me
Prem
I want django book name
Prem
Tutorial book django
Mirco
Django framework work books name plsss
Django for Beginners Django by Example
Prem
Link are sent this???
Alex
So I can also use SimpleTestCase for the url
If there are no db actions involved, then I guess - yes.
..
Hey Guys! I am very new to django and I have a rather basic question. I want to handle a get response which is for searching a name in username list. So I guess the url pattern is sth like "http://127.0.0.1:8000/users/searchusers?page=1 , limit = 0 /name" name is an example for searched keyword.
..
Is this right?
Alex
Because you probably want to store it somewhere.
Bwaks
Hey I moved a project with USB flash disk to another machine.....commands runserver and makemigrations and migrate works but pip install anything does not what might be the problem
Alex
Hey I moved a project with USB flash disk to another machine.....commands runserver and makemigrations and migrate works but pip install anything does not what might be the problem
0 Use git to transfer your projects. 1 Virtualenvs cannot be moved. Neither to other machine nor OS. At least they are not intended for that.
Bwaks
Now that what I have never came from git how can I solve it
Sorry now that the project never came from git how to solve it
XTM
Hi, any solution for advanced searching/filtering in django admin? (better than django-advanced-filters) Thanks
Anonymous
i made charfield as primary key and unable to pass charfield in url dispacher can any one share how can i pass charfield in urldispacher field
Charles
I uploaded image on database but it's not showing on browser
Add .url when calling image field in your django template. Eg {{ names_of_arg.image.url }} You can send a DM if that doesn't solve the issue
XTM
> define "advanced"
Filtering fields and combining them Field contains xx AND field dont contains "xx" OR field is false Cant send screenshot of something alike.
Alex
Filtering fields and combining them Field contains xx AND field dont contains "xx" OR field is false Cant send screenshot of something alike.
try to google smt like "djanog admin search syntax". I found this https://github.com/ivelum/djangoql P.S. thx admins for turning off attachments.
XTM
try to google smt like "djanog admin search syntax". I found this https://github.com/ivelum/djangoql P.S. thx admins for turning off attachments.
cool, thanks. It seems useful But I'd like an interface to handle this. django-advanced-filters does it, but it has some problems.
XTM
🤷‍♂️
just seems strange that there's not a powerfull and easy way to search in django admin
p
hi team I am getting cx oracle error not finding library
p
even after adding it
p
any help
Nursultan
Hello guys everyone! There is such a problem There is a Seller model (inherited from the user), There is an Auto model and there is a Picture model. The seller can have as many cars as he wants, but the car has only one owner A car can have as many pictures as you like, but each picture belongs to only one car It is necessary to make a form when an authorized seller goes to the VehicleCreateView (Class Based View) page and creates a car there in the form and can immediately upload pictures for this car in the same form How do I code this form? How to google it?
Sreekanth
Hi, anyone knows how to deploy a django project..pls tell me..
Rahul
whats the hardware config requires to deploy celery? my server is crashing on 2gb ram
Rahul
using digital ocean droplet
Shahar
Is there any decorator to allow only GET and Ajax requests from a certain view?
..
Or it's the whole url? 127.0.0.1:8000/users/searchusers?page=1limit=0/name"
Thanks. for such url How should I define the url pattern in urls.py? is this right? path('users/searchusers<int:page><int:limit>/<str:searched_term>', views.search_users),
jūdê
Any resource on using JWT with custom User? My head hurts
jūdê
Any resource on using JWT with custom User? My head hurts
Logging in and Registering with custom User