Anonymous
Here is a snippet from my settings.py file and a snippet, from my urls.py and from my model.py and views.py. I tried everything I could but again can't display images (uploaded to my admin site) in user-site.
Dev4vin
Need help here
Dev4vin
Hello guys, I need some help here
Dev4vin
Kindly take a look at my question here https://stackoverflow.com/q/57284734/10701409
Mihail
Hey there! I have to fields in a Model: team1 & team2 Now I what to create a game for team1 & team2 but I what that Django to check if id for team1 is the same as team2 to raise an exception and not allow to create a new filed in DB. Where in the docs should I search, I’m using the drf also. Thanks
None
Hello. What's best practice for such case? I have duplicated models in different projects but database is only one. How can I apply migrations at once to all projects?
None
yes. It will keep duplicated after migration
elioni
How to return form data as json response?
elioni
Help guys..
Mirco
Instead of HttpResponse
elioni
Yes i used jsonresponse
Mirco
And ?
elioni
But i don't know the steps
elioni
To get the data
elioni
From form
Mirco
what do you have to do with that data ? display them somewhere ?
Anonymous
Any Complete resource for Dockerizing Django ?
Log
Hi everyone, I need a consultant on django. I try to explain the problem... I have configured django on a remote machine, and with nginx I do the reverse proxy on the ip of the machine to interface with django, and so far everything is ok. What I am not succeeding in doing is to get me to return under a url declared in the urls.py of diango the http response of a process that is listening on localhost of the remote machine on which it is also configured django.
Mohit
What should I use for connection pooling with django ?
ಶಶಾಂಕ್
In django if I use multiple data it will store in default so how to fetch data from it to other database
ಶಶಾಂಕ್
Multiple database
Muflone
Multiple database
There's an official guide how to use multiple databases with Django. Just be sure don't place relations between tables across two databases
Tags
Hi everyone. In terms of speed which is better? 1. class FooSerializer(serializers.ModelSerializer): bar = BarSerializer(required=False) 2. class FooSerializer(serializers.ModelSerializer): def to_representation(self, instance): bar = { 'id': 1, 'name': 'foobar', }
godmode
This is maybe a stupid question, but what kind if apps can you make with Django+Rest compare to Django alone... You know any example of api app?
godmode
Cuz i've been reading about... But ain't get the concept of api App...
Muflone
Asynchronous requests. The most simple example is the hierarchical country -> city relation
Muflone
You choose the country and the client sends an asynchronous requests to the server API to get the related cities
Muflone
Is it doable without DRF? Surely but you have to create a lot of stuff already implemented in DRF
godmode
Umm
godmode
Ok, i get it...
Shaun
Easiest thing to think of is AJAX requests to your Rest backend. Typcailly your app will be a mix ofDjango pages and some rest.
Shaun
Javascript has fetch() No need of AJAX
I was just using it to illustrate the a simple use case
Mirco
I was just using it to illustrate the a simple use case
absolutely 😃 but better mentioning new stuff
PyCoder
Course link or tutorial for beginners please
Doragonsureiyā
Course link or tutorial for beginners please
Check out PythonRes, a channel for Python resources (links to help you out).
PyCoder
!res
What?
أمجد☄
Using RegexValidator on your field
My field is the User model given by django so how can i add a regex validation into it ?
Shaun
absolutely 😃 but better mentioning new stuff
I didn’t even know about it. I learned something new!
Anonymous
Okay, Django Champions
Anonymous
Can anyone suggest me a realtime connection solution with Django?
Anonymous
Like I have to connect with a mobile software and then get stats in realtime.
Mirco
django-channels 2
Anonymous
Ha!
Anonymous
I myself used to suggest it to people.
Anonymous
😃
Have you used it for this case though?
Mirco
Have you used it for this case though?
Not yet, but I've done a workshop where we use it to do something like Google docs real-time editing files among users
Anonymous
That looks nice
Anonymous
Also, anyone got experience with push notifications from Django?
Anonymous
Should I use django or Google Firebase would be a better choice?
Ярик
hey guys, i have a question i have 2 models like so: class Model_1(models.Model): patient_name = models.CharField( ) card_number = models.PositiveIntegerField() class Model_2(models.Model): patient_name = models.ForeignKey(Model_1) card_number = models.PositiveIntegerField() to fill the 2nd model i have to first fill the Model_1 the question is how can i make Model_2 card_number field autofill depending on what FK choice i did?
inchidi
Should I use django or Google Firebase would be a better choice?
the hard part would be subscriber key generation if you success generate that key, basically your backend only need to store the key and request.post to api provided by the browsers
Anonymous
browser?
Anonymous
I want it for mobile
Anonymous
Maybe, browser is in plan too but currently I want push notifications for mobile.
inchidi
inchidi
now push notifications not only about mobile tho
Ярик
you can override save() and put the logic there
can you please show me how to override save method??
Anonymous
Why is it difficult to generate subscriber key generation?
inchidi
can you please show me how to override save method??
https://stackoverflow.com/a/46180048
inchidi
Why is it difficult to generate subscriber key generation?
you can try https://developers.google.com/web/ilt/pwa/introduction-to-push-notifications#notifications_api then decide whether build your own worth than firebase
Ярик
https://stackoverflow.com/a/46180048
i've done it, but probably the wrong way def save(self, *args, **kwargs): self.patient_name__card_number = self.card_number super(Model_2, self).save(*args, **kwargs)
inchidi
and looks like what you need is one to one instead one to many (foreign key)
أمجد☄
i have created an AbstractUser model with a regex validation in validators.py but it just creates the User without any validation! 🤦🏻‍♂️