apologies in advance for the horrible off-topic, won't happen ever again: if anybody's here is into electro/industrial/EBM-adjacent music and feels like helping, please PM me
jtiai
dtornabene: Right, you need to declare manager for your model.
dtornabene
jtiai: thank you, its one of those days where every step is a stumble
jtiai: shouldn't migrating to zero and then deleting from INSTALLED_APPS work?
greg_f joined the channel
dddd has quit
jtiai
moldy: Not sure. Could work.
dddd joined the channel
Wonder does that migrate to zero require that all migrations do have reverse migration...
bspkrs has quit
moldy
good question
bspkrs joined the channel
jtiai
I think system needs to go through all migrations and do downgrade. otherwise models added in the middle wouldn't be cleaned up.
and that may be interesting if there are data migrations involved.
moldy
makes sense
ummoh has quit
fission6 joined the channel
hutch34_ joined the channel
dethos joined the channel
p4trix has quit
SecondForm_Glenn joined the channel
grimel joined the channel
grimel
Hi, all. Is it possible to implement custom confirmation view (popup?) for django admin to confirm "save" action on change view?
at least as it's defined for delete action
raijin has quit
READ10 joined the channel
aaksarin joined the channel
eggstyrone joined the channel
READ10 has quit
burhan joined the channel
READ10 joined the channel
macskay_ joined the channel
felixx joined the channel
pete___ joined the channel
MoonGNatRouth joined the channel
NewbiePro has quit
burhan has quit
not_a_web_devbot joined the channel
pete___
Hi everyone, I am working on a system that lists out a range of products sorted by their product code. The product codes are made up of two letters for the followed by a number, for example EG1.
I currently sort these products by doing a simple Product.objects.order_by('product_code'), however as there can be multiple digit product codes (for example EG12), these will come out above ahead of the single digit codes.
i.e EG1, EG11, EG12, EG13 ... EG19, EG2, EG20
I know that adding leading zeros to the product codes will fix this (i.e EG01 rather than EG1) but as there is already printed literature and an existing site using EG1 this is not an option.
Is there a way to fix this to show these products in the correct order?
DrYockel has quit
not_a_web_devbot has quit
sash_
pete___: I didn't find a solution in Django yet, but what you want to look up is "natural sort"
vield_
I'm not sure how you'd do "human-friendly sorting" on the database level (may be possible but ask someone else), so one option would be to add another field to sort them by in the database
DrYockel joined the channel
or do a natural sort in Python after you've fetched them
fleetfox: thanks, but that looks confusing as hell!
fleetfox
you don't have to understand it to use it
pete___
fleetfox: hummm... I don't even know what I need to feed in though, currently my objects exist as a basic django queryset
flobin has quit
flobin joined the channel
ChkDigit has quit
n0n0_ has quit
READ10 has quit
cyphase joined the channel
lacrymology joined the channel
helge_ joined the channel
Mowi has quit
eperzhand has quit
mastizada joined the channel
christian__ joined the channel
SimpleName has quit
kuter has quit
SimpleName joined the channel
shredding joined the channel
webpigeon has quit
christian__
hello friends, i have a question regarding csrf token validation. The concept is clear to me, the user gets a secret token from the server which he will then use on the following requests to verify that it is really him who sent them. But i don't understand how django validates those tokens? I thought django stores them in a DB table or so, but that seems not the case, since i could still send a request which required the
token after deleten the DB and restarting the server, without reloading the page, so that the old token was used.
moritz_s
christian__: the token is cryptographically signed with the SECRET_KEY in your settings. This way django can detect if the token is valid without having to store it anywhere
fleetfox
anyone familiar with django-compressor? I want to concat and hash files, but ommit minimization
christian__
moritz_s: thank you! that's exactly what i was curious about
Niikhawod has quit
finally i can go to sleep again without thinking about this the whole night
lucasxu joined the channel
dtornabene
jtiai: still here?
casuallancelot joined the channel
lucasxu has quit
webpigeon joined the channel
lucasxu joined the channel
lorddaedra joined the channel
jessamynsmith joined the channel
arseniy has quit
moritz_s
christian__: I just looked at the code and it turns out what I said wasn't entirely correct: The csrf token is stored in the User's session, which is either stored in the DB or in a Cookie in which case it will be signed. So either way it can't be changed by the user. Then the value from the session is compared to the one the user sent in the POST request.
xaldafax joined the channel
erik`
I don't remember us signing CSRF cookies.
The trick with CSRF protection is that the cookie your browser sends, and the hidden form value it sends on the POST, must be the same.
hylje
yeah csrf isn't verified in any way
it fully depends on the browser adhering on single origin policy
Mowee joined the channel
e.g. a script on a different domain can't steal your csrf token
lorddaedra has quit
erik`
So if I, on my malicious website, build a form that tricks users into submitting something to another website, I don't know what the user's browser has for the token value in its cookies, so I can't submit the right hidden field value.
Yes, that :)
SimpleName
it’s 23: 00
:D time to sleep
but I still not find the correct way solve my problem
moritz_s
erik`: yes, what I meant is: In case you use cookie based sessions, then and only then the token is signed, because of the way the cookie based storage works.
SimpleName
may be I should ask in stackoverflow
erik`
moritz_s, even then the token is not signed, as the CSRF token is not stored in the session
iiie0 joined the channel
jessamynsmith has quit
the session data in the session cookie is signed
(1.11 will offer storing the csrf token in the session with a setting)