I am using restframework. Wanted to create a view for both create and update. I get this error. https://dpaste.de/mY10. Can someone please let me know what is wrong here. Error says expected url kwarg name. I did give the kwarg name.
kiloreux joined the channel
dg_vrani has quit
dg_vrani joined the channel
knbk
usr123: ?name=... is a GET parameter, not a URL kwarg
tdy joined the channel
you need something like path('<name:str>/', ...) in your urlconf
xliiv joined the channel
usr123
knbk: Thanks
alekh joined the channel
PantelicGR3 joined the channel
felixx joined the channel
alekh has quit
foxmask
o/
Impaloo joined the channel
fletom has quit
nazarewk joined the channel
shangxiao
o/
mitaka joined the channel
tdy has quit
RCStef joined the channel
fletom joined the channel
tm007 joined the channel
usr123
Does anyone use meld for git diff?
tdy joined the channel
tneva82
Hello. Is there any sensible way to get request in pre_save signal? Trying to use it to save author of person doing edit in log. It used to work but seems when we upgraded from 1.10 to 2.0.5 something changed in django that screwed old method(now sometimes I didn't get any info, sometimes author was incorrect)
jtiai
tneva82: So what was your "old methods"?
maks25 has quit
Stigster joined the channel
tolja
usr123: sure
usr123
tolja: So, when you compare, what are the two sections? master and current branch?
tolja
Depends on what you are comparing
usr123
tolja: Yeah, so how do I give it params? git difftool master currentbranch. That is fine?
tolja
Can't remember, check man git diff
usr123
tolja: Thanks
Stigster
Greetings people! I have a bit of a model issue that I was hoping someone might offer me their two cents on. I've tried to draw it up in a UML-type diagram (https://pasteboard.co/HEIV9WR.png) and the issue is this: The subclasses of my abstract "Source" class would all be duplicated in the "SourceType" class. Yet there are attributes associated with the Source Type entity that can't be moved to either the abstract class or
the subclasses without breaking BCNF. Any ideas how to solve this in a more elegant way?
tneva82
jtiai: I'm not sure how it anymore works but middleware that puts requests into global variable by thread and pulled when asked it from there. From the look of code think I found that from stackexchange or somewhere else
jtiai
tneva82: localthread ?
or was it threadlocals...
tneva82
_requests[current_thread()] = request <- save in middleware like this, use from threading import current_thread to get thread and return from the _requests with that
jtiai
that doesn't seem right...
mattmcc
Stigster: You could put the fields common to Source and SourceType in another abstract model.
tneva82
jtiai: Quite likely and now obviously it isn't as it worked.
I figured roundaway way to do it by putting in author into instance before saving and grabbing it there in pre_save but that's major PITA
Stigster
mattmcc: Hm! And then inherit from both in each subclass?
mattmcc
The subclasses would get it by default if they extend Source.
Er, sorry, misread. Yes.
jadajada joined the channel
SourceType(CommonStuff), Source(CommonStuff)
Although per rule of threes, it may be simpler to just duplicate the fields.
Stigster
I still need to create the SourceTypes somewhere, though. As with the baseReliability / (instance)-reliability association (which is an example, the model isn't complete).
dodobas joined the channel
Source of type X has B reliability by default, this instance I of source type X has reliability R.
amcorreia has quit
Correction: Sources of type X ... (plural)
LiftLeft joined the channel
sydbarret
mysql binary field shows values of 0 and 1 but when rendered in django all checkboxes are checked
mysql binary field shows values of 0 and 1 but when rendered in django all checkboxes are checked
azulakina joined the channel
in my model I have clientrevert = models.BooleanField(db_column='ClientRevert', default=False)
in my forms clientrevert = forms.BooleanField(initial=False,required=False)
on template <td>{{ form.clientrevert }}</td>
jtiai
Hobbestigrou: Um... If you do have sessions middleware installed you should get session automatically for all users, even for anonymous users so you don't need to set it any special way.
Hobbestigrou
jtiai, i confirm i have the middleware set in the settings
and if i login before i have my data in the session
jtiai
Oh that of course doesn't apply to certain type of tests.
Since tests won't go trhough middleware.
Hobbestigrou
ah ok
i don't understand the problem
jtiai
Well provide full code and the traceback in pastebin. Maybe it's something else.
In django is possible to filter out all records that have a field not starting with 2 chars?
cryptopian
2 particular chars?
realnot
the opposite of `nonstartwith`
cryptopian: no any of [a-zA-Z]
robinb
I'm having trouble understanding how to structure my project. I'm creating a website which on the homepage will have products, campaigns, offers and banners which can be added through the admin page. How would you structure this? Would you create apps for those different categories or make a single homepage app?