and every ogrenci can be only one PansiyonOda member
Xiti joined the channel
GinFuyou
It's not how ManyToMany works
eribol
can i controlling this with django models(database) or with my view fucntion or etc
GinFuyou
You want OneToOne for second part
er, no
eperzhand has quit
ForeignKey I meant
fikka joined the channel
jaykay joined the channel
eribol
ForeignKey is workng different i think
i want to make a limit for ogrenci. Like, only 4 ogrenci can be a member for this model
GinFuyou
I said that for second point you gave
eribol
oh sorry
GinFuyou
For count limit you'll have to write some custom check logic I guess
jobelenus joined the channel
Even if you can enforce it with raw sql on DB level (I don't know if you can) you'll still need proper validation and error handling in python
I don't think ORM has built-in for count limits
fikka has quit
jobelenus
I’m seeing some strange behavior. I have an abstract model (A) that has two fields. I then have another abstract model (B) that inherits from A but doesn’t add any fields. And then I have a “real” model (C) that inherits from B. And but doesn’t have the two fields from A — why is that?
eribol, I don't think it's a best way to raise exceotions in a signal
jobelenus
hrmm one sec I may have misunderstood my traceback
eribol
GinFuyou: i couple advice there and so on
GinFuyou
eribol, also as I said, don't use m2m, it's not use case you have described
eribol
ForeignKey for every ogrenci?
4 field i need for it
GinFuyou
Ogrenci has only one PansiyonOda? Then yes, FK
eribol
i though opposite :D PansiyonOda has 4 ogrenci :)
it sounds nice
i will try it
GinFuyou
FK is one-to-many
so put it to Ogrenci and then you can even try out clean() method on it
lomex joined the channel
eribol
hmmm
greg_f has quit
silly me
i should though this before
fikka joined the channel
fikka has quit
maryo has quit
eperzhand joined the channel
xliiv joined the channel
Xaldafax joined the channel
drodger has quit
audioburn has quit
fikka joined the channel
drodger joined the channel
audioburn joined the channel
jobelenus has quit
eperzhand has quit
cryptopian joined the channel
jtiai
eribol: You really want to have some method in your model where you attach orengci members.
fikka has quit
eribol: and in that method you first check that is the number of orgenci less tahn 4 to allow adding. If not do something that suits in your workflows.
eribol: And then just make sure that you never directly assign that m2m.
bahamas has quit
eperzhand joined the channel
ovalseven8 joined the channel
ovalseven8
Will post_-signals in Django hook AFTER a transaction is complete or within the transaction. I ask because a rollback could lead to problems
fikka joined the channel
cramm has quit
theo_moore joined the channel
cramm joined the channel
fikka has quit
lobo_d_b joined the channel
sphrak has quit
jtiai
ovalseven8: That really depends on your transaction model.
By default django runs in autocommit mode.
jobelenus joined the channel
UncleVasya joined the channel
sphrak joined the channel
maks25 joined the channel
eribol
jtiai: thank you for your advice
i cant change my model anymore but can control it
audioburn has quit
tm007 has quit
rpkilby joined the channel
ovalseven8 has quit
graphene has quit
graphene joined the channel
cryptopian has quit
kris7ian joined the channel
Haudegen has quit
cmgurba joined the channel
jobelenus has quit
jtiai
eribol: Yoy don't need to change your model, just add methods to it.
lobo_d_b has quit
If you don't have control of that model (it's 3rd party) you still can use proxy models to achieve what I described.