2008-3-5

23:14 luris
(Writing an explanation on dpaste.com, one sec)
23:16 mxmasster
hello
23:16 mxmasster
when using sqlite
23:16 mxmasster
does the database_name have to be a full path, or can it be relative to the settings.py file?
23:17 Zalamander
mxmasster full path
23:17 triton-mx
how should I implement different roles for my users? (i.e. Students should have only one Clasroom, while Teachers might have more than one Classroom)
23:17 Zalamander
mxmasster it probably can be relative, but not to the settings.py file
23:17 mxmasster
i.e. i want to specify ../project.db
23:17 triton-mx
Should I make a Student model and a Teacher model?
23:17 mxmasster
or just project.db
23:17 Zalamander
mxmasster predicting *where* it would be relative to is the hard part, and would depend on your deployment
23:17 shadfc
mmm, caching was easy to implement
23:17 iiie
relative to invocation, but full is recommended
23:17 shadfc
delicious
23:18 semaphore
is there a shorthand for {% if foo %}{{ foo }}{% endif %} ?
23:18 mxmasster
Zalamander: okay - so if i am checking in the settings.py file, what is the recommended practice
23:18 insin
{{ foo }} :)
23:18 mxmasster
for multiple developers
23:18 luris
23:18 luris
A little better I guess
23:18 mxmasster
my home directory has a different path than other ppl obvioulsy
23:18 Zalamander
mxmasster use a full path, but you can find it dynamically, by examining os.path.abspath(__file__) inside settings.py.
23:19 antonr
triton-mx: use permissions
23:19 luris
But generic relations are pretty heavy on the database and adds complexity I'm not very fond of.
23:20 Zalamander
mxmasster something like: os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir, 'project.db')
23:20 luris
I would, in an ideal world, only have to perform 1 query (but that wouldn't be easy as some of the models have m2m relationships)
23:20 iiie
23:20 iiie
rather djangosnippet
23:20 luris
But at-least keep the amount of queries down and have a managable solution.
23:21 mxmasster
thanks
23:23 triton-mx
antonr, I think it's not a permissions question, a Teacher has different filed from a Student ... how can I implement this?
23:24 antonr
triton-mx: are teachers and students users in the system or just objects?
23:24 triton-mx
they should be different kind of users
23:25 antonr
then make a user group for teachers and a user group for students
23:25 antonr
23:26 s3phiroth
by the way
23:26 s3phiroth
i've just started developing my first django site
23:26 triton-mx
an User that is a Student should have a one-to-one realtation with a Classroom, but a Teacher should have a one-to-may relation with Classroom
23:26 s3phiroth
and i was thinking about using the already existent user table and create another model for the extra user fields i want for my users
23:27 s3phiroth
is that a good way to do things ?
23:27 triton-mx
s3phiroth, you sould use a Profile
23:27 masida
anyone else having problems with the latest newforms-admin branch and USE_I18N = True?
23:27 s3phiroth
mmm...and what are those ?
23:27 antonr
triton-mx: oh i kind of misunderstood, use foreignkey and manytomany fields
23:27 s3phiroth
oh
23:27 mxmasster
is it possible to include a file from settings.py that would override the settings.py values?
23:27 triton-mx
s3phiroth, a model with a foreignKey named "user"
23:28 s3phiroth
triton-mx: already found it. i'll look into it later
23:28 s3phiroth
thanks :)
23:28 brosner
masida: what are you seeing?
23:28 s3phiroth
triton-mx: oh...but that's what i'm doing
23:28 masida
brosner: there seems to be going something wrong with the new auth code (which is ported to newforms)
23:28 brosner
masida: continue...
23:28 Uz_
luris: as long as it is only does something while someone edits/writes a comment/blog post/whatever .. it shouldn't matter to much if it's heavy
23:28 triton-mx
antonr, so I have to make a Student model and a Teacher model?
23:28 triton-mx
s3phiroth, you are doing well :)
23:28 Uz_
if you consider optimizing any parts of the code, than those that get called million times a day
23:28 Uz_
*the
23:28 Uz_
n
23:29 luris
Uz_: hopefully comments will :)
23:29 s3phiroth
hehe, nice :)
23:29 s3phiroth
and i hadn't even read the authentication documentation properly
23:29 luris
But I think I'll go with lan B
23:29 luris
plan
23:29 Uz_
luris: well they will be called more often, that still doesn't compare to normal GET requests
23:29 s3phiroth
but that just felt like something logical to do
23:29 masida
23:30 masida
don't know exactly what's going wrong, because somewhere an import can't be made
23:30 masida
only thing i know is that it doesn't happen when USE_I18N = False
23:32 masida
note: i'm importing the auth User model in my own models.py
23:32 antonr
triton-mx: then you use user groups. in form validation you should check whether the user is a teacher or not. if the user is a student and already has a classroom, the form will give an error
23:32 Zalamander
masida it's possible you're creating a circular definition somewhere
23:32 antonr
triton-mx: you can also hook the same check to the save() in your model
23:33 triton-mx
antonr, should I subclass the save method?
23:33 masida
Zalamander: yeah, it must be something like that, but it worked a week ago... (before newforms-admin used newforms for the auth module)
23:33 antonr
triton-mx: that's what i'm suggesting
23:35 triton-mx
antonr, ok, I thought I was not allowed to overwrite the save method
23:35 Carolina
hello, anyone can tell me how I can print the SQL a queryset is going to use?
23:35 brosner
masida: ok, i think i know what's up. i won't be able to fix it right now though
23:35 masida
brosner: ok, no problem, are you working on newforms-admin?
23:36 Carolina
I need to output a queryset SQL to troubleshoot a problem
23:36 brosner
masida: yeah, try the patch at #6718 and let me know if that fixes it
23:36 DjangoBot
23:38 masida
brosner: thanks, that works!
23:39 Carolina
does anyone know?
23:39 Magus-
Carolina: read the faq
23:40 Carolina
I read the database api and coudn't find anything
23:40 antonr
triton-mx: it's quite common, check some documentation before doing that though
23:41 Carolina
I was hoping there was something like mymodel.Objects.filter(.....).output_sql()
23:41 masida
Carolina: from django.db import connection
23:41 masida
Carolina: print connection.queries
23:41 triton-mx
antonr, I read the turorial and many chapters of the book
23:42 Magus- sighs
23:42 Magus-
db-api != faq
23:43 Magus-
23:43 Magus-
lookit that, right in the faq like I said :��
23:44 antonr
23:45 triton-mx
antonr, thank you :)
23:45 antonr
np
23:54 luris
Magus-, Uz_, Zalamander: I wrote up a better explanation (and what I'm using) at http://dpaste.com/38163/ .. have any ideas on how I could improve that or if my implementation is so borked that I should go hide under something old.
Page 27 of 28   ← Previous  Next →(2,719 total)