Ok, that makes sense, but I'm still getting weird behavior.
Right after I call limit_categories() in my view, I inserted the print
statement: "print form.category.queryset" so that I can see the
contents of the queryset printed to the console. The result is that
the console shows the correct
Hmm, yeah, I guess it should... I don't really know much about the
inner workings of ModelForms, but you could try inserting print
statements or something the like directly in the django code for
testing purposes. Or just look at the django code. That almost always
solves the problems I have.
On
I've been looking through the ModelForms code and can't really find a
way to fix this.
I changed the view code to this:
print form.category.queryset
form.category.queryset =
Category.objects.filter(blog__exact=request.user.author_set.all()
[0].blog)
print form.category.queryset
And my console
The server is running suExec therefore Apache executes as the user. So it
should be able to read my library.
James
On Mon, Jun 16, 2008 at 5:08 PM, Karen Tracey <[EMAIL PROTECTED]> wrote:
> On Mon, Jun 16, 2008 at 9:19 AM, James Matthews <[EMAIL PROTECTED]>
> wrote:
>
>> Karen
>>
>> The library
I think there should be a better way to do this.
I believe that there should be a way to override the admin index for
each application separately. It would also have to be a way to specify
the way these templates are displayed.
I'm currently trying to override the admin index of one
If you just want an editable "about" page, the flatpages app might do
what you want.
http://www.djangoproject.com/documentation/flatpages/
Regards,
Daniel
Am Montag, den 16.06.2008, 13:23 -0700 schrieb ocgstyles:
> The client wants certain parts of the site to be editable, I don't
>
Hi there,
got a Problem. Maybe someone knows a solution.
I have a model Data which is linked via a foreignkey to the model
Participant.
I have overwritten the delete() Method in the model Data.
When i delete a instance of Data via the Admin-Interface, delete() is
called appropriately.
When i
Thanks - it was late and I got my objects messed up. I did try the
commit=False save but then I wasn't saving the object returned, but
assigning to the same object (i.e. form) and trying to RESAVE that..
Thanks again.
Richard (another happy django convert).
On Jun 17, 12:03 am, "[EMAIL
Is there anything built into the cache system to manage the deletion/
invalidating of cache?
All the examples seem to be based on setting a time.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
AFAIK, related models are not deleted by invoking delete().
A better way to recognize deletion is the use of signals, i.e.
pre_delete and post_delete
http://code.djangoproject.com/wiki/Signals
Hope that helps.
Regards,
Daniel
Am Dienstag, den 17.06.2008, 02:54 -0700 schrieb Daniel Austria:
>
On 16 juin, 22:23, ocgstyles <[EMAIL PROTECTED]> wrote:
> The client wants certain parts of the site to be editable, I don't
> particularly agree with the logic, simply because why take a DB hit
> (although small) just to grab text from a database for an "About" page
> when that text us USUALLY
Cool!
Thank you very much for your response. i ll use signals!
regards
Dan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to
I have a postgres database (8.1.11) with > 200 tables that has regular
minor changes(most of them adding fields or tables). So I want to use
model inheritance to separate logic form model definition. Inspectdb
creates the models which I then edit to make abstract base classes.
I'm running Django
I have a postgres database (8.1.11) with > 200 tables that has regular
minor changes(most of them adding fields or tables). So I want to use
model inheritance to separate logic form model definition. Inspectdb
creates the models which I then edit to make abstract base classes.
I'm running Django
> form.category.queryset =
> Category.objects.filter(blog__exact=request.user.author_set.all()
> [0].blog) print form.category.queryset
I am somewhat surprised that this would work at all. The field objects
should be accessible via
FormClass.base_fields['fieldname']
or
I have a postgres database (8.1.11) with > 200 tables that has regular
minor changes(most of them adding fields or tables). So I want to use
model inheritance to separate logic from model definition. Inspectdb
creates the models which I then edit to make abstract base classes.
I'm running Django
Thanks so much guys! :)
On Jun 16, 7:43 pm, "Oscar Carlsson" <[EMAIL PROTECTED]> wrote:
> No, you don't have to load everything by hand - there is another way :)
>
> http://superjared.com/entry/django-and-crontab-best-friends/
>
> Oscar
>
> On Mon, Jun 16, 2008 at 11:33 PM, Karen Tracey <[EMAIL
Michael,
As it turned out, I just needed to set the Category queryset using the
"form_instance.fields['fieldname'].queryset = myqueryset" syntax that
you suggested.
I'm still not sure what was going on there before, but it seems
everything is working now.
Thanks for the help.
Eric
On Jun 17,
On Tue, Jun 17, 2008 at 3:48 AM, James Matthews <[EMAIL PROTECTED]> wrote:
> The server is running suExec therefore Apache executes as the user. So it
> should be able to read my library.
>
SuEXEC cleans the environment before calling your code. According to Step
19 described here:
Resolved. Don't know how.
On Jun 14, 9:16 pm, Chris Haynes <[EMAIL PROTECTED]> wrote:
> This error goes away if I remove the line
> (r'^ptree/$', mysite.trees.views.parse_tree),
> from the urlpatterns. But I can import trees.views from the shell
>
> ~/dj/mysite 144: manage.py shell
> Python
I have a page: http://www.joshuajonah.com/blog2/200...rst-blog-post/
It has a comment_count and a comment_list, they are being called
exactly the same way, however, comment_list has no items.
post_detail.html (template for a wrapper around a
date_based.object_detail): http://dpaste.com/57001/
The main issue here is that there are two types of batch deletes in
Django:
1. You can query for the models you want to delete, loop through the
queryset, and delete them each individually. Your custom delete
methods (if any) will get called, and you'll get pre_delete and
post_delete signals.
Hello everyone,
I have a question for you all that has been discussed before but I
cannot figure out the best way to go about implementing.
I have the following model:
class DesignSet(models.Model):
priority=models.ForeignKey(Priority)
status=models.ForeignKey(Status,
Gene Campbell wrote:
> Hello Djangonauts
>
> I'm a noob on both Django and Python, so this question might be easy
> for the experts out there. I am trying to do test first development
> during the development of my model code. (I have lots of experience
> with test first coding in the Java
> It isn't very clear from that sentence which of the two methods Django
> uses to delete those child records, but looking at the code, it seems
> to be method #2. Since it's using the more-efficient batch delete, no
> custom delete methods are being called, no signals are being sent,
> which is
I just got a new OperationalError message (in the subject line).
Exception Type: OperationalError
Exception Value:SQL logic error or missing database
Exception Location: /home/bob/django-trunk/django/db/backends/
__init__.py in _commit, line 20
The code below has been running
We are currently looking for more Django developers to join us on a
freelance basis.
Location is irrelevant as long as you have a fast and reliable
Internet access.
You will be working from home, so you should be able to work
independently, but also be able to demonstrate effective people and
Replying to myself: maybe this is an instance of Ticket #7411?
http://code.djangoproject.com/ticket/7411
"Saving db object while iterating over a queryset larger than
ITER_CHUNK_SIZE breaks with sqlite"
--~--~-~--~~~---~--~~
You received this message because you
My fault, I must have skipped right over that part. It seems that it
*does* send pre_delete and post_delete signals, but does not call
custom delete methods
On Jun 17, 9:51 am, Daniel Hepper <[EMAIL PROTECTED]> wrote:
> > It isn't very clear from that sentence which of the two methods Django
> >
On Sat, Jun 14, 2008 at 11:52 PM, Ederson Mota Pereira <[EMAIL PROTECTED]>
wrote:
> Hi Cristopher,
>
> Thanks for you feedback.
>
> I'm working only with PyAMF now. My example application is working fine
> with Flex 3 and exposed methods in django side, but I'm having problem with
> class
I created a django app and turned it into a stand alone app.
Everything is working, except for the look of the page is all messed
up.
I need to serve static files (I think) in urls.py but somehow I am
messing up my code:
Replying to myself again, closing the issue at least for me for now:
On Jun 17, 10:02 am, bobhaugen <[EMAIL PROTECTED]> wrote:
> Replying to myself: maybe this is an instance of Ticket
> #7411?http://code.djangoproject.com/ticket/7411
>
> "Saving db object while iterating over a queryset
Hi all django friends,
I must login a user in my site than redirect to another site with 2
parameters via post method.
It's possible do that in my registration view?
my example code:
if request.POST:
redirect_to = settings.REDIRECT_URL
errors =
Am Dienstag, 17. Juni 2008 17:22:46 schrieb Molly:
> I created a django app and turned it into a stand alone app.
>
> Everything is working, except for the look of the page is all messed
> up.
what happens if you call one of the static files directly in your browser?
Does the path to the static
Hello,
I have a question regarding displaying information in django
templates. I would like to display a nested dictionary(Hash) in the
templates. However the only problem is that the values in the
dictionary are either strings or other dictionaries. If there a way of
knowing the type of
On 6/17/08, MarcoX <[EMAIL PROTECTED]> wrote:
> I tried with httplib e urllib but with no results
Technically, a redirection represents to return result code 301 or 302
and set field Location in the HTTP response header to absolute URL.
HTTP Client then issue a new HTTP request to this
Hi
!
> I must login a user in my site than redirect to another site with 2
> parameters via post method.
> It's possible do that in my registration view?
This is not how a redirect works. If your view returns a
HttpResponseRedirect, Django sends a HTTP 302 code back to the browser
along with the
How would I call the static file in my browser??
Sorry, i'm still a beginner! :P
Thanks for the response :)
Molly
On Jun 17, 12:16 pm, chris vigelius <[EMAIL PROTECTED]>
wrote:
> Am Dienstag, 17. Juni 2008 17:22:46 schrieb Molly:
>
> > I created a django app and turned it into a stand alone
Hi All,
I am relatively new to both python and django. Please help me to do this :
{% for letter in [A to Z] %} < how do I write this line in a template?
{{letter}}
{% endfor %}
Thanks in advance
Regards Ganesh
--~--~-~--~~~---~--~~
You received this
Peter and Daniel, thanks for the reply.
I must use the POST method because the external site WANT a post
method.
parameter2 is a "stupid" info that the external site required.
I try with your (simple) solution, a hidden html form with a
javascript redirect...
many thanks.
On 17 Giu, 18:34,
I would probably just pass in a python list with all of the letters in the
alphabet, then just
{% for l in alphabet_list %} ...
-richard
On 6/17/08, M.Ganesh <[EMAIL PROTECTED]> wrote:
>
>
> Hi All,
>
> I am relatively new to both python and django. Please help me to do this :
>
> {% for letter
For an easy (but locale-dependent) way to get a list of the uppercase
characters in Python, try string.uppercase
http://www.python.org/doc/2.3/lib/module-string.html
Just add that list to your context, and you should be ready to go.
On Jun 17, 12:03 pm, "Richard Dahl" <[EMAIL PROTECTED]>
Hey, there, django-users subscribers! This is your periodic friendly
reminder that the place for job listings is http://djangogigs.com/,
which exists specifically to serve that purpose.
--
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."
MarcoX wrote:
> Peter and Daniel, thanks for the reply.
> I must use the POST method because the external site WANT a post
> method.
> parameter2 is a "stupid" info that the external site required.
> I try with your (simple) solution, a hidden html form with a
> javascript redirect...
I had to
Molly wrote:
> How would I call the static file in my browser??
By typing in the url to the static file directly in the address bar.
For example if your server is example.com, root of django app is myapp,
and images are in img dir, and image is named myjp.jpg the url would be
Bear with me, I'm a Django novice, still reading docs...
I'm trying to build my first app using django admin (release 0.96),
because it's a good match to the requirements (a quick and simple CRUD
application).
I found a thread from last year
Joel Bernstein wrote:
> For an easy (but locale-dependent) way to get a list of the uppercase
> characters in Python, try string.uppercase
>
> http://www.python.org/doc/2.3/lib/module-string.html
>
> Just add that list to your context, and you should be ready to go.
>
> On Jun 17, 12:03 pm,
Suddenly, I am getting the following error when I try to look at my
Timecard objects, via Timecard.objects.all()
>>> Timecard.objects.all()
Traceback (most recent call last):
File "", line 1, in
File "/imaging/analysis/People/imageweb/python-packages/django/db/
models/query.py", line 108,
Hey there
I've been practicing for a while with the template system and I have some
questions:
Lets say that I create this dictionary:
test = dict()
test[0] = {'title': 'My First Title', 'post': 'My First Post'}
test[1] = {'title': 'My Second Title', 'post': 'My Second Post'}
etc... til 10 for
Got it... noticed that there was a single invalid user_id in my
timecard table in the database. Not sure how this could have
happened.
-Adam
On Jun 17, 2:43 pm, Adam Fraser <[EMAIL PROTECTED]> wrote:
> Suddenly, I am getting the following error when I try to look at my
> Timecard objects, via
Chris,
Thanks for the tricks. Some of them I already have in my code, that is
working since the last weekend.
I was in trouble with the class mapping, but with a great help from
ThijsTriemstra ( http://pyamf.org/wiki/ThijsTriemstra) in the irc channel
#pyamf at irc.collab.eu, I get my code
I could be completely mistaken, but can't you replace 'post.0.title'
and 'post.0.post' with 'x.title' and 'x.post', respectively?
On Jun 17, 1:50 pm, "Juan Hernandez" <[EMAIL PROTECTED]> wrote:
> Hey there
>
> I've been practicing for a while with the template system and I have some
> questions:
Hey guys,
So i am a little confused by the MEDIA_ROOT, MEDIA_URL, and
ADMIN_MEDIA_PREFIX variables.
I understand that the ADMIN_MEDIA_PREFIX provides the prefix. But so what if
it was on another url? I am assuming that the common use case is to serve
them from the same domain, which is what i
If you wanted to keep the alphabet issue out of the view, you could also
do this:
{% for letter in "ABCDEFGHIJKLMNOPQRSTUVWXYZ" %}
--Ned.
http://nedbatchelder.com
M.Ganesh wrote:
> Joel Bernstein wrote:
>
>> For an easy (but locale-dependent) way to get a list of the uppercase
>> characters
Hello,
I am currently using Django to keep track of "Timecards" submitted
towards work on different "Projects". What I would like to do, is to
track when "Modifications" are made on projects (via the project admin
page). (I'm quoting words that are represented literally in the data
model.)
Dictionaries compare equal if they contain the same data, regardless
of key order. There is no need to convert to sorted sequences unless
you need to compare the serialized output (such as in doctests).
I would guess that one of the models has additional fields added to
its __dict__, perhaps
If the part of the page being changed is complex, the easiest way to
do this is to call render_to_response as usual, but with the template
containing only a instead of a full HTML page. Handle any
escaping needed in the template.
If you only want to update the text without adding any markup,
Thanks. In this case, I'm doing a bit extra in work order to learn
Python and Django.
And, I do see how testing models such that all the fields are equal is
a waste on the basis
that Django should be testing that that functionality works.
On Wed, Jun 18, 2008 at 2:48 AM, Norman Harman <[EMAIL
You need MEDIA_ROOT because yes, you serve it from static.serve view during
development but when you launch you do not want to be using the devserver to
display your site. MEDIA_URL is essentially the same url you map through
Apache, lighthttpd, whatever you use
But you are right, you can use the
Thanks for the insight! Do you write tests to check for constraints
that are optional in definitions, for example?
address4= models.CharField(max_length=45, null=True, blank=True)
could be written as
address4= models.CharField(max_length=45)
Were is the most reasonable place to test
it does not return any values.
I did post.0.title because the dictionary is established like this:
>>> test
{0: {'post': 'My First Post', 'title': 'My First Title'}, 1: {'post': 'My
Second Post', 'title': 'My Second Title'}}
and it goes on and on
If I could iterate over it, like post.0.title,
There is a functionality which I am interested in and I wonder what is
the cleanest and most foward compatible way of doing things.
I want models to sprout a suggest() method which would work like
save() but keep the data in some structure elsewhere that do not
modify the original data. Any
Did you take a look at Django Signals? You can intercept pre-save and
post-save objects with them. You can use that to grab the data you
want and fill your ProjectModification object. I don't know if there
is a way you could tell if it was done in the admin or not though...
Generally, Django could not care less where you put most of your
static media files. There are two main exceptions, though:
1. Django needs to know the URL to the media files for its admin
application (ADMIN_MEDIA_PREFIX)
2. Django needs to know where in the server's filesystem it should put
Gene Campbell wrote:
> Thanks for the insight! Do you write tests to check for constraints
> that are optional in definitions, for example?
>
> address4= models.CharField(max_length=45, null=True, blank=True)
>
> could be written as
>
> address4= models.CharField(max_length=45)
>
>
Juan Hernandez wrote:
> it does not return any values.
>
> I did post.0.title because the dictionary is established like this:
>
> >>> test
> {0: {'post': 'My First Post', 'title': 'My First Title'}, 1: {'post':
> 'My Second Post', 'title': 'My Second Title'}}
>
> and it goes on and on
>
>
Dan wrote:
> There is a functionality which I am interested in and I wonder what is
> the cleanest and most foward compatible way of doing things.
>
> I want models to sprout a suggest() method which would work like
> save() but keep the data in some structure elsewhere that do not
> modify the
Oops, I totally missed that 'test' was a dictionary. This should work
then:
{% for key, x in posts.items %}
{{ x.title }}
{{ x.post }}
{% endfor %}
Alternately, if your keys are just going to be sequential integers,
you could just put this stuff into a list and use my first suggestion.
On
I want to use {% url %} to point into portions of the admin site(and
change the default url structure). I hacked this generally
unfullfilling but working version with old admin.
model = dict(app_label="specials", model_name="adspecial")
urlpatterns +=
On Jun 17, 1:46 am, "Gene Campbell" <[EMAIL PROTECTED]> wrote:
> Hello Djangonauts
>
> I'm a noob on both Django and Python, so this question might be easy
> for the experts out there. I am trying to do test first development
> during the development of my model code. (I have lots of experience
This isn't a bug but it's something that might need to be documented
to prevent folks from doing something that may hurt them later:
In the Django template system. There is a small caveat that you need
to
recognize when developing your own template tags.
When Django parses the Node tree it
sorry, omitted 'self' by accident.
There are a couple things going on here. One is that type-o.
The other is more of an open question as to what should be tested, and how.
I'm coming around to the this.
for each model I'll will
1) assume that clients that use the model code will test it
I have two fields in a model, a name (CharField) and a description
(TextField). I'm trying to set the default description to be something
simple like:
default="hello, I'm the description of the %s" % name
(To my surprise) this validates, but the description includes a
reference to the name
I think I may have figured out the problem.. I needed my admin_media
folder to be in my media folder
Thanks for the help :)
I appreciate both of your responses!
Molly
On Jun 17, 1:37 pm, "Norman Harman" <[EMAIL PROTECTED]> wrote:
> Molly wrote:
> > How would I call the static file in my
Hi Norman,
On Jun 17, 2008, at 3:49 PM, Norman Harman wrote:
>
> I want to use {% url %} to point into portions of the admin site(and
> change the default url structure). I hacked this generally
> unfullfilling but working version with old admin.
This is not yet supported in the
Molly: When you get through, mind if you could share the code?
Thank you,
Joseph
http://www.jjude.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to
Newbie alert.
I have a model which contains a FileField. The standard way I'd like
this field to be 'filled' is in code, rather than by user interaction
but there are circumstances where it needs to have a standard 'upload-
from-form' behaviour.
The code method generates a file in an
A quick follow up on this post. I forgot to explain how to avoid the
problem. To avoid the problem is to treat self as read only.
So to fix the ReprNode, you'd simply do the following:
class ReprNode(template.Node):
def __init__(self, obj_expression)
# Let's name this
Couldn't you do:
test = []
test.append({'title': 'My First Title', 'post': 'My First Post'});
test.append({'title': 'My Second Title', 'post': 'My Second Post'});
?
On Jun 18, 2008, at 4:11 PM, Juan Hernandez wrote:
> it does not return any values.
>
> I did post.0.title because the
79 matches
Mail list logo