I have a ModelForm on which I want to validate a field against the current user, but in clean_myfield(self) I can't access the request. How can I do my check? Should I do it somewhere in the view, but then in which method of my CBV?
epicowl has quit
MrBaboon has quit
MrBaboon joined the channel
jar3k joined the channel
jar3k
Hello!
Tyris__ has quit
cottons has quit
kezabelle
maPeakXL: pass the request, or the user, to the form
ValicekB joined the channel
deanrock0 has quit
Tyriss joined the channel
greg_f joined the channel
maPeakXL
kezabelle: ok
ValicekB has quit
FunkyBob
pass as little as possible
fllr has quit
if you only needthe user, pass the user
ustunozgur has quit
phaer joined the channel
MrBaboon has quit
oubiga joined the channel
_Cody has quit
Tyris has quit
cottons_ has quit
opalepatrick joined the channel
benwilber joined the channel
booze2go joined the channel
ddssc joined the channel
ddssc
hey whats the best practice to include existing database tables in a model using south?
PavanGupta01 has quit
do I need to do migrate --fake or can I somehow mark these migrations as fake?
--existing... whatever
cottons joined the channel
benwilber has quit
furoido has quit
amigo joined the channel
zkanda has quit
Tyriss has quit
Ergo joined the channel
bee_keeper joined the channel
kushal joined the channel
djapo
im looking at django's source how do i tell what version of django im in master
furoido joined the channel
?
patrick91 joined the channel
zkanda joined the channel
dlogs has quit
dlogs joined the channel
mattmcc
djapo: If you're in master, it's not a version.
djapo
mattmcc: do i need to take out a tag,
mattmcc
djapo: I don't know, what are you actually trying to do?
Manyman joined the channel
djapo
so if i install from master what version would it be? im trying to install 1.7sjf or something
aarcane has quit
mattmcc
If you want the 1.7 beta, grab the tarball from the website.
mattmcc: that would work, im going with the tag approach
booze2go joined the channel
natea has quit
eVRiAL has quit
ragsagar
ddssc, create initial migration using `python manage.py schemamigration <yourapp> --initial` . Then migrate fake to it `python manage.py migrate <yourapp> 0001 --fake`
eVRiAL joined the channel
amnesic joined the channel
Left_Turn joined the channel
ddssc
ragsagar: ok so when I move the migration files to another server, will I have to do this specific migration wtih migrate --fake again?
ragsagar
ddssc, depends on the state of database in your server.
ddssc
because the migration will break if the "table already" exist etc. of course I can always mark the table as unmanaged but I need it to be managed by south.
ragsagar
ddssc, You have to do migrate --fake in server too if you already have those tables created by syncdb.
d1rkp1tt
Is there any reason not to delete migrations and rebase?
ddssc
ragsagar: ok thanks. I thought maybe there was some way to mark those migrations as fake in the migration files themselves, like when calling schemamigration --fake or something
d1rkp1tt: what do you mean?
oxum joined the channel
xmj
another interesting question
how do i append "?as=PDF" to a URL in a template, {% url 'contract' %} ?
b10n1k has quit
d1rkp1tt
Well I dont know if its good behavior, so I am asking... but I often get inconsistancies between dev and live with south. So if everything is up to speed and I am not rolling back.. then I sometimes delete my migrations and let it baseline as is
So can be a pain when I am trying to run tests on branches
aarcane joined the channel
maPeakXL
Is it possible to filter using another attribute of the object. If I have a model with a start _date and a length, can I do something Model.objects.filter(start_date__lt=timezone.now() + timedelta(minutes=??? length ???))
d1rkp1tt
maPeakXL, ',' instead of +
urr hangon
maPeakXL
d1rkp1tt: that wouldn't make the filter correct. I would like to check if "now" is less than my start_date + the number of minutes of each row
sprezzatura has quit
ragsagar
maPeakXL, F expression
d1rkp1tt
I see what your asking now
sorry
yo1110 joined the channel
Manyman has quit
Narsilou joined the channel
Narsilou has quit
merica joined the channel
maPeakXL
ragsagar: thanks I'll have a look in the doc
Narsilou joined the channel
Natsu- joined the channel
oggy729 has quit
FinalAngel joined the channel
kushal has quit
ValicekB joined the channel
ValicekB has quit
rclsilver joined the channel
rclsilver
hi! i've a little question
georgeirwin has quit
Valdo joined the channel
FunkyBob
rclsilver: fascinating
hotsyk joined the channel
rclsilver
i've a model Node and a model Group. In the Group model, i have a ManyToManyField() linked to Node, with a related_name defined to groups.
maPeakXL
ragsagar: doesn't work...
_Cody joined the channel
rclsilver
Any way in the NodeForm to have the field for groups?
FunkyBob
rclsilver: specify a field
rclsilver
info: in the node form, i'm not able to know the list of "linked" models
xmj: cant you just literally put it after %}? not sure what your question is
kushal joined the channel
FunkyBob
xmj: exactly what ustunozgur said
maPeakXL
ragsagar: but I'm using the F value inside a time delta object. My filter look like Model.objects.filter(date__gt=timezone.now() - timedelta(minutes=F('n_slot_length')))
so it doesn't work well
rclsilver
FunkyBob: with a form based on ModelForm, any way to includes them auto?
ValicekB joined the channel
kriwil has quit
ValicekB has quit
FunkyBob
rclsilver: no
maPeakXL: no, that can't work because you're mixing Python side with DB side
Manyman joined the channel
prydie joined the channel
cjflory joined the channel
ValicekB joined the channel
NomadJim joined the channel
ValicekB has quit
ValicekB joined the channel
ValicekB has quit
schinckel joined the channel
_Cody
hi humans
i have lots of html views and urls that look very much alike