I think you have a small error in your example. Should be:
class Thing(models.Model):
#element = models.ForeignKey(Thing)
element = models.ForeignKey(Element)
name = models.CharField(maxlength=100)
Also I figured out my problem (I think). I was passing ForeignKey
editable=False, appa
I use something like:
class MyModel(models.Model):
mypic = models.ImageField()
def __init__(self, *args, **kwds):
super(MyModel, self).__init__(*args, **kwds)
self.mypic_org = self.mypic
def save(self):
if self.mypic != self.mypic_org:
# do some work be
I'v finished a tool for dumping and restoring database for django, you
can find it at:
http://code.djangoproject.com/wiki/DbDumpScript
--
I like python!
UliPad <>: http://wiki.woodpecker.org.cn/moin/UliPad
My Blog: http://www.donews.net/limodou
--~--~-~--~~~---~--~--
Hi yary,
For SVN versions you can take a look at ticket #2982 (
http://code.djangoproject.com/ticket/2982) for a near future method, right
now you may go for:
http://code.djangoproject.com/wiki/CookBookSplitModelsToFiles
On 1/18/07, yary <[EMAIL PROTECTED]> wrote:
Does this post still hold tru
Does this post still hold true-
http://groups-beta.google.com/group/django-users/msg/05ed44bf585a2d09?
that is, can I separate a models file into separate modules so long as
I set the __all__ variable in modules/__init__.py and keep the modules
in the models directory? It doesn't seem to be work
This isn't really a question, I'm just trying to understand why in the
admin code for searching on the changelist page it creates a new
QuerySet object instead of using the same one?
lines 730-734 admin/views/main.py
other_qs = QuerySet(self.model)
if qs._select_rel
Thanks for the info, Chris. I'm using MySQL 5.0.24a-standard-log on
shared hosting (Dreamhost), so I don't believe I can update either
MySQL or the mysql-python interpreter.
What's weird (though I think this just shows my lack of knowledge of
both Python and Django) is that in the shell, access
On 1/19/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Hello djanonauts,
I am writing unit tests for a project, and I would like to test my
views. The documentation
(http://www.djangoproject.com/documentation/testing/) suggests using
django.test.client.Client to do the deed. When I use it
On 1/18/07, gordyt <[EMAIL PROTECTED]> wrote:
...
Go to the site-packages directory in your Python installation and
create a symbolic link to the django directory that you checked out.
You'll want to delete the 0.95 egg in site-packages, too. I've
recently heard of someone loading 0.95 even t
On 1/18/07, David Zhou <[EMAIL PROTECTED]> wrote:
What is the recommended method to slice querysets into multiple
chunks? To do 1:10 and explicitly turn the set into a list, slicing
that, and passing it into context? Would that still work in
templates?
Yep.
result = list(qs) <-- forces eval,
On Jan 18, 2007, at 4:46 PM, gordyt wrote:
I create a small script "checkout.sh" that contains the following:
#!/bin/sh
svn co http://code.djangoproject.com/svn/django/trunk/
FYI, once you've checked out the repository, at any time, you can go
into the django folder and type 'svn up' to s
On Jan 18, 2007, at 4:21 PM, James Bennett wrote:
On 1/18/07, David Zhou <[EMAIL PROTECTED]> wrote:
So Django would combine [1:3] and [3:10] into one database hit?
Accessing an object in 'b' after doing this will result in a database
query. Accessing an object in 'c' after doing this will
On Jan 18, 2007, at 9:35 AM, Jeremy Dunck wrote:
On 1/17/07, Adam Seering <[EMAIL PROTECTED]> wrote:
...
We're not eager to use the SVN HEAD version of source on our main
servers. The Django API-change docs are good, but not that good; we
have had code break unexpectedly in the past after "
Julio Nobrega ha scritto:
I had a bunch of unicode errors using the template tag trans while
using Python 2.3. Upgrading to 2.4 solved all my problems.
What version of Python are you using?
I'm using python 2.4.3. I've also tried updating gettext without
success.
Thank you,
Cristiano
--
Johnny I don't know what kind of Operating System you are using, but
here is what I do on my Mac and Linux machines...
I create a small script "checkout.sh" that contains the following:
#!/bin/sh
svn co http://code.djangoproject.com/svn/django/trunk/
Make it executable and run it. You will ne
On 1/18/07, David Zhou <[EMAIL PROTECTED]> wrote:
So Django would combine [1:3] and [3:10] into one database hit?
No.
a = MyModel.objects.all()
b = a[1:3] # This is a new QuerySet object with no knowledge of any others.
c = a[3:10] # This is another new QuerySet object with no knowledge of
an
On 1/18/07, Steve Wedig <[EMAIL PROTECTED]> wrote:
it appears that my user's passwords are stored in plaintext in the
control panel. for example, as an admin, i can go through and see
their plaintext passwords. is there a way to hide them?
How are you creating the users? Django's own user-crea
it appears that my user's passwords are stored in plaintext in the
control panel. for example, as an admin, i can go through and see
their plaintext passwords. is there a way to hide them?
Thanks,
- Steve
--~--~-~--~~~---~--~~
You received this message because yo
Hello djanonauts,
I am writing unit tests for a project, and I would like to test my
views. The documentation
(http://www.djangoproject.com/documentation/testing/) suggests using
django.test.client.Client to do the deed. When I use it in tests.py,
it works fine, I can view the template and con
Hi Robert,
On 18/01/07, Robert <[EMAIL PROTECTED]> wrote:
I know newforms are still in development, but maybe there are known
practiced on
how to manage custom Form.
Let's say there's a model:
ITEM_TYPE_CHOICES = (
('new','new'),
('used','
Rob Hudson wrote:
What else needs to be set here?
I found my own answer. I need to set this so my picky-against-spam
Postfix config will let these through:
File: conf/default_settings.py...
# E-mail address that error messages come from.
SERVER_EMAIL = '[EMAIL PROTECTED]'
-Rob
--~--~-
At 03:14 PM 1/18/2007, you wrote:
Hmmm. I'm seeing a fully-qualified domain name error in my Postfix
logs b/c Django is sending as [EMAIL PROTECTED] Even though I do have
DEFAULT_FROM_EMAIL set and password resets are working correctly.
What else needs to be set here? Or is this a Postfix p
Hmmm. I'm seeing a fully-qualified domain name error in my Postfix
logs b/c Django is sending as [EMAIL PROTECTED] Even though I do have
DEFAULT_FROM_EMAIL set and password resets are working correctly.
What else needs to be set here? Or is this a Postfix problem on my end?
--~--~-~
On Jan 18, 2007, at 2:11 PM, James Bennett wrote:
On 1/18/07, Joseph Heck <[EMAIL PROTECTED]> wrote:
I believe that doing [1:3] and [3:10] separately will result in
two database
queries - it evaluates on the the slice. If you wanted to curl
that into one
call, then it would be up to you to
On 1/18/07, conrad22 <[EMAIL PROTECTED]> wrote:
Deryck, I thought it ought to be along those lines, but I can't seem to
get it working.
I'm trying to use:
org_name = models.CharField ('Organisation', maxlength = 200)
class Meta:
ordering = 'org_name',
But still sorts chronologically
Hello,
I'm using django 0.95 and xgettext 0.14.6 on fedora core 6.
My app's sources are all in utf-8. It is declared explicitly on top of
any page like this:
# -*- coding: utf-8 -*-
My app is written in italian, so it uses non-ascii characters. Upon
calling make-messages I keep getting:
xgett
I had a bunch of unicode errors using the template tag trans while
using Python 2.3. Upgrading to 2.4 solved all my problems.
What version of Python are you using?
On 1/17/07, guzru <[EMAIL PROTECTED]> wrote:
I'm using django 0.95 and xgettext 0.14.6 on fedora core 6.
--
Julio Nobrega - h
On 1/18/07, Joseph Heck <[EMAIL PROTECTED]> wrote:
I believe that doing [1:3] and [3:10] separately will result in two database
queries - it evaluates on the the slice. If you wanted to curl that into one
call, then it would be up to you to do your original slice as [1:10] and
then pull out the
We've run into a pretty annoying issue lately with Django. Being that
our site is VERY large, and the codebase has become a framework for the
smaller sites, which all run off the same load balanced servers, we
began seperating content.
For example:
- We have www.curse-gaming.com, which is all t
I working on an cms site with django ,I use the admin site too.there is
a department tree like below :
Big Company
|--- Child Company A
|--- Child Company B
|--Child Company C
We put an admin role on every company node, and every admin can only
view data's on or children nodes
Hi all. I have problem with managing urls. I manage international site
which works with diffrent adres e.g. www.example.com, www.example.uk,
www.example.de. I want redirect any user which enter to www.example.uk
to www.example.com/uk/. So I can set redirect on www.example.uk but I
don't know why
Deryck, I thought it ought to be along those lines, but I can't seem to
get it working.
I'm trying to use:
org_name = models.CharField ('Organisation', maxlength = 200)
class Meta:
ordering = 'org_name',
But still sorts chronologically...?
--~--~-~--~~~---
Still having trouble... what does this mean?
File "/home2/baxter/lib/python2.4/django/core/handlers/base.py", line
74, in
get_response
response = callback(request, *callback_args, **callback_kwargs)
File
"/home2/baxter/webapps/django/gretschpages/user_details/views.py", line
19,
in edit_pr
I have right now 0.95, I would like to upgrade to current dev source.
Is there a command I can issue to upgrade? If not what do I need to do?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django
users" group.
To
Hi all. I try make internationalization to my django app I copied
make-messages.py to my project directory, Next I execute it with swich
-l Local and I get this warning:
processing language LOCAL
errors happened while running xgettext on constants.py
So I start looking information about xgettext
Hi,
I know newforms are still in development, but maybe there are known
practiced on
how to manage custom Form.
Let's say there's a model:
ITEM_TYPE_CHOICES = (
('new','new'),
('used','used')
)
class Item(models.Model):
owner = models.F
We have two database apps, in two different directories. Django sees
these both as database_. I thought this was ok except we
obviously have issues w/ permissions and content types, which we'll be
changing, except tonight I came across the fun error that it's showing
data from the wrong tables.
On Jan 18, 2007, at 12:56 PM, Joseph Heck wrote:
I believe that doing [1:3] and [3:10] separately will result in two
database queries - it evaluates on the the slice. If you wanted to
curl that into one call, then it would be up to you to do your
original slice as [1:10] and then pull out
I also had to set EMAIL_HOST in settings.py to the name of my ISP's
SMTP server. Otherwise localhost is used.
Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, sen
I am not sure whether this will work. But one way to do it is to create a
model Image
and
class Image(models.Model)
entry = models.ForeignKey(Entry, edit_inline=models.TABULAR,
num_in_admin=5)
image = models.ImageField(.
class Admin:
pass
class Entry(
I think this will
I believe that doing [1:3] and [3:10] separately will result in two database
queries - it evaluates on the the slice. If you wanted to curl that into one
call, then it would be up to you to do your original slice as [1:10] and
then pull out the pieces for your internal loops as needed.
-joe
On 1
On 1/18/07, Rob Hudson <[EMAIL PROTECTED]> wrote:
A "MAINTENANCE_MODE" sounds good. Thanks for the suggestion!
Another possible solution is to use a deployment utility which can
automatically switch this for you; IIRC Capistrano (which is pretty
darned sweet) has this feature.
--
"May the fo
On 1/18/07, Rob Hudson <[EMAIL PROTECTED]> wrote:
How can I set up Django to email me the traceback or simply an error
message when it encounters a 500 Internal Server error?
Django should automatically email everyone in the ADMINS setting on a
500, provided that the DEBUG setting is False --
When I try to add a FloatField to list_display in the admin, I get the
following error:
Am I doing something wrong?
Probably not. Dealing with floats/decimals can be a bit tricky. Take a
look at this thread -
http://groups.google.com/group/django-users/browse_frm/thread/a9bfd4010a99255
IIRC, that gets set based on what is in the login form's hidden field
named "next". REDIRECT_FIELD_NAME is in django.contrib.auth and is set
to "next" by default.
You can override it in the template like this:
This will always redirect to the root of the site "/".
If that value is empty,
I've read that setting ADMINS will send emails on errors. I'm guessing
like for 404s or 500s. But I've never seen any error messages come to
me even though I do get errors occasionally.
How can I set up Django to email me the traceback or simply an error
message when it encounters a 500 Intern
A "MAINTENANCE_MODE" sounds good. Thanks for the suggestion!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe
x = cache_page(x, 60 * 15)
that´s right, isn´t it?
Am 18.01.2007 um 17:35 schrieb Robert:
Did you specify the timeout ? in your cache_page decorator ?
--
Robert
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to t
Did you specify the timeout ? in your cache_page decorator ?
--
Robert
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to django-users@googlegroups.com
To un
I´m trying to use the per-view cache, but I get the error that
CACHE_MIDDLEWARE_SECONDS is missing in settings.py:
Error was: 'Settings' object has no attribute 'CACHE_MIDDLEWARE_SECONDS'
why do I need this, I´m not using the middleware?
thanks,
patrick
--~--~-~--~~
On Jan 18, 2007, at 11:00 AM, Fred wrote:
You just upload the images to a directory and reference them using
plain good old html? Please say it ain't so... ;-)
It's what I do, giving it a right or left class as needed.
It's easy, works, and flexible in that I can put the images wherever
On 1/18/07, Randy <[EMAIL PROTECTED]> wrote:
Just to report some progress... if I change the line in my
.../fun/urls.py from:
(r'^now/$', current_datetime),
to:
(r'/now/$', current_datetime),
then the following link will execute the 'current_datetime' method
properly:
http://localhost/
Patrick J. Anderson wrote:
class MyModel(models.Model):
text_en = TextField()
text_pt-br = TextField()
Django complains with a SyntaxError: can't assign to operator on
"text_pt-br = TextField()" line
This just what I did in my models, but perhaps there'
I think I might be seeing more probblems than there really are, time
for a reality check. I'd like to use Django for a small newsblog, but I
know for sure that I'll need to put a number of pictures into each
newsentry. I can create a model for news/blog-items, add an imagefield
to such a newsitem
On Thu, 11 Jan 2007 16:58:34 -0600, Jacob Kaplan-Moss wrote:
On 1/11/07 2:35 PM, Nuno Mariz wrote:
Any idea to resolve this , this don't scale. If I what to add another
language, I have to patch all of my templates.
If I were you, I'd write a simple accessor on your model to get the current
Hi,
i'm trying to use user authentication.
In my urls.py i have this:
(r'^login/$', 'django.contrib.auth.views.login', {'template_name':
'main/login.html' }),
It works but i get redirected to /accounts/profile/ afterwards instead
of a page i want.
I looked at the source code:
def login(requ
Hi all,
I'm a little confused about when querysets are evaluated.
Supposing that my generic is passed a queryset = entries where
entires = Entry.objects.all(), would the queryset be evaluated when I
first start a for loop in the template?
What if I want to slice it in two for loops? For
On Jan 17, 2007, at 10:01 PM, James Bennett wrote:
Some of the people on this project are having serious concerns about
the choice to use Django for this particular project; do folks have
any thoughts/answers for them?
I'm not sure really what sort of answers there are to give; there
aren't
On 1/18/07, conrad22 <[EMAIL PROTECTED]> wrote:
I might be missing something in the documentation here, but is there an
obvious/easy way to call a list of objects
alphabetically?
All that 'ordering' does in a Meta class on a model is order
chronologically, no?
with thanks
No, it orders by wh
I'm not sur to understand your question, but maybe this could help :
http://www.djangoproject.com/documentation/db_api/#order-by-fields
On 18 jan, 16:01, "conrad22" <[EMAIL PROTECTED]> wrote:
I might be missing something in the documentation here, but is there an
obvious/easy way to call a list
Hi Guillermo!
But what would happen in this case if two sites use very different
templates for the same app?
My templates used to have the same skeleton, the diference could be the
base_site.tmpl, I can replace the base_site.tmpl on the
project/templates/appname, I can use stylesheets to defi
Got it... the errant app had put entries into auth_permissions that
conflicted with the real gp_user permissions. Gotta remember, if you
mess with the content-type table, you gotta look at permissions, too.
Second time that's caught me out.
--~--~-~--~~~---~--~~
Some headway... I manually recreated an index on user_details_gpuser,
and now I've got that back, both in the admin and in the public
section.
However, attempting to edit in auth_user still throws an error:
ContentType matching query does not exist
--~--~-~--~~~---~
I might be missing something in the documentation here, but is there an
obvious/easy way to call a list of objects
alphabetically?
All that 'ordering' does in a Meta class on a model is order
chronologically, no?
with thanks
--~--~-~--~~~---~--~~
You received thi
If it's any help, I think an index on user_details_gpuser was destroyed.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to django-users@googlegroups.com
To u
On 1/17/07, Adam Seering <[EMAIL PROTECTED]> wrote:
...
We're not eager to use the SVN HEAD version of source on our main
servers. The Django API-change docs are good, but not that good; we
have had code break unexpectedly in the past after "svn up"'s, and
that just makes us sad when it happens
Just to report some progress... if I change the line in my
.../fun/urls.py from:
(r'^now/$', current_datetime),
to:
(r'/now/$', current_datetime),
then the following link will execute the 'current_datetime' method
properly:
http://localhost/fun/now/
Yeah! -Randy
--~--~-~--~
On 1/18/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
...
you won't have the Python Imaging Library available through
Dreamhost. They haven't installed it, and efforts to get them to are
met with bovine incomprehenstion.
I could be missing something, but couldn't you install it in your
home
I'm no expert, and I haven't read the book you are working from, but it
seems the problem is the "/fun" part introduced in the apache config.
You don't have "fun" in the urls you use with the development server,
but apache has been configured to need the "fun" at the beginning in
order to route t
My Dreamhost Django notes: Don't. They're not up to it for anything
more than a toy site.
For example, using the notes above, and setting Django up to use python
2.4 means you won't have the Python Imaging Library available through
Dreamhost. They haven't installed it, and efforts to get them to
I don't think I was clear... I've removed the second model altogether,
and removed any trace of it from the database. But I think something
from my real GpUser class got removed or altered, too, probably
something in contenttypes.
--~--~-~--~~~---~--~~
You receiv
No, that doesn't work either. Let me summarize - I'm simply trying to
get the example in chpt 3 at djangobook.com working using apache:
My /homedir/djangoProj/fun contains the following in urls.py:
from django.conf.urls.defaults import *
from fun.views import current_datetime
urlpatterns = pa
You need to send your choices to both the widget and the form.
the_choices = [(c.id,c.description) for c in CustomerType.objects.all()]
customer_type = forms.MultipleChoiceField(
required=False,
widget=forms.SelectMultiple(attrs={'size':'3'}, choices=the_choices)
choices=the_choices)
* Rubic wrote, On 14.01.2007 18:19:
I've been using newforms for a few days now and just
ran across something in ChoiceField that might be worth
sharing.
However, sometimes you'd like the choice list to
be dynamic, to reflect the current values in the
model. My approach is to create a class
How about try this url?
http://localhost/fun/now
Your application is seemed like to serve urls that starts with
http://localhost/fun.
"/now" should be followed by /fun to served by apache and passed to
mod-python handler.
--~--~-~--~~~---~--~~
You received this
In that case, the problem seems to be in your urls.py file.
The fact is, the name of yur app does not have to be the name of the
url to access your app.
I mean, you can have an app called 'fun' and access it as /fun/,
/now/, /whatever/,... this will be defined in urls.py.
Now, did you try to a
Thanks for your reply. I *am* running my apache server (and restarted
it after making all changes). When I try to go to:
http://localhost/fun/, I get the following debug output from django in
the page:
Using the URLconf defined in fun.urls, Django tried these URL patterns,
in this order:
1.
Rob,
You could use a middleware to do this, which runs before every view.
Try and get a connection in there, and if it can't then forward to the
'no database' template.
http://www.djangoproject.com/documentation/middleware/
The disadvantage is that you incur an extra SQL query for every
reques
Hi,
You are simply supposed to run Apache (/etc/init.d/apache2 start) and,
if well configured, mod_python will take care of everything. With
Apache, you're not supposed to use manage.py in any way.
The thing you must think about is to add a web server to, well...
serve the /media files. For tha
Hello - and thanks to the developers for django,
I'm a newbie at django, actually a newbie at web frameworks in general,
but I know Python. I've got django installed (from svn), mod_python
(3.2.10) working in apache (2.0.55), and I can make things work running
the web server embedded in django
[EMAIL PROTECTED] wrote:
Does everyone manage to get loosely coupled applications in their
projects? Any
tips to share? Is my twisted mind unrecoverable?
It's just a matter of deciding in your own mind when the code you're working on
has different functionality -- no different form any time
81 matches
Mail list logo