just swapped all my parts into a brand new bottom chassis with new keyboard touchpad it feels like a million bucks again
lorddaedra has quit
FunkyBob
was given a macbook air for work once
loathed the keyboard
otherwise, was a nice toy
Leeds joined the channel
ironfroggy joined the channel
but the OS was too "our way is the only way" for me... personal preference thing, really
keimlink has quit
krisd has quit
deitarion
I know that feeling. I've ripped out and minimally rewritten bits of my desktop which tried to force their workflow on me.
morenoh149 has quit
Valduare
i like the macbook pro keyboard more than any other’s ive ever come across
SamSagaZ joined the channel
psy123
dang`r`us: are you still there? I went through File Uploads docs again, the file data is placed in request.FILES, but what if I wanted to save it to db without going through form or view?
Do i need to just point to the path of the file?
Djarbore joined the channel
krisd joined the channel
Hello guys, here's what i am trying to do, serve songs from db to a player, https://dpaste.de/tU1U I thought about create function from docs, but am confused about what to put in the second param?
Forgive me if I misuse a technical word, I am open to corrections :)
SamSagaZ has quit
mattmcc joined the channel
_vyscond joined the channel
yanome has quit
space-wizard has quit
AminMMZ joined the channel
royendgel has quit
AminMMZ
Hi guys
anyone online!?
javawolfpack has quit
javawolfpack joined the channel
kennethreitz joined the channel
AminMMZ has quit
fpghost84 joined the channel
javawolfpack has quit
madboxs joined the channel
jonez
greetings. is it wise to derive my models from anything other than Model?
raj joined the channel
mattmcc
Well, ultimately they have to derive from Model.
That could be through some chain of subclasses, of course.
solomonix has quit
And mixins may provide other functionality or additional fields..
madboxs has quit
jonez
ah. perhaps what I need is a mixin
what I noticed is that w the auto-generated admin interface, the class name listed is the top one of the inheritance tree (in my case User).. .the link is correct, tho
so from this I've gathered that the admin interface goes all the way up until it finds Model as a parent, then uses that subclass.
tulioz has quit
workbean has quit
lolol joined the channel
lolol
heya
ill show you my project when its done
going to dploy it on heroku
mattmcc
User as in django.contrib.auth.models.User? That shouldn't really be subclassed..
b0nn
I'm reading http://www.effectivedjango.com/tutorial/forms.html and they have something that I cannot quite google properly, Class Meta: model ='foo'. So, class Meta means that you're defining meta data on your class, and in this case the model = means you're extending that class?
hmln joined the channel
redShadow joined the channel
madboxs joined the channel
jonez
mattmcc, ok. should I set up an FK instead?
mattmcc
jonez: Well, if you want to customize the user model, there are proper ways to do that.
hmln has quit
jonez
hmmm.. in this case I prolly do not need a User for every Athlete or Judge
lorddaedra joined the channel
Valduare
hmmm is it a pain to add more stuff to models
solomonix joined the channel
mattmcc
Valduare: 'Stuff' like..?
Valduare
how do you deal with defaults and such without pulling hair out
madboxs has quit
mattmcc
b0nn: Not quite. The class, a ModelForm, needs to know which model it's working with. That Meta class is how you specify it.
b0nn: Once it knows what model class it's meant for, it can inspect that model to generate form fields for each corresponding model field.
thinkt4nk joined the channel
b0nn
oh, ok, that makes sense
solomonix has quit
lorddaedra has quit
iiie joined the channel
lolol has quit
lolol joined the channel
solomonix joined the channel
iiie has quit
madboxs joined the channel
surfnturf_ joined the channel
lorddaedra joined the channel
mcspud
o/
Hanumaan
I have some svg pictures which gets generated dynamically how to serve them in django?
Valduare
anyone have a link for adding image uploads for simple blog
mattmcc
Haudegen: A view can return the image, then <img src="{% url 'view_returning svg' %}">
dang`r`us
psy123, creating a file without using a view is not explicitly covered by the docs (I think), but I can show you how. Gimme a sec.
mattmcc
Valduare: ImageField?
lorddaedra has quit
Tomatosoup- has quit
psy123
dang`r`us: Yes please, I started to wonder why I want to do it this way
lolol
is my client bugging with me
surfnturf_
i'm using django behave but I need to delay after clicking a menu item to click on a submenu. How do I do that?
psy123, in this case I have a file name (fn) which references an existing file *outside of django*
Darkhunter
Hi, I was thinking if there is a way to do one query for Class.objects.all.filter(online=True) and then .filter(online=False). I can check it in django but it's worse performing.
psy123
Yes
dang`r`us
psy123, the interesting part is the use of django.core.files.File
javawolfpack joined the channel
which you wrap around a file handle
a file handle is what python's open() gives you
mattmcc
Darkhunter: I'm not sure what you're asking, then.
Class.objects.all() would be one query.
But it sounds like you've already done that.
dang`r`us
.all.filter can be condensed to .filter
psy123
dang`r`us: what about HostImage?
javawolfpack has quit
dang`r`us
psy123, its details are of no importance to you. See the comment on line 12 for all you need to know
lolol
hey
can you all see my messages
dang`r`us
mattmcc, I think they want online, offline = Class.objects.magic()
lolol
cause im bugging out
dang`r`us
lolol, yes
jessamynsmith has quit
Darkhunter
dang`r`us: Yes!
lolol
ok
Darkhunter
I just don't want to do repeated query...
mattmcc
Darkhunter: It's not a repeated query. One query has online=True, the other has online=False.
dang`r`us
Darkhunter, one query = one result set; never two.
psy123
dang`r`us: Okay thank you very much :) I am gonna read about File
Darkhunter
I know, okay guys...My advanced logging is telling me that I am doing repeated query here :/
fpghost84 has quit
mattmcc
Okay, then how do you define 'repeated'?
dang`r`us
Darkhunter, yes, two queries, but for different result sets
mcspud
Darkhunter - you can do `qs = Class.objects.all()` - you can then used that cached queryset to not not the DB again: `qs.filter(online=False)` etc
mattmcc
mcspud: That will produce a new QuerySet instance.
Valduare
mattmcc: so would i add an imageField to the post class or would image be a new class to hold its meta data?
mcspud
You sure mattmcc?
mattmcc
mcspud: Yes, Django can't "filter" cached result sets.
mcspud
interdasting
pyface has quit
Darkhunter
Yes, thanks anyway. I hope this won't be bottleneck of our program :D
mattmcc
If you don't already know, then you're prematurely optimizing.
But as a general rule, one big query is not automatically better than two smaller ones.
People frequently get hung up on query count without reason.
Darkhunter
mattmcc: Well, our program is ready, but too slow so we are optimizing.
mattmcc
Do you know _why_ it's slow?
Measure. Identify the bottlenecks, rather than guessing at them.
iiie joined the channel
Darkhunter
mattmcc: We are actually using drf and serialization takes too much time. I was on drf irc, but they couldn't help me anymore...I did all the optimalization they knew...
_vyscond
mattmcc big queries normally means bad table design
unless you're running an enterprise data like facebook
petabytes of profiles.
iiie has quit
mattmcc
Valduare: Depends. Does a post have just one image?