Anders (izzno / gooood) π³π΄
no where am i replacing objects like in this video. I am adding .active
Mirco
You no more have access to .objects
Mirco
Because you are telling Django to use your custom one
Mirco
When you explicitly tell Django to have two or more managers, it follows the order you declare them if I well remember official docs
Anders (izzno / gooood) π³π΄
So it can tell that mymodel.active is a manager and supresses the default ?
Mirco
You can do objects = your custom manager
And you can use .objects If u like it more ahah
But when you do active = your custom manager
You have to use .active
Anders (izzno / gooood) π³π΄
Yes, all this I get. I just dont get where .object disapears
Anders (izzno / gooood) π³π΄
hehe maybe I am terrible at explaining this
Mirco
No worries 😀 the important thing is it's clearer now
As Django docs says, every model can have at least one manager
Anders (izzno / gooood) π³π΄
the admin site automatically chooses the new manager (.active) without me renaming or touching .objects . I get that, but I still dont get ehy.
Mirco
It's not just the admin site
Try to open a Django shell
Import that model and try to use .objects
Anders (izzno / gooood) π³π΄
Oh yes, poor choice of words, but why does it do that ? Why does it discard .object ?
Anders (izzno / gooood) π³π΄
I think I have to dig in the code ;)
Mirco
Because you're replacing it with your custom one
Anders (izzno / gooood) π³π΄
Mirco
Yep have a look at Django source code so you can understand what it does under the hood
Anders (izzno / gooood) π³π΄
Thats my point, i am not replacing anythin, I am adding .active
Anders (izzno / gooood) π³π΄
Mirco
Your custom one override default model Manager
But you can still call it objects inside your model if u like it 😂
Anders (izzno / gooood) π³π΄
OHH !
Anders (izzno / gooood) π³π΄
I get it...
Anders (izzno / gooood) π³π΄
When i do something = sometihng.models.Manager i set this model's default manager, unless i repeat the step this is the default manager.
Anders (izzno / gooood) π³π΄
djesus
Anders (izzno / gooood) π³π΄
"went digging in the source"
Mirco
ahah imagine that the default one is objects = models.Manager()
Anders (izzno / gooood) π³π΄
yepp
Anonymous
how it possible
syam
Just change the template url
Anonymous
bro i want both pages
amit
its a social media website
amit
( I might do it for free)
Its a social media site Martiann.com(site is live) need to add some functionalities in ordee to make it more attractive and useable for users .
Anonymous
Can I get the current user when I am not in view function..??
Anonymous
I am in the tasks.py
A
Guys tell me best websites for learn django,if u know
Rainieri
djangoproject.com
Anders (izzno / gooood) π³π΄
amit
Yes
Anonymous
Appreciate your help
George
The code?
Mirco
No screenshots please
Mirco
Share the code with tool like pastebin
Read the pinned message 🙏
Anonymous
Ok
Mirco
Thanks
Anonymous
Email ?
Mirco
Why ?
Mirco
Use pastebin and share the url here
Anonymous
Ok
Mirco
Anonymous
https://pastebin.com/jVGPG1h1
Anonymous
Pls check and advise
Anonymous
Hi guys
I looking for a django app simple voice call app between tow client
Anonymous
Do you have any info?
Rajjix
i think django channels is what your looking for to keep an open connection, you can start from their chat app tutorial and add a sprinkle of your creativity
Rajjix
isnβt easier to just add another column with a boolean field ?
Rajjix
In or out
Abdul-Salaam
Pls what app is used for web development
Abdul-Salaam
I need d one in which you'll be able to see the effect beside the code
Rohan
Rohan
Please
Abdul-Salaam
I'm sorry 😞
Rohan
Show your models or actual schema, mate.
Habib
Show your models or actual schema, mate.
########################################################3
class city(models.Model):
City_name = models.CharField(max_length=128)
class Meta:
abstract=True # because we have abstract file which create exlusive subtype
###################subtypes###########################3
class In_usa(city):
State = models.CharField(max_length=128)
class out_usa(city):
Country_name = models.CharField(max_length=128)
################################################################################
#Scooters tables
class s(models.Model):
s_sid = models.IntegerField(primary_key=True, default=0)
s_battery =models.IntegerField(default=0)
s_pla = models.IntegerField(default=0) #position lattitude
s_plo = models.IntegerField(default=0) #position longtitude
β¨ Simon |
Rohan
Rohan
True for inside usa and false for outside usa?
Le Createur
Open files using storage access framework | Android Developers
https://developer.android.com/guide/topics/providers/document-provider
Rajjix
because in_usa has state in its attributes but out_usa has only the name of country
that doesnβt make sense, a booloan field still ainβt bad here , regardless you will still have that state column in your model if in or out as long as youβre storing all users in one table( assuming you are using RDBMs), but to show the extra field of state when a city is typed in wether you want the user to select for himself if in ir out of USA or use an extra function to autolocate, u will use javascript to show or hide that extra state field.
Rajjix
Or
Rajjix
U can make two tables and save users according to that in or out boolean field
Rohan
You can keep them all together and use null fields and filter by the boolean field while fetching values
π¦
Guys, if i try integrate reCaptcha to django LoginView, me need make login form subclass and integrate logic in form?
π¦
Or exists another solution for this?
Rohan
Wrong chat maybe?
Anonymous
Hi guys
I trying make a voice call by django app
I want when 2 client want make call together a id and ip from main server send to one of them and one of them be a server
Realy i want make a multi server - multi client by django
But now i want know django can support this issue or not???
Anonymous
Data = models.objects.filter(field like '%something ' )
Anonymous
How can I filter like this
Rohan
ah...