> The signals are only within the same process, though. They don't wake up
> other processes (they are not UNIX signals). Fortunately, the process
> started by your cronjob can just import any bits of Django it might need
> (e.g. for accessing models) and do the work directly.
I currently have th
I can't find any documentation on dispatcher/signals. Is there any
documentation or should I just 'fork the code'?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send em
I've been looking around and the dispatcher/signals combo seems like a
possible solution. I could raise the signals using cronjobs or so.
Unfortunately I can't find any decent documentation on
dispatcher/signals. Does anybody here have a pointer?
--~--~-~--~~~---~--~-
Just for the record: ANDing 2 Q-objects doesn't work either...
--~--~-~--~~~---~--~~
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
OK, thanks for your reply.
Both possible solutions you propose are 'polling' solutions. The first
is triggered by a in-memory object (a running process), the second by a
user-request. I'm interested in the first solution since I can't wait
for a user-request before checking for scheduled events. T
Thank you! That is a pretty obscure method.
--~--~-~--~~~---~--~~
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 from this group, se
Given:
=Models==
class T(models.Model):
pass
class Y(models.Model):
t = models.ForeignKey(T, blank=True, null=True)
I want to select all instances of a Y that have a null value for t. I
would say that it should be...
Y.o
Forgive me if this is a stupid question, I'm a complete newbie when it
comes to databases, but how can I make the database generate events?
The problem is that one of my models has a DateTimeField that is set to
some point in the future. Somehow I want to be notified when that time
passes. I can d
Thanks!
That is indeed in a non-intuitive location.
--~--~-~--~~~---~--~~
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 from this
My model has a choice field:
===
class Foo(models.Model):
STATUS = (
('C', 'Created'),
('E', 'Edited'),
('F', 'Finished'),
)
status = models.CharField(maxlength=1, choices=STATUS)
=
Thanks for the pointer, but how can I add a parameter to the textarea
formfield, such as:
==
==
if these formfields are automagically generated by Django?
--~--~-~--~~~---~--~--
How can I set a maximum for the amount of text a user enters in a
TextField form? CharField has a 'maxlength' parameter, but TextField
not.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To po
There is no formatting whatsoever, so I guess I can feel comfortable
storing (max) 5000 characters in a database field. Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this g
Thanks for the pointer, but flatpages is not exactly what I am after.
To be more specific: one of the fields in my model is a TextField that
holds a maximum of 5000 characters. This means that each instance of
the model (i.e. each row in the db table) potentially contains 5k
characters. Is that to
I'm new to database programming and I'm wondering if I should put
around 1 page of plain text (<5000 characters) in a database or in
files on the filesystem. Any suggestions?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
I'm trying to learn how to use CSS in combination with Django (I owe a
great deal to Jeff Croft for his LOST theories example
site).Unfortunately I ran into the following problem. I am using a
'base.css' that loads other css files, e.g.
@import url("homepage.css");
@import url("user.css");
Only
Python quick reference (invaluable):
http://rgruet.free.fr/PQR24/PQR2.4.html
--~--~-~--~~~---~--~~
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
T
That works, great!
So should I always use 'manipulator.flatten_data()' instead of
'obj.__dict__' for filling forms with existing values?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post
I'm using manipulators.
==MODELS==
class Pizza(models.Model):
toppings = models.ManyToManyField(Topping)
class Topping(models.Model):
name = models.CharField(maxlength=100)
===
==VIEW=
errors = {}
pizza =
new_data = pizza.__di
-1
Look at the list now, most posts are general Django questions that most
users are interested in (at least at one point). Splitting them up
would mean monitoring different lists for most of us.
--~--~-~--~~~---~--~~
You received this message because you are subs
In a form for changing a model instance all fields get correctly filled
with existing values except the ManyToManyField form fields (which
renders as a choice list in a form). It shows the correct list of
options, but none of the options is selected, even though the instance
of the model should ha
Great! Thanks for the excellent reply.
--~--~-~--~~~---~--~~
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 from this group, send em
I want to limit a view to certain group members, so I'm using the
following decorator:
@user_passes_test(lambda u: Group.objects.get(name='admin') in
u.groups.all(), login_url='/accounts/login/')
This seems a little verbose. Is there a better way?
--~--~-~--~~~---~-
Anybody?
--~--~-~--~~~---~--~~
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 from this group, send email to [EMAIL PROTECTED]
For m
Sean: Thanks, man, that link saved my day (at least a few hours)! This
should definitely be mentioned in the Django documentation asap.
Scott: yup, and I can now just say follow = {'date_joined': False}
instead of specifying both date_joined_date and date_joined_time by
hand (as I described above
OK, I got the dates working now that I've converted them to strings.
But I can't set the value for the 'is_superuser' attribute using the
same mechanism:
==VIEW==
userManipulator = User.ChangeManipulator(request.user.id)
origUser = userManipulator.original_object
new_data_
OK, I got the dates working now that I've converted them to strings.
But I can't set the value for the 'is_superuser' attribute using the
same mechanism:
==VIEW==
userManipulator = User.ChangeManipulator(request.user.id)
origUser = userManipulator.original_object
new_data_
What works is this:
=
new_data_user['date_joined_date'] = str(origUser.date_joined.date())
=
Not sure if that is wise...
cyberco wrote:
> Besides, if I don't pass all attributes I have to set them manually. In
> case of User.date_j
Besides, if I don't pass all attributes I have to set them manually. In
case of User.date_joined somehow none of the following works:
=
new_data_user['date_joined'] = origUser.date_joined
new_data_user['date_joined_date'] = origUser.date_joined_date
new_data_user['date_joined_
Besides, if I don't pass all attributes I have to set them manually. In
case of User.date_joined somehow none of the following works:
=
new_data_user['date_joined'] = origUser.date_joined
new_data_user['date_joined_date'] = origUser.date_joined_date
new_data_user['date_joined_
Thanks to everyone here, this really helped me out.
One thing I still have questions about it Eric's remark:
> ---
> Take note that, since the is_superuser is not a required field, iirc,
> you don't have to set it in new_data if your intent leave the value the
> same.
> ---
I indeed want to keep
Max, I'm not sure I fully understand your reply. Currently I got things
working by passing the user object to the template and returning its
attribute values:
Is this a security hole?
--~--~-~--~~~---~--~~
You received this mes
Once permissions are added to the auth_permission table it doesn't
matter how often I invoke 'manage.py syncdb app' or 'manage.py reset
app', stale records are never deleted. Is this normal behaviour?
--~--~-~--~~~---~--~~
You received this message because you are
In my model:
=
image = models.ImageField(upload_to='pics',
validator_list=[validators.isValidImage], blank=True)
=
I am able to upload an image once using an appropriate form:
=
Image: {{form.image}}{{form.image_file}}
In my form I want to enable users to change an image (ImageField), but
although I can fill fields of other types with their existing values,
this is not the case with an ImageField. How can I accomplish that?
--~--~-~--~~~---~--~~
You received this message because
I want to pass the user.is_superuser attribute through a form without
enabling the user to edit it, so I use a hidden field. Like this:
TEMPLATE=
=
Weird enough this results in the following HTML:
=HTML
" />
=
And when submit
With the following model and template:
==MODEL
videoFile = models.FileField (upload_to='videoupload', blank=True)
==TEMPLATE=
Video File:
{{form.videoFile}} {{form.videoFile_file}}
The HTML output rende
Ah! Thanks for the tip. That didn't cross my mind. Learning all the
time, I guess.
--~--~-~--~~~---~--~~
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
Given the model:
===
myText = models.TextField(blank=True)
===
In case this TextField has no text I want to hide it from my form.
Template code:
===
{% if form.myText.text %}
Thank you very much! That was indeed the issue. There was a site in the
db, but apparently things were corrupt. Removing all sites and adding a
new one via the admin interface solved the problem. Not sure if that is
a bug or a feature :)
Your query works as well (although 'domain' and 'name' shou
I'm still having this problem (neglected it for a while, but now is the
time I MUST solve it). Has anybody here a suggestion in which direction
to search?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django user
I found the error. I was using the ipython shell to run 'run manage.py
reset myapp' but unfortunatly things got cached. Running 'sqlreset'
instead of 'reset' showed me that some old SQL was used, so updating
the models didn't change the SQL. :(
Restarting IPython fixed the problem.
--~--~---
I was using the ipython shell to run 'run manage.py reset myapp'
(because I was using IPython anyway) but unfortunatly it seemed like
IPython cached the models or SQL. Running 'sqlreset' instead of 'reset'
showed me that some old SQL was used, so updating the models didn't
change the SQL. that IPy
Hmmmit turns out that the problem is with a ForeignKey. The example
above (unfortunately) doesn't show it, but my model T also contains 2
ForeignKeys. The database (mysql) accepts the same value (in different
rows) for one ForeignKey, but not for the other. That baffles me. I've
tried everythi
> Did you used to specify it in your model and then you removed it from
> the Python code without altering the database table?
Nope. I DID change the table (removed 'unique=True'), but I also
altered the db tables (syncdb, reset app, dropped tables by hand).
> Have you made any
> other alteratio
Somehow creating 2 instances of a model constantly gives me the
following error:
--
1062, "Duplicate entry '1' for key 2"
--
The code in the view method is:
--
def new(request):
t = T(userID=request.user.id)
t.save()
--
It seems that userID should be unique, but
Wow, that does the trick! Thank you very much.
I'm not exactly sure what this command does, though
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to djang
Yes, but the disadvantage of using 'import x.y.z as mymodel' instead of
'import x.y.z'b is that instead of using a = A() I have to say a =
mymodel.A().
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users"
I may have cheered to early: what if I don't use 'import as', but
'site.app.models import *'? If I do 'reload(models)' the Django models
are reloaded, and doing 'reload(site.app.models)' throws an exception
saying 'site' does not exist...
--~--~-~--~~~---~--~~
You
Ah! Thanks for the tip! I totally forgot about Python's reload method
because my mind was on a 'db-track' all the time.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, se
Ai, really? I'm a n00b when it comes to SQL and the SQL statement of a
chained filter (as listed by connection.queries) is about 8 (!) lines
of SQL abacadabra. Sure there is no other way to solve this issue? Will
the bug be fixed in the next release?
--~--~-~--~~~---~
Using the ipython started from manage.py I noticed that changes to the
db are not automatically picked up (added values for instance). I have
to restart the shell to pick them up, which also means I have to
reimport everything and I loose my shell history.
Is there a way to pick up the changes w
Having:
___
class Pizza(models.Model):
name = models.TextField()
toppings = models.ManyToManyField(Topping)
class Topping(models.Model):
name = models.TextField()
___
...and for instance having toppings 'tomato' and 'cheese', how do I
select all pizza's with
Is anybody else having this problem?
--~--~-~--~~~---~--~~
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 from this group, send emai
OK, but what to do with the following in case of 2 models:
===
new_data = request.POST.copy()
errors = manipulator.get_validation_errors(new_data)
if not errors:
manipulator.do_html2python(new_data)
==
The complete method is:
===
def new(request):
manipulato
Yes, but I want only one 'submit' button on the html page. This means
that the POST data goes to one 'view' method. How can I first create an
instance of A and then an instance of B (with A's id) with the same
POST data?
--~--~-~--~~~---~--~~
You received this mes
I want to enable users to fill out two forms (textareas) on one page,
where each form creates a new instance of a model/class. I have the 2
following models:
class A(models.Model):
text = models.TextField()
class B(models.Model):
a = models.ForeignKey(A)
text
Login a user out works fine, but I can't get logging in working (0.95).
I keep getting 'Site matching query does not exist'. What I got:
urls.py:
(r'^accounts/login/$', 'django.contrib.auth.views.login',
{'template_name': 'registration/login.html'}),
(r'^accounts/logout/$', 'django.c
> use the ordinary addmanipulator example from the docs
> remember that the fileinfo is in request.FILE and not request.POST
> form type should be multipart/mime-encoded
>
> with these changes you are set
Thanks, together with the example of the link I posted I got it working
now. What I was afte
I'm having troubles understanding the logic of uploading files. I saw a
lot of code snippets, but nowhere I can find an example that explains
all the steps. This article comes close but is lacking some info as
well:
http://blog.go4teams.com/?p=56
I hope somebody here has a pointer to a good examp
Found my error: the 'include' should be removed:
(r'^proj/', 'proj.app.views.index),
More about this can be read here:
http://www.djangoproject.com/documentation/tutorial3/#decoupling-the-urlconfs
--~--~-~--~~~---~--~~
You received this message because you are su
Found my error: the 'include' should be removed:
(r'^proj/', 'proj.app.views.index),
More about this can be read here:
http://www.djangoproject.com/documentation/tutorial3/#decoupling-the-urlconfs
--~--~-~--~~~---~--~~
You received this message because you are su
Oh yeah, and the exception is:
Traceback (most recent call last):
File
"C:\Python24\lib\site-packages\django-0.95-py2.4.egg\django\core\handlers\base.py"
in get_response
65. callback, callback_args, callback_kwargs = resolver.resolve(path)
File
"C:\Python24\lib\site-pa
Oh yeah, and the exception is:
==
*
C:\Python24\lib\site-packages\django-0.95-py2.4.egg\django\core\handlers\base.py
in get_response
58. for middleware_method in self._request_middleware:
59. response = middleware_method(request)
60. if response:
Anybody? What should go in urls.py if my project is called 'proj', my
app 'app' and there is a method 'index' in views.py? I would say the
following, but that doesn't work:
(r'^proj/', include('proj.app.views.index)),
Thanks any suggesting about what I'm doing wrong here?!
--~--~-~--~-
Using Django .95 I'm trying to create a simple view based on the
examples in tutorial 3, but somehow things don't work. The syntax of
the examples is also different than what's in urls.py. Is there any
updated documentation somewhere?
--~--~-~--~~~---~--~~
You rec
I'm trying to add a FileField to one of my models, but I keep getting
an exception whenever I try to open the admin page. The code is:
class Test(models.Model):
fileUploadField = models.FileField(upload_to='tmp/', core=True)
The stacktrace is below.
Tra
Sorry, I had an old version of Django installed which caused the
problems.
--~--~-~--~~~---~--~~
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
I've checked out the latest SVN version of Django, but when I try
'python manage.py shell' I get the standard shell, not IPython. But I
have IPython installed on my computer. At the shell's command prompt I
can just type 'import IPython' without a problem. I have IPython
installed with readline, c
69 matches
Mail list logo