On 11/22/05, PythonistL <[EMAIL PROTECTED]> wrote:
> Adrian, thank you for your reply.
> I checked http://www.djangoproject.com/documentation/sessions/ and you
> say:``Session dictionary keys that begin with an underscore are
> reserved for internal use by Django. ``
> So,
s.craigslist.org/art/112889763.html
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
ay to test things in this case is to use
users.get_list(). If the parameters aren't valid there, they won't be
valid in pc.get_user_list().
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
's nothing forcing you to use the square
brackets. You could just use a hyphen:
...or no character at all:
All that matters is that the view code that processes this knows what
format to expect.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
oughts gratefully received.
Hi Tone,
Django's very REST-friendly, so the task should be straightforward.
Feel free to post specific questions, and keep us posted on how it's
coming!
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
it =).
As of changeset 1314 (http://code.djangoproject.com/changeset/1314),
the model validator (which runs automatically during "django-admin
runserver") complains if you don't max_digits and decimal_places on
FloatFields. Is it missing an edge case?
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
ors|join:", " }}
> {% endif % }
>
> If the field is filled by username, form give an error. If it filled
> user_id form works correct. How to make form that can be filled by
> username insted of user_id?
Hi Grigory,
raw_id_admin supports only entry of IDs (primary k
t or tomorrow, if I can flee the
Thanksgiving festivities effectively.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
nores comments that include naughty words.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
his would mirror the "real"
User.create_user(), so you'd be able to create users in Python, which
is best.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
you to put the pre- and post-saving logic in your
own code, or does it absolutely have to be part of Django itself?
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
ourse, to Robert Wittams for his hard work on new-admin.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
Django/mod_python docs.
Thanks for the question.
http://www.djangoproject.com/documentation/modpython/#error-handling
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
ed mentioned this, but I didn't see it during my cursory
read.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
at's happening in your case is that the title and
blurb fields are getting their default value, which is "" (the empty
string).
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
behavior not to display the database password and secret key,
but that's hardly a huge thing.
Jacob has drafted a "Contributing to Django" page, which has a full
section on how we handle security bugs/alerts, but he hasn't posted
that to the site yet. It will have the full scoop o
ere:
http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Changedthewaycustomtemplatetagsandfiltersareregistered
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
do the print statements end up?
When you use mod_python, print statements don't end up anywhere. The
best way to print out debugging statements is to either "assert False,
'hello world'" or add the debug output to the outputted page.
I've updated the mod
nly-asked question. Here
it is:
http://www.djangoproject.com/documentation/static_files/
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
A commonly asked question is how to serve static files with Django.
Here's the answer, finally documented.
How to serve static files
http://www.djangoproject.com/documentation/static_files/
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
dited, doesn't have any error
handling, etc.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
On 11/27/05, Medium <[EMAIL PROTECTED]> wrote:
> Also, i've been hearing about this new admin and reusing of the admin
> code, but cannot find any examples. Are there any at the moment ?
We'll have docs within a couple of days.
Adrian
--
Adrian Holovaty
holovaty.c
t; it doesn't show up in the admin tag docs, either.
Do an "svn update", and you'll get it. Looks like the {% debug %} tag
was inadvertently deleted in revision [1443]. Thanks for the pointer!
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
dmin()
# field names to remove from parent model
remove_fields = ['password', 'is_staff', 'is_superuser']
Hope this answers your question,
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
are of that
validation for you. Would this solve your problem?
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
On 12/1/05, Milton Waddams <[EMAIL PROTECTED]> wrote:
> I've tried self.get_list though obviously it doesn't exist.
Just plain "get_list" should work. Give that a shot.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
date
[appname]" at any time to get that same validation information.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
uot;"
This would give you the flexibility of defining that HTML in a
template rather than in Python.
See the source code of
django/contrib/admin/templatetags/admin_modify.py for more custom-tag
examples. Also check out
http://www.djangoproject.com/documentation/templates_python/#writing-custom-template-tags
, which doesn't yet include simple_tag and inclusion_tag but still has
a lot of information.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
Check it out: The first Django app at washingtonpost.com!
The U.S. Congress Votes Database
http://projects.washingtonpost.com/congress/
It lets you browse every vote in the U.S. Congress since 1991.
This is the first of many Django apps at The Post. :)
Adrian
--
Adrian Holovaty
holovaty.com
'll update it on the site tomorrow. Thanks very much.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
> or No in the entry afaict.
Right -- a bunch of other people have mentioned this, so I'll be
rolling in the change. Thanks. :)
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
xist.
Hmmm, I'm not sure what to say about this other than: Are you sure the
table doesn't already exist? Are you sure you're thinking of the same
database that Django is thinking about?
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
) you get an
> error because there is no validation that takes into account
> "bank=False" and so the INSERT statement is obviously wrong:
BooleanFields aren't allowed to have the "choices" parameter, because
that would be meaningless. By definition, a boolean only h
d in your model. Add
"db_index=True" to the appropriate field to add an index. Then run
"django-admin.py sqlindexes appname" to get the CREATE INDEX
statements.
> Also -- can a ForeignKey be supplied with a human-readable name, like
> other fields?
Yes, give it a &qu
se directly according to the schema enough for Django
> -- i.e., there's nothing else, or does it keep more secret stuff
> somewhere?
I'm not sure what you're asking here...
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
On 12/9/05, PythonistL <[EMAIL PROTECTED]> wrote:
> paginator=ObjectPaginator('tradeleads',{'id__gt':1},2)
The first argument to ObjectPaginator should be tradeleads (without
quotes), not 'tradeleads' (a string).
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
n tables, and I have to load them via django calls?
There's nothing special about Django's own tables -- they just hold
stuff like authentication information for the Django admin. You don't
have to worry about any magic. :)
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
gt; have some root URLs served by Django and some served by Apache?
You can use "SetHandler None" on a particular to turn off Django.
http://www.djangoproject.com/documentation/modpython/#serving-media-files
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
ke an official screencast but haven't done so
because I know APIs are going to change. So it's great that somebody
else stepped in to provide one in the interim. Thanks again, Tom.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
nd what goes in the app repository, becomes even more
subjective.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
e %} for a certain number of
seconds:
{% cache '500' %}
This will be cached for 500 seconds.
{% endcache %}
If you write it and submit a patch, we'd definitely consider adding
this to the Django distribution.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
he problem was that the "1" in
that example was being compared as a string, not an integer.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
and add the constraints that way.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
Stay tuned for more information on when those changes will be made a
bona-fide part of Django.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
cific about this technique; the handler
script can do whatever you want, whether it's interacting with Django
models or whatever. The docs you pointed out should be just as helpful
for Django as Rails.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
7;])
>
> the model looks like;
> responsible = meta.ForeignKey(auth.User)
Try this:
milestone_list = milestones.get_list(responsible__id__exact=1)
You can also do something like this:
milestone_list = milestones.get_list(responsible__username__exact='patrick')
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
ays get them right the
> first time. :-) Is there an easy way to help migrate the data from an old
> model to a new one? What's the preferred method?
Hey John,
Check this out:
http://www.djangoproject.com/documentation/faq/#if-i-make-changes-to-a-model-how-do-i-update-the-database
tation of regular expressions, anyone know a way
> around it?
Capture the whole thing, then parse it in your view by splitting on the slash.
(r'^/albums/([a-z0-9_/]+))+/$', 'mydomain.views.view_album')
def view_album(request, url):
bits = url.split('/')
# Lookup page by bits.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
tribution, which, it seems, you've already found.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
to
> get_object()?
All the standard Django ORM functions, such as get_object() and
get_list(), automatically quote all parameters within the SQL queries.
So you don't have to worry about SQL injection.
I'm hoping to write up a document about this soon.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
r much longer.
For now, put the "from socket import..." within _pre_save().
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
y isn't a reserved name. It must be something else.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
ng, of course, mod_python and any other essential ones) until
it works. Good luck, and keep us posted!
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
ht need to include some JavaScript in your custom HTML page for
that. See django/contrib/admin/media/js/SelectFilter.js.
Hope this helps!
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
ject/apps", and give it another
shot. You're trying to import myproject.apps.polls, but that directory
doesn't exist. Good luck!
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
x27;],
> 'byuser': ['1']}
>
> now i´m trying to get all "users" to send them an email.
> but with something like post_data["user"] i only get "[EMAIL PROTECTED]".
>
> so, how can i get all the values for "user" within
app here:
http://feh.holsman.net/articles/2005/12/15/django-captcha-app
I haven't looked at the code myself, but it could be helpful.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
thing like that,
django.core.formfields.CheckboxSelectMultipleField will probably do
the trick. The formfields module isn't that well documented at the
moment, but there's some here:
http://www.djangoproject.com/documentation/forms/#custom-forms-and-manipulators
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
on and should be integrated into Django
proper within a couple of weeks. For more information, see
http://code.djangoproject.com/wiki/RemovingTheMagic .
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
. (Trivia: get_in_bulk() was created to solve this exact
problem.)
Hope that helps! It would be pretty cool to open-source this mini
search framework and pop it in django/contrib, but that would be up to
Jacob to decide.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
nt from the table including the
> relationship.
This is something we'll be adding in the magic-removal branch. See
http://code.djangoproject.com/wiki/DescriptorFields .
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
Thanks, Patrick! Performance has consistently been a key goal while
developing Django.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
eaders?
Good call! I've updated docs/email.txt to point out input needs to be validated.
Also, in revision 1795, I tightended up the Django mail functions so
that they don't accept newlines in any header. Docs are updated for
that as well.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
ist
> Exception Value:ContentType does not exist for
> {'package__label__exact':
> 'python_module_name__exact': }
Hi Antoni,
When you copy the CREATE TABLE statements for your new models, make
sure to copy the "INSERT INTO content_types" and "INSERT INT
, documented here:
http://www.djangoproject.com/documentation/generic_views/#using-simple-generic-views
Here's the URLconf you'd use:
urlpatterns = patterns('',
(r'.*', 'django.views.generic.simple.direct_to_template',
{'template': 'base
've updated the docs:
http://www.djangoproject.com/documentation/templates_python/#the-template-dirs-setting
http://www.djangoproject.com/documentation/settings/#template-dirs
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
ates".
> )
>
> Perhaps add "# Always use Unix-style forward slashes, even on Windows."
Good call. I've put that note in the default generated settings.py.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
I wanted to
see the value of variable foo, I'd do this:
assert False, foo
Hope that helps,
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
then again I could implement them myself to have groups
> and rights and so forth. What would you do? Utilize Django's or
> create your own for my situation?
Hi Mike,
Seems like you're saying Django's built-in auth will work for you. In
that case, I'd suggest you u
t.com/ticket/1152.
See http://www.djangoproject.com/documentation/db_api/#limiting-selected-rows
for an example.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
gt; --- cut ---
Try specifying an "ordering" parameter in the admin options for your
custom user-info model.
http://www.djangoproject.com/documentation/model_api/#admin-options
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
I created this Django app on deadline, as a supplement to a Washington
Post analysis of previous court rulings by Supreme Court nominee
Samuel Alito.
http://projects.washingtonpost.com/2006/alito/cases/
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
On 1/3/06, Jeremy Dunck <[EMAIL PROTECTED]> wrote:
> Who did the info graphic on top here:
> http://www.washingtonpost.com/wp-dyn/content/custom/2005/12/30/CU2005123001137.html
The graphics staff. See the bottom of that page for info.
Adrian
--
Adrian Holovaty
holovaty.com | djang
cely edited files for your downloading pleasure. Check them out
here: http://www.djangoproject.com/snakesandrubies/
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
ion.
Using the 2.3 syntax is a safe bet.
Feel free to show us your full traceback -- that'd help us debug your problem.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
s/choices are displayed, change
the field order in the Choice model.
Hope this helps!
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
ache
auth (against, say, an htpasswd file) to authenticate Django users
(creating request.user from generic Apache auth rather than from the
Django users database table). That's a subtle difference; hope that
makes sense.
If you're still having problems, go ahead and show us the
section of y
t; TypeError: 'tuple' object is not callable
Ooooh, that looks like a bug in the Django mod_python authentication
handler that's triggered if DjangoRequireStaffStatus isn't set in
httpd.conf. Can you try putting the following in your and
seeing whether you get the same error?
On 1/7/06, Brian Ray <[EMAIL PROTECTED]> wrote:
> btw, I will fill out a Trac ticket for the modpython.py fix, just in
> case this thread get's lost in cyberspace.
Thanks for the ticket and patch! I've committed it.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
of things?
I'm not sure what you mean here...What's the exact error you get?
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
ssion that I don't want carried through logout/login sequences,
> and I'm wondering when and how to get rid of them.
Hey John,
Deleting an object from a session is simple:
del request.session['foo']
Hope this answers your question.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
On 1/8/06, John Martin <[EMAIL PROTECTED]> wrote:
> Thanks Adrian. What I'm actually wondering about though is whether
> there is a "proper" way to clear out a session entirely? Is it just a
> matter of iterating through all of the keys and clearing them one by
&
his takes advantage of the fact that the lookup parameters are
capable of performing joins behind the scenes. Let me know if this
doesn't make sense or if I misunderstood your question.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
y not?
I wouldn't recommend approach #2, because it's a slightly messy
database layout, but it would still work with Django as long as the
"user" field of NewsPosting was a ForeignKey(User).
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
to add a
> db_schema attribute or something instead. (Should I submit a patch? :-)
Perhaps we could have the best of both worlds, and have the Model
constructor split on period, storing db_schema internally if a schema
was provided.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
SQL users in the audience be able to help?
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
On 1/10/06, Jeroen Ruigrok van der Werven <[EMAIL PROTECTED]> wrote:
> Which version of MS SQL do you initially want to target Adrian? I can
> probably get some basic testing done here to clear the majority of the
> issues.
Thanks for the offer! Knowing next to nothing about MS SQ
nd if it is not, why waste our time?
Hey Kenneth,
Making Django available to SQL Server users is hardly a waste of time
-- it's a win for the framework. Similarly, we've got an Oracle driver
in the works.
If you're not a fan of closed-source databases, continue to use
open-sourc
of Python
on this box?
Another thing to check is that you're able to do the following import statement:
from pysqlite2 import dbapi2
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
On 1/10/06, Colleen Owens <[EMAIL PROTECTED]> wrote:
> Thanks for the reply, Adrian. I want to be able to change the field order
> and which fields are displayed while I'm editing something inline. Changing
> the field order and which fields are displayed for the Choice model
e backend (the "adodbapi"
library) assumes placeholders use "?" for placeholders. So the Django
layer needs to convert all "%s" placeholders in the query to "?".
It looks like the current way this is happening (in
django/core/db/backends/ado_mssql.py)
release before the magic-removal branch is
merged. The next release will be a big one.
Many thanks to all the great people who've contributed to this
project. You can check them out in the AUTHORS file:
http://code.djangoproject.com/browser/django/trunk/AUTHORS
Enjoy!
The Django team
-
we generally just create small Python scripts
and run 'em via cron.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
t_list(myself__exact=my_id)
entries.get_list(submission_user__in=[f.id for f in my_friends])
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
y don't even have to be in the app package. All the Django
cares about is that they're accessible via Python "dotted-path"
notation, e.g., 'adrian.views.homepage'. Viva decoupling!
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
lue into
keyword arguments. For example the following two statements are
functionally identical:
write_love_letter(to='python', from='adrian')
write_love_letter(**{'to': 'python', 'from': 'adrian'})
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
(0, None, or False), and thus force the saving routine to generate
> a new one and do an insert query:
>
> a.id = None
> a.save()
You're right -- my mistake!
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
odel provides
> support for bytea?
No, we've avoided supporting BLOB fields because it opens a can of
mutated worms. That said, if somebody can come up with a logical,
clean design for that feature, let's make it happen.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
> though, so I was wondering if Django has some built-in way of handling this.
Hey Colleen,
I'm not sure this answers your question, but feel free to make up your
own settings. See the docs here:
http://www.djangoproject.com/documentation/settings/#creating-your-own-settings
ing that look very similar from the documentation.
Good call. I've removed that section from the docs.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org
701 - 800 of 1037 matches
Mail list logo