Can't edit reverse relation in a many2many field in admin site

2008-12-04 Thread Nelson

Hi,

I'm fairly new to Django, so I've searched all over for an answer but
could not really find it. Maybe this is simple stuff, but anyway I
dont have enough information to judge, so I hope you guys can help
me...

I have the following many-to-many relation:

class Record(models.Model):
name = models.CharField()
tracks = models.ManyToManyField('Track')

class Track(models.Model):
name = models.CharField()

This means that a Record has multiple Tracks, and a Track can belong
to many albums (compilations).

To make things easier for the content producers, the Record admin page
shows the m2m relation in an 'include/exclude list box', since I used
filter_horizontal = ('tracks',) in the ModelAdmin of the Record.

However, the Track admin page DOES NOT show the 'reverse' of the many-
to-many relation. I mean, I want to display the 'include/exclude list
box' that shows all the Records, so the user can choose the ones that
the Track may belong to.

What do I need to do to show this 'reverse' relation in the Track form
page?

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Populating form from instance not working

2008-12-04 Thread Brandon Taylor

Hi everyone,

I'm using 1.0.2 final. I have a form for a model and am passing in an
instance of my model object to the form, but the form is not being
populated.

#views.py example

def my_view(request, id):
if request.method == 'POST':
pass
else:
model_instance = my_model.objects.get(pk=id)
model_form_instance = MyForm(instance=model_instance)
return render_to_response('my_template.html', {'model_form_instance' :
model_form_instance})


But, the form fields aren't being populated. What am I doing wrong?
form_for_instance is deprecated in 1.0, and everything I'm doing looks
correct from the docs at: 
http://docs.djangoproject.com/en/dev/topics/forms/modelforms/

Advice appreciated,
Brandon
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django is changing my html!

2008-12-04 Thread David Zhou

On Thu, Dec 4, 2008 at 10:19 PM, DragonSlayre <[EMAIL PROTECTED]> wrote:
>
> Thanks for the speedy responses... I was trying to do things *right*
> using xhtml standards, but I guess that it's more trouble than it's
> worth.

But you *weren't* doing things right, since you had the  inside
the .  Fix the markup, and it'll be fine, doctype and all.


-- 
---
David Zhou
[EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: distinct doesn't work after sorting by reverse foreign key

2008-12-04 Thread Malcolm Tredinnick


On Thu, 2008-12-04 at 20:44 -0800, ryan wrote:
> I guess what I'm imagining is that distinct() would take the current
> queryset, go from the top, and keep the first occurrence of each
> distinct object in that set (users don't care about SQL rows, that's
> why they're using django in the first place). Do you think this is NOT
> what most users would expect from a distinct() function?

I don't know what "most" users would expect and neither do you. It also
doesn't really matter. You have picked an arbitrary choice as to the
"correct" object to pick, but it is precisely that: arbitrary. And it
will no doubt not suit the requirements for some non-zero set of
situations that can validly crop up. Sure, we sometimes have to restrict
the use-cases that are easy, but we do so after all options have been
exhausted and no alternatives exist. In this case, there are
alternatives.

Also, just for fun, try actually implementing your suggestion. It's
either a really intrusive change into the way the SQL is constructed, or
it requires Python-level filtering of the queryset, which is something
we never do (again, for consistency reasons and speed).

The solution that meets all requirements is simply not to order by
multi-valued results; it's almost always a bug in the query (but not
100% always, which is why Django no longer raises an exception when you
do that). In my original response, I laid out two different ways to
ensure you only have one result per "blog" instance. In both those cases
you can specify precisely and unambiguously what you want to order by in
a fashion that only generates one result per blog id. 

Any ORM has cases where the underlying storage and filtering system
leaks up to the top level. Django is no exception. We behave as SQL
does. Doing otherwise would be confusing in a lot of cases (try to keep
separate which cases follow your intuition, which cases behave in a
fashion that follows somebody else's intuition and disagrees with yours
-- you'll rapidly get a headache or move onto something more
consistently behaved). I've explained why Django behaves the way it
does; it's quite well-founded and whether you would prefer it to behave
differently or not you can hopefully appreciate the consistency of
choice and that the behaviour is well-determined for all instances.

Best wishes,
Malcolm


--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: distinct doesn't work after sorting by reverse foreign key

2008-12-04 Thread ryan

I guess what I'm imagining is that distinct() would take the current
queryset, go from the top, and keep the first occurrence of each
distinct object in that set (users don't care about SQL rows, that's
why they're using django in the first place). Do you think this is NOT
what most users would expect from a distinct() function?

On Dec 4, 10:22 pm, ryan <[EMAIL PROTECTED]> wrote:
> There's no mind reading required. I have a queryset of Blog objects,
> not entry objects (or SQL rows for that matter). When I call distinct,
> I would expect a "distinct set of blog objects". Call it a strong
> technical point if you prefer, but I still feel this is what the
> common person would expect.
>
> On Dec 4, 10:17 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
> wrote:
>
> > On Thu, 2008-12-04 at 20:15 -0800, ryan wrote:
> > > thanks for the thorough reply! I now understand how to proceed.
>
> > > However, I'm not convinced that distinct shouldn't do this for me...
>
> > It cannot read your mind. How is distinct() meant to know which of the
> > many multiple values it should use for ordering? Should it pick one at
> > random? That will only lead to disappointment, I'm sure.
>
> > > but I understand this is a philosophical point,
>
> > No, it's a strong technical point. To pick one value, that distinguished
> > value has to be well-defined (that is, there has to be a natural,
> > unambiguous meaning of which value to pick, for all possible
> > circumstances). This isn't the case here.
>
> > Your trust is welcome (and, I'm sure, well-placed). But realise that
> > this isn't simply an arbitrary opinion. It's a technical constraint.
>
> > Regards,
> > Malcolm
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: distinct doesn't work after sorting by reverse foreign key

2008-12-04 Thread ryan

There's no mind reading required. I have a queryset of Blog objects,
not entry objects (or SQL rows for that matter). When I call distinct,
I would expect a "distinct set of blog objects". Call it a strong
technical point if you prefer, but I still feel this is what the
common person would expect.

On Dec 4, 10:17 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Thu, 2008-12-04 at 20:15 -0800, ryan wrote:
> > thanks for the thorough reply! I now understand how to proceed.
>
> > However, I'm not convinced that distinct shouldn't do this for me...
>
> It cannot read your mind. How is distinct() meant to know which of the
> many multiple values it should use for ordering? Should it pick one at
> random? That will only lead to disappointment, I'm sure.
>
> > but I understand this is a philosophical point,
>
> No, it's a strong technical point. To pick one value, that distinguished
> value has to be well-defined (that is, there has to be a natural,
> unambiguous meaning of which value to pick, for all possible
> circumstances). This isn't the case here.
>
> Your trust is welcome (and, I'm sure, well-placed). But realise that
> this isn't simply an arbitrary opinion. It's a technical constraint.
>
> Regards,
> Malcolm
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: distinct doesn't work after sorting by reverse foreign key

2008-12-04 Thread ryan

thanks for the thorough reply! I now understand how to proceed.

However, I'm not convinced that distinct shouldn't do this for me...
but I understand this is a philosophical point, and I put my trust in
the django developers to get it right (just like I do with the
american government... )

On Dec 4, 9:24 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Thu, 2008-12-04 at 19:09 -0800, ryan wrote:
> > For instance, I have two objects:
> > 1) Blog
> > 2) Entry with a ForeignKey to Blog, and a Date field titled DateAdded
>
> > Now, I want to list all my blogs, ordering by the most recent added
> > entry.
>
> > I tried:
> > blog.objects.all().sort_by('entry__dateAdded').distinct()
>
> > But the result was that is a given blog had more than 1 entry, then it
> > shows up in the resulting queryset more than once. It appears distinct
> > () is doing nothing in this case.
>
> The distinct() call is working correctly (you're right that it is
> effectively doing nothing, wrong to say it "doesn't work"). The problem
> is that you are ordering by something that has multiple values and each
> value contributes one output row. There is nothing in your ordering
> statement to say that the database should only use the *maximum* value
> of dateAdded for each entry. The only reasonable way to interpret
> ordering by multi-valued fields is to treat each one as generating a
> different output row, since otherwise we might as well just pick one at
> random (the SQL specification agrees with that interpretation by the way
> -- which is why Django does it. Only MySQL allows effective ordering by
> columns not in the output list in this case and it's very non-standard).
>
> Refer to the massive callout box in the documentation for distinct() for
> a more SQL-specific 
> explanation:http://docs.djangoproject.com/en/dev/ref/models/querysets/#distinct
>
> You could achieve the effect you're after by using extra(select=...,
> order_by=...) to select the maximum date added value as an extra
> column.
>
> Alternatively (and this would require some fairly deep poking into Query
> internals, so probably not recommended) you could add some extra stuff
> to the where-clause to say "where dateAdded = (Select max(dateAdded)
> from ...)". Possible some extra(where="") usage could get you most
> of the way there on that one.
>
> Regards,
> Malcolm
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: distinct doesn't work after sorting by reverse foreign key

2008-12-04 Thread Malcolm Tredinnick


On Thu, 2008-12-04 at 20:15 -0800, ryan wrote:
> thanks for the thorough reply! I now understand how to proceed.
> 
> However, I'm not convinced that distinct shouldn't do this for me...

It cannot read your mind. How is distinct() meant to know which of the
many multiple values it should use for ordering? Should it pick one at
random? That will only lead to disappointment, I'm sure.

> but I understand this is a philosophical point,

No, it's a strong technical point. To pick one value, that distinguished
value has to be well-defined (that is, there has to be a natural,
unambiguous meaning of which value to pick, for all possible
circumstances). This isn't the case here.

Your trust is welcome (and, I'm sure, well-placed). But realise that
this isn't simply an arbitrary opinion. It's a technical constraint.

Regards,
Malcolm



--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: distinct doesn't work after sorting by reverse foreign key

2008-12-04 Thread ryan

thanks for the thorough reply! I now understand how to proceed.

However, I'm not convinced that distinct shouldn't do this for me...
but I understand this is a philosophical point, and I put my trust in
the django developers to get it right (just like I do with the
american government... )

On Dec 4, 9:24 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Thu, 2008-12-04 at 19:09 -0800, ryan wrote:
> > For instance, I have two objects:
> > 1) Blog
> > 2) Entry with a ForeignKey to Blog, and a Date field titled DateAdded
>
> > Now, I want to list all my blogs, ordering by the most recent added
> > entry.
>
> > I tried:
> > blog.objects.all().sort_by('entry__dateAdded').distinct()
>
> > But the result was that is a given blog had more than 1 entry, then it
> > shows up in the resulting queryset more than once. It appears distinct
> > () is doing nothing in this case.
>
> The distinct() call is working correctly (you're right that it is
> effectively doing nothing, wrong to say it "doesn't work"). The problem
> is that you are ordering by something that has multiple values and each
> value contributes one output row. There is nothing in your ordering
> statement to say that the database should only use the *maximum* value
> of dateAdded for each entry. The only reasonable way to interpret
> ordering by multi-valued fields is to treat each one as generating a
> different output row, since otherwise we might as well just pick one at
> random (the SQL specification agrees with that interpretation by the way
> -- which is why Django does it. Only MySQL allows effective ordering by
> columns not in the output list in this case and it's very non-standard).
>
> Refer to the massive callout box in the documentation for distinct() for
> a more SQL-specific 
> explanation:http://docs.djangoproject.com/en/dev/ref/models/querysets/#distinct
>
> You could achieve the effect you're after by using extra(select=...,
> order_by=...) to select the maximum date added value as an extra
> column.
>
> Alternatively (and this would require some fairly deep poking into Query
> internals, so probably not recommended) you could add some extra stuff
> to the where-clause to say "where dateAdded = (Select max(dateAdded)
> from ...)". Possible some extra(where="") usage could get you most
> of the way there on that one.
>
> Regards,
> Malcolm
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Forms not working on Opera if form data is bigger than certain size

2008-12-04 Thread Evren Esat Ozkan

Hi,

When I'm using Opera, if any form field's content is bigger than
certain size (~20kb), all post data gone missing on serverside. I'm
faced with this problem when trying to upload images but same problem
raising if text fields has enough data too. Problem araising on admin
site and also on hand made views.

Opera is my primary browser for years and I was never encountered
anything like that on any site. Even my previous sites which running
on Django 0.97 are working properly with Opera.  So, this is specific
to Opera & Django 1.0 (or 1.1)  combination.

Is this a known problem or a bug in Opera or Django? Searched on
google (and here, and code.dj..) but found nothing.

Note: I'm using latest snapshots of Opera on Linux, but same things
apply for stable version of Opera for Windows too.


Thanks in advance,
Evren
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Why run two web-servers on the same host?

2008-12-04 Thread Kenneth Gonsalves

On Thursday 04 Dec 2008 11:27:34 pm walterbyrd wrote:
> > Because django runs as a long-running process, and does not rebuild
> > the whole world on each and any request (which is what PHP do).
>
> Seems to me that would make Python run faster. I suppose that must
> take more system resources. Which, I further suppose, is why so many
> low-cost web-hosters don't do Python?

low cost == shoddy service, it requires a wee bit of effort to host python 
unlike php where it runs out of the box.

-- 
regards
KG
http://lawgon.livejournal.com

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: distinct doesn't work after sorting by reverse foreign key

2008-12-04 Thread Malcolm Tredinnick


On Thu, 2008-12-04 at 19:09 -0800, ryan wrote:
> For instance, I have two objects:
> 1) Blog
> 2) Entry with a ForeignKey to Blog, and a Date field titled DateAdded
> 
> Now, I want to list all my blogs, ordering by the most recent added
> entry.
> 
> I tried:
> blog.objects.all().sort_by('entry__dateAdded').distinct()
> 
> But the result was that is a given blog had more than 1 entry, then it
> shows up in the resulting queryset more than once. It appears distinct
> () is doing nothing in this case.

The distinct() call is working correctly (you're right that it is
effectively doing nothing, wrong to say it "doesn't work"). The problem
is that you are ordering by something that has multiple values and each
value contributes one output row. There is nothing in your ordering
statement to say that the database should only use the *maximum* value
of dateAdded for each entry. The only reasonable way to interpret
ordering by multi-valued fields is to treat each one as generating a
different output row, since otherwise we might as well just pick one at
random (the SQL specification agrees with that interpretation by the way
-- which is why Django does it. Only MySQL allows effective ordering by
columns not in the output list in this case and it's very non-standard).

Refer to the massive callout box in the documentation for distinct() for
a more SQL-specific explanation:
http://docs.djangoproject.com/en/dev/ref/models/querysets/#distinct

You could achieve the effect you're after by using extra(select=...,
order_by=...) to select the maximum date added value as an extra
column. 

Alternatively (and this would require some fairly deep poking into Query
internals, so probably not recommended) you could add some extra stuff
to the where-clause to say "where dateAdded = (Select max(dateAdded)
from ...)". Possible some extra(where="") usage could get you most
of the way there on that one.

Regards,
Malcolm



--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django is changing my html!

2008-12-04 Thread DragonSlayre

yes, this fixed the problem. I should change my original title to
"Firefox is changing my html!"

Thanks for the speedy responses... I was trying to do things *right*
using xhtml standards, but I guess that it's more trouble than it's
worth.

On Dec 5, 4:10 pm, "Dj Gilcrease" <[EMAIL PROTECTED]> wrote:
> Actually it looks like he is just getting extra links, which seems to
> remind me of a Safari issue and the Doc type that is set. If I
> remember correctly I ran into an issue similar to this where Safari
> was attempting to fix my HTML to fit my specified Doc-Type. So if I
> had to guess I would say that what ever Doc-Type you are setting does
> not allow  to be a child of the  tag. Try moving your link
> inside the  and see if it still produced unexpected results.
>
> Dj Gilcrease
> OpenRPG Developer
> ~~http://www.openrpg.com
>
> On Thu, Dec 4, 2008 at 7:58 PM, Malcolm Tredinnick
>
> <[EMAIL PROTECTED]> wrote:
>
> > On Thu, 2008-12-04 at 18:49 -0800, DragonSlayre wrote:
> >> Hi,
>
> >> for some reason my hyperlink is not coming out as I expect it to.
> >> Here is my code in my template:
>
> >> 
> >>  {% for category in categories %}
> >>    
> >>        {{ category.name }}
> >>    
> >>  {% endfor %}
> >> 
>
> >> The outcome is the following html code:
>
> >> 
> >>    
> >>   
> >>   Books
> >>   
> >>    
> >> 
>
> >> I've checked and I only have one 'little' category - the Books
> >> category.
> >> I'm expecting the html to appear as the following:
>
> >> 
> >>   
> >>     Books
> >>   
> >> 
>
> >> Does anybody know what might be going on?
>
> > Doesn't seem to be any Django problem here, but you'll want to look at
> > carefully at your view function, or possible your model definition.
>
> > It seems that category.name is not returning what you think it should.
> > Since that is the only thing your template is inserting insider the "li"
> > element, and since the output shows a URL in there, that is what
> > category.name must be returning.
>
> > You haven't shown us what "categories" contains or what the "category"
> > object is, so I can only go on what you've pasted. But the thing between
> > the  and  tags is indicative of the problem. You are actually
> > seeing exactly the right template output for one item in the list (one
> > link outside the "li" element and something inside the "li" element),
> > but the inserted content -- the non-template stuff -- is not what
> > expected. Since that's the portion that is generated by your own code
> > and data, that's the place to start looking.
>
> > Regards,
> > Malcolm
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django is changing my html!

2008-12-04 Thread DragonSlayre


If the problem is inside my view, shouldn't the output generated look
more like this though:


  

  
  
  Books
  
  

  


What i don't understand, is how 1) ' ' is showing up, and 2) why it doesn't have the 
tags inside.
For 1, I can understand how the problem might be in my view, but for 2
- I just don't get why the html would be rendered in the way that it
is?

If I take out the anchor tag in my template, and display the dynamic
content as follows:

 {% for category in categories %}
   
   {% url category-listing category.name|lower %}
   
   
   {{ category.name }}
   
 {% endfor %}


I get the following html output:

 /listings/category/books/ 
 Books 


So I'm pretty sure that it's not the dynamic content that's causing
the 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 email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



distinct doesn't work after sorting by reverse foreign key

2008-12-04 Thread ryan

For instance, I have two objects:
1) Blog
2) Entry with a ForeignKey to Blog, and a Date field titled DateAdded

Now, I want to list all my blogs, ordering by the most recent added
entry.

I tried:
blog.objects.all().sort_by('entry__dateAdded').distinct()

But the result was that is a given blog had more than 1 entry, then it
shows up in the resulting queryset more than once. It appears distinct
() is doing nothing in this case.

are more knowledgeable minds willing to share their insight on this
problem?

Thanks!

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django is changing my html!

2008-12-04 Thread Dj Gilcrease

Actually it looks like he is just getting extra links, which seems to
remind me of a Safari issue and the Doc type that is set. If I
remember correctly I ran into an issue similar to this where Safari
was attempting to fix my HTML to fit my specified Doc-Type. So if I
had to guess I would say that what ever Doc-Type you are setting does
not allow  to be a child of the  tag. Try moving your link
inside the  and see if it still produced unexpected results.

Dj Gilcrease
OpenRPG Developer
~~http://www.openrpg.com



On Thu, Dec 4, 2008 at 7:58 PM, Malcolm Tredinnick
<[EMAIL PROTECTED]> wrote:
>
>
> On Thu, 2008-12-04 at 18:49 -0800, DragonSlayre wrote:
>> Hi,
>>
>> for some reason my hyperlink is not coming out as I expect it to.
>> Here is my code in my template:
>>
>> 
>>  {% for category in categories %}
>>
>>{{ category.name }}
>>
>>  {% endfor %}
>> 
>>
>> The outcome is the following html code:
>>
>> 
>>
>>   
>>   Books
>>   
>>
>> 
>>
>> I've checked and I only have one 'little' category - the Books
>> category.
>> I'm expecting the html to appear as the following:
>>
>> 
>>   
>> Books
>>   
>> 
>>
>> Does anybody know what might be going on?
>
> Doesn't seem to be any Django problem here, but you'll want to look at
> carefully at your view function, or possible your model definition.
>
> It seems that category.name is not returning what you think it should.
> Since that is the only thing your template is inserting insider the "li"
> element, and since the output shows a URL in there, that is what
> category.name must be returning.
>
> You haven't shown us what "categories" contains or what the "category"
> object is, so I can only go on what you've pasted. But the thing between
> the  and  tags is indicative of the problem. You are actually
> seeing exactly the right template output for one item in the list (one
> link outside the "li" element and something inside the "li" element),
> but the inserted content -- the non-template stuff -- is not what
> expected. Since that's the portion that is generated by your own code
> and data, that's the place to start looking.
>
> Regards,
> Malcolm
>
>
> >
>

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django is changing my html!

2008-12-04 Thread Malcolm Tredinnick


On Thu, 2008-12-04 at 18:49 -0800, DragonSlayre wrote:
> Hi,
> 
> for some reason my hyperlink is not coming out as I expect it to.
> Here is my code in my template:
> 
> 
>  {% for category in categories %}
>
>{{ category.name }}
>
>  {% endfor %}
> 
> 
> The outcome is the following html code:
> 
> 
>
>   
>   Books
>   
>
> 
> 
> I've checked and I only have one 'little' category - the Books
> category.
> I'm expecting the html to appear as the following:
> 
> 
>   
> Books
>   
> 
> 
> Does anybody know what might be going on?

Doesn't seem to be any Django problem here, but you'll want to look at
carefully at your view function, or possible your model definition.

It seems that category.name is not returning what you think it should.
Since that is the only thing your template is inserting insider the "li"
element, and since the output shows a URL in there, that is what
category.name must be returning.

You haven't shown us what "categories" contains or what the "category"
object is, so I can only go on what you've pasted. But the thing between
the  and  tags is indicative of the problem. You are actually
seeing exactly the right template output for one item in the list (one
link outside the "li" element and something inside the "li" element),
but the inserted content -- the non-template stuff -- is not what
expected. Since that's the portion that is generated by your own code
and data, that's the place to start looking.

Regards,
Malcolm


--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django is changing my html!

2008-12-04 Thread DragonSlayre

Hi,

for some reason my hyperlink is not coming out as I expect it to.
Here is my code in my template:


 {% for category in categories %}
   
   {{ category.name }}
   
 {% endfor %}


The outcome is the following html code:


   
  
  Books
  
   


I've checked and I only have one 'little' category - the Books
category.
I'm expecting the html to appear as the following:


  
Books
  


Does anybody know what might be going on?


Thanks a lot for your help.
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Strange timeout issue

2008-12-04 Thread Malcolm Tredinnick


On Thu, 2008-12-04 at 17:30 -0800, Julien Phalip wrote:
> Hi,
> 
> I have a pretty big database of organisations, countries and news
> entries. It all works fine except when I edit one of the organisations
> in the admin. The edit page loads fine, but when I click 'Save' it
> takes for ever before eventually timing out. The error my clients get
> on their system (IE7) is as follows:
> 
> *  Error Code 1460: Timeout
> * Background: The gateway could not receive a timely response from
> the website you are trying to access, a DNS server, or another gateway
> server. This might indicate that the network is congested or that the
> website is experiencing technical difficulties.
> * Date: 5/12/2008 0:12:36 AM
> * Source: Firewall
> 
> It works when editing any other organisation. I can't find anything
> suspicious in the data. It's pretty simple stuff, like address, phone
> number, etc.
> 
> I'm not sure where to start to debug this. Would you have any
> suggestion?

Since it sounds like you have a repeatable test case, you can run an
instrumented version of Django, repeat the situation and watch what is
going on. For example, turn on query logging on the database server and
see what query is being run (the query will probably finish, even if the
client is not going to receive the response).

Or put some prints into the affected view -- say "print >> sys.stderr,
time.time()" and maybe some line number information -- to see which
lines are executed when.

Essentially, you just keep adding debugging prints to track down which
line of code is taking a long time and then start investigating variable
values around that point. You might need to add prints inside Django to
get down the precise point, but since you know how to repeat the
problem, this is just a matter of persistence, not luck.

Regards,
Malcolm
=


--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: exclude() method bug

2008-12-04 Thread Malcolm Tredinnick


On Thu, 2008-12-04 at 04:58 -0800, Karantir wrote:
> Hi,
> 
> I've just found strange django behaviour and want to understand is it
> a bug or an inconvenient feature. I have two models -- Place and Item
> bound through the intermediate table ItemPlace (that stores additional
> field -- quantity). Physically it describes some quantity of items
> lying on the some places.
> 
> Then i've tried to fetch spare places with the following request:
> Place.objects.filter(itemplace__quantity = None) and it works
> perfectly. After that i've run Place.objects.exclude
> (itemplace__quantity = None) to fetch occupied places but this request
> anyway returns an empty list.
> 
> Surely i can use Place.objects.filter(itemplace__quantity__gte = 0)
> and it works but why the previous request fails? Any ideas?

The answer to your question is going to depend on specifics of your
models (which you haven't supplied).

However, the exclude() and the second filter() are asking for different
things. The exclude() will remove any Places that have a NULL itemplace
value or a NULL itemplace.quantity value. The second filter() will
include anything where itemplace.quantity has a positive value. Since 0
is not the same as NULL, the two queries will treat zero values
differently (although I would have expected the first exclude to return
a superset of the second filter).

There is one class of known bugs with exclude() and many-to-many that
you may or may not be hitting here. I've been spending quite a lot of
time fixing (working on fixing, at least) those lately. You might be
getting bitten by that or you might not. If you could post a very short
sample model that demonstrates the problem you are seeing, it would
help.

Regards,
Malcolm

> > 
> 


--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Character encoding... latin1 to utf8?

2008-12-04 Thread Malcolm Tredinnick


On Thu, 2008-12-04 at 16:34 -0800, Rob Hudson wrote:
> I'm migrating a site to Django.  The old site was PHP/MySQL with MySQL
> having a default encoding of latin1.  It seems like there are also
> Windows 1252 encodings but I'm not sure.
> 
> I have the old database and the new Django UTF8 one side by side and
> have a migration script that uses raw MySQLdb to connect to the old,
> and Django's ORM to connect to the new.  Is there anything I can do to
> ensure the data going into the new is UTF8?

Since this is presumably a once-off conversion operation, I'd make sure
that the data coming from the source database was converted into Python
unicode objects before passing it to Django. That way, any errors will
be caught.

Now you might well be able to have this happen automatically using the
"unicode" option to MySQLdb -- it knows how to convert between various
server-side encodings and Python unicode. So look at that parameter to
the connect() call. It's fairly well done in MySQLdb (it and PostgreSQL
were almost trivial to make work when we added Unicode support to
Django).

Alternatively, if you're getting bytestrings backs, run them through a
decode() call:

data = original_data.decode('cp1252')

Since cp1252 is a superset of latin1 (iso-8859-1), you can specify the
same encoding for both. Valid latin1 won't contain any data in the extra
codepoints used by cp1252. Once your data is in Unicode, passing it to
Django's ORM will Just Work(tm). However, I'd definitely call this Plan
B and see if passing the unicode=True option to MySQLdb.connect() works,
since that might just be a one-line solution.

> To further complicate things, once the data is in the new UTF8
> database, I have a script that exports to a CSV file for a client to
> use a subset of the data.  And right now this is all sorts of fail for
> me.  I tried using the Django snippet here: 
> http://www.djangosnippets.org/snippets/993/
> but am essentially getting what the first commenter says unless I
> import as Windows 1252 — then the boxes turn into quotes and
> apostrophes that look right.

I can't help there. It sounds like Excel on Windows is ignoring the fact
that the data is UTF-16 and treating it as cp1252, which is, of course,
totally broken. I don't completely understand that fragment, but the
bits that are confusing to me (it writes to both a writer and a stream,
for example) are probably because I haven't opened up the csv writer
class to see what should be subclassed.

Just for laughs, though, try running "file" on the csv file you generate
and make sure it, at least, detects that it is a UTF-16 file.

> Character encodings are a big confusion for me.

Working with things through Django should be relatively straightforward.
Django will give you Unicode strings (type "unicode"). You call the
encode() method to convert it to whichever encoding you like (unicode
objects on their own can't be written out -- you need to pick an
encoding). If your target requires UTF-16, you need to start off with a
byte order mark (BOM) to indicate whether the two-byte output of each
character is in little-endian or big-endian order. If you
call .encode('utf-16'), Python writes out the BOM for you (the '\xff
\xfe' sequence at the start).


Regards,
Malcolm



--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Strange timeout issue

2008-12-04 Thread Julien Phalip

Hi,

I have a pretty big database of organisations, countries and news
entries. It all works fine except when I edit one of the organisations
in the admin. The edit page loads fine, but when I click 'Save' it
takes for ever before eventually timing out. The error my clients get
on their system (IE7) is as follows:

*  Error Code 1460: Timeout
* Background: The gateway could not receive a timely response from
the website you are trying to access, a DNS server, or another gateway
server. This might indicate that the network is congested or that the
website is experiencing technical difficulties.
* Date: 5/12/2008 0:12:36 AM
* Source: Firewall

It works when editing any other organisation. I can't find anything
suspicious in the data. It's pretty simple stuff, like address, phone
number, etc.

I'm not sure where to start to debug this. Would you have any
suggestion?

Thanks a lot,

Julien
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Character encoding... latin1 to utf8?

2008-12-04 Thread Rob Hudson

I'm migrating a site to Django.  The old site was PHP/MySQL with MySQL
having a default encoding of latin1.  It seems like there are also
Windows 1252 encodings but I'm not sure.

I have the old database and the new Django UTF8 one side by side and
have a migration script that uses raw MySQLdb to connect to the old,
and Django's ORM to connect to the new.  Is there anything I can do to
ensure the data going into the new is UTF8?

To further complicate things, once the data is in the new UTF8
database, I have a script that exports to a CSV file for a client to
use a subset of the data.  And right now this is all sorts of fail for
me.  I tried using the Django snippet here: 
http://www.djangosnippets.org/snippets/993/
but am essentially getting what the first commenter says unless I
import as Windows 1252 — then the boxes turn into quotes and
apostrophes that look right.

Character encodings are a big confusion for me.

Thanks for any help,
Rob
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: modelformset_factory error: (Hidden field id) with this None already exists.

2008-12-04 Thread Karen Tracey
On Thu, Dec 4, 2008 at 2:12 AM, cyberjack <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
>  I haven't been able to solve this problem, but have made some
> progress:
>
> It's definitely *not* bug 9039. I've download the tests from that
> ticket and confirmed the fix was included in 1.0.2 final.
>
> The problem is related to using querysets with formset_factory.  Ie,
> if I include a queryset filter, then I see this error. If I don't
> include a queryset, and thus edit all status reports, I don't see the
> error.
>
> Lastly, I've simplified my code producing the problem:
>
> my model:
>
> class StatusReport(models.Model):
>   vehicle   = models.IntegerField()
>   report_date   = models.DateField()
>   status= models.CharField(max_length=10)
>
> and my view:
>
> def detail(request, vehicle_id):
>limited_reports = StatusReport.objects.filter(vehicle=vehicle_id)
>
>StatusFormSet = modelformset_factory(StatusReport, extra=0)
>if request.method == 'POST':
>formset = StatusFormSet(request.POST)
> if formset.is_valid():
>formset.save()
> else:
># with error
>#formset = StatusFormSet(queryset=limited_reports)
># without error
>formset = StatusFormSet()
>return render_to_response('manage_articles.html',
>  {'formset': formset,
>   'vehicle_id': vehicle_id})
>
> Is this a bug in Django? If so, what should I include in the bug
> report?
>

I think the bug is that you need to pass the queryset parameter when you are
dealing with a POST (if you've specified it on the GET) so that the posted
data can be matched up to the existing model instances.  Otherwise I think
it will be trying to validate and save as all new instances, and I think the
error message is saying you wind up with duplicate primary key ids when you
try that (though I will say that error message might could use some
improvement).

Karen

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: DateTimeField and input_formats

2008-12-04 Thread ReneMarxis

fixed ... i had to pass in a tupel ... not a string.
and as far as i saw the field does not format the data automaticly.
you have to pass it in as a formated string.
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: open source project management app that uses django?

2008-12-04 Thread Margie

Ok - forget it - I figured it out! I found the django pages on how to
serve static files and that showed me what I need to know and it looks
great now.

On Dec 4, 12:54 pm, Margie <[EMAIL PROTECTED]> wrote:
> Ok - this is very useful!  It is just great to see a "real" app that
> does something similar to what I want.  The code looks very nice and
> seems simple to understand.  I have downloaded it and integrated into
> my little play django application, but I have one problem.  In the
> README it says:
>
> 6. Inside your MEDIA_ROOT folder, create a new folder called
> 'helpdesk' and
>    copy the contents of helpdesk/htdocs/ into it. Alternatively,
> create a
>    symlink:
>     ln -s /path/to/helpdesk/htdocs /path/to/media/helpdesk
>
>    This application assumes all helpdesk media will be accessible at
>    http://MEDIA_PATH/helpdesk/
>
> I did the ln, but I don't understand how to make the contantes of
> media/helpdes accessible athttp://MEDIA_PATH/helpdesk/
>
> What do I do to make them "accessible"?
>
> Margie
>
> On Dec 3, 11:27 pm, "Hanny Wibisono" <[EMAIL PROTECTED]> wrote:
>
>
>
> >http://www.jutdahelpdesk.com/
>
> > -Original Message-
> > From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED]
>
> > On Behalf Of Margie
>
> > Hi everyone,
>
> > I would like to create a django project managment web app to be used
> > internally in my company.  I am a software developer, but have little
> > experience with web apps other than my recent work going through the
> > sams django tutorial book.
>
> > I'm wondering if anyone knows of any open source/free django web app
> > that I might be able to use to get started on this project.  Let me
> > describe the usage model to give you an idea of what I'm aiming for.
>
> > At a very high level, the usage model for this web app is that a
> > "manager" assigns tasks to "employees" on a weekly basis. Associated
> > with each task is a set of measurements that must be performed by the
> > employee as he/she does the task.  The measurements vary based on the
> > task, and somemes the measurement is reported with a comment string,
> > sometimes a number, or sometimes a check mark in one of 'n' radio
> > boxes.   As the employees complete the tasks, they fill in the
> > measurements.  At the end of the week, the manager can look at each
> > task and review the resulting measurements, and based on that data,
> > decide the next weeks'  tasks.
>
> > Unlike a project mangament tool like MS Project, which helps you
> > schedule and gannt chart the schedule, this is really a tool to for
> > enhancing project communication.  It is intended to allow the manager
> > to easily communicate tasks to the employees, get the results back,
> > and then make decisions about what the next set of tasks sould be.
> > All without having to spend a lot of time emailing and talking to
> > people.  In the environement where it will be used, the manager is
> > getting results back from maybe 100 different employees, each of which
> > have a few tasks to do.  The data is not complex, but there is just
> > too much of it to manage without a tool.  Currently folks are using
> > wiki and excel, but in my opninion this is not really automated
> > enough.
>
> > My thought is that a django web client could provide a very simple and
> > easy to use interface, and could also be extended to get all sorts of
> > nice long term trend information.  For exmaple, t would be interesting
> > to know if a project being run at site A executes task 'foo' more
> > frequently or for longer periods of time than a project being run at
> > site B.  As data is across multiple similar projects, it seems that it
> > could be mined for lots of interesting info to help improve the
> > productivity of future projects.
>
> > Ok - so hopefully you get the idea.  Now for my questions:
>
> > * Does anyone know of existing web apps (django or otherwise) like
> > that already exists?
>
> > * Does this sound like something that would be good to do in Django?
>
> > * Does anyone know of any free/open source software (django based)
> > that I could use as a starting point?  Not being a web developer, I
> > know that if I do this from scratch, I will probably not do a great
> > job.  No doubt there are a ton of intracacies to window layout, the
> > structure of the models, the html templates, and other things I
> > haven't even thought of.  So I'm thinking it would be great to
> > bootstrap from some existing code, even if it doesn't do quite what I
> > want.  I would be happy to contribute my own work back to the open
> > source community.
>
> > Thanks for any ideas!
>
> > Margie- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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, s

Re: More User/Profile troubles

2008-12-04 Thread [EMAIL PROTECTED]

Ah that did it. The other thing I was doing wrong, the reason all the
different things i was trying didnt get me anywhere- I hadnt run
syncdb when I should of. That stupid mistake wasted a lot of time..
Its taken a while but it appears to be working perfectly now! Thanks
for your help.
Phil

On 4 Dec, 18:17, Brian Neal <[EMAIL PROTECTED]> wrote:
> On Dec 4, 11:08 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:> I apologise for spamming everyone, here i stuck it up at dpaste with
> > the comments which makes it a bit clearer-http://dpaste.com/96128/
>
> You are almost there. You are assigning a form instance to your custom
> profile's user foreign key. That is not what you want. You want to
> assign the appropriate user instance to that foreign key field.
>
> Instead of:
> extraformedit.user = userformInstance
>
> Try this:
> extraformedit.user = request.user
> or
> extraformedit.user = userforminstance.user
>
> Another suggestion: you probably need to check to see if both forms
> are valid before going ahead with the saving.
>
> if form.is_valid() and extraform.is_valid():
>
> I recently did something similiar, I found my code and dpasted it. In
> my case I am showing the view for a user to edit her existing profile.
> I hope it helps:http://dpaste.com/96150/
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



help with file uploads

2008-12-04 Thread Alan
Hi there!
Although I have some experience in Python and Plone and have done Django
tutorial, I am still not getting how to do a simple task I proposed myself:
build a submitting page for a zip file.

So I am looking at
http://docs.djangoproject.com/en/dev/topics/http/file-uploads/

It seems to have all I need, but I still don't know well how to connect the
dots. So, it would be really great if I could put my hands in a example or,
better, tutorial, of how to build such a page for submitting a file.

The difficult I find is that when I was building webpages I used to think
first the html code and then the rest, but with Django, I feel I have to
think first models, but then I still lack how to link with view.

Many thanks in advance.
Alan

-- 
Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate
Department of Biochemistry, University of Cambridge.
80 Tennis Court Road, Cambridge CB2 1GA, UK.
>>http://www.bio.cam.ac.uk/~awd28<<

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



best practices for SOAP client in Django

2008-12-04 Thread wynfred

Hi, all. I am new to Django/Python. For one project, I need to be
posting data to a .NET SOAP web service. I've read about the various
Python SOAP libraries, mainly SOAPpy (http://diveintopython.org/
soap_web_services/). What is not clear yet is how best to use a tool
like SOAPpy within the Django framework.

Our application should have the following routine:
1) Our django app would pull data from our database
2) We'd take that data and format the SOAP XML message
3) We'd post the SOAP XML message to the .NET SOAP web service
4) When the response verifies a successful post to the SOAP web
service, we'd record that transaction as successful in our database

Anyway, I'm learning how to do all these steps as isolated pieces of
code, but what's not clear is how best to achieve this task flow
within our Django application.

This whole routine will need to run as a cron job...and I suppose that
might make some question whether Django is the right tool for this
task. I'd prefer to standardize using one framework/language though.

Any pointers/suggestions would be most appreciated. Thank you in
advance.

Stephen



--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Python 3.0 released - what's the status of Django vs. 3.0?

2008-12-04 Thread ohmi

Of course - sorry - I tried to look at the tickets and saw nothing.

On Dec 4, 1:14 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Thu, Dec 4, 2008 at 1:37 PM, ohmi <[EMAIL PROTECTED]> wrote:
> > As the subject says - will Django compile and run on Python 3.0?
>
> No, nor is it expected to for at least a year or two, something
> entirely consistent with the general plan for pretty much all Python
> software to migrate.
>
> If you're genuinely interested in more, **please** search the archives
> of this list for the many times this question has been asked and
> answered before.
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using managers for related object access

2008-12-04 Thread bruno desthuilliers



On 4 déc, 21:39, "Luke Graybill" <[EMAIL PROTECTED]> wrote:
> I am attempting to use a custom manager for related object access, as
> documented 
> here,
> but it does not appear to be working properly. Upon accessing the reverse
> relationship, I am getting an unfiltered queryset result. Using this trimmed
> down code ,

invert lines 17 and 18, ie make 'referenced' the first declared object
manager and 'objects' the second.

And yes, the result you get is not what one would expect reading the
mentioned doc.

The fact is that is that use_for_related_fields only impacts the other
side of the relationship, ie Shift.worked_by (but since you didn't
define a  Custom manager for Employee...). In this side of a OneToMany
relationship, it's the default manager that is used, and the default
manager is the first declared one.

HTH

PS : As a side note: the pattern I personnally use is :

class ShiftManager(models.Manager):
use_for_related_fields = True
def referenced(self):
return self.filter(is_dereferenced=False)

e = Employee.objects.get(id=1)
e.shifts.referenced()

This avoid having to write too many managers


--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Invalid block tag: render_comment_form (repost)

2008-12-04 Thread tofergus

On 04.12-20:22, Florian Lindner wrote:
[ ... ]
> I use the comments framework from the newest Django SVN checkout.

sorry to not be of more help (i've never used the comments framework)
but i can only suggest that you select a release version and not the
'newest' (i'm assuming that means trunk).

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: open source project management app that uses django?

2008-12-04 Thread Margie

Ok - this is very useful!  It is just great to see a "real" app that
does something similar to what I want.  The code looks very nice and
seems simple to understand.  I have downloaded it and integrated into
my little play django application, but I have one problem.  In the
README it says:


6. Inside your MEDIA_ROOT folder, create a new folder called
'helpdesk' and
   copy the contents of helpdesk/htdocs/ into it. Alternatively,
create a
   symlink:
ln -s /path/to/helpdesk/htdocs /path/to/media/helpdesk

   This application assumes all helpdesk media will be accessible at
   http://MEDIA_PATH/helpdesk/

I did the ln, but I don't understand how to make the contantes of
media/helpdes accessible at http://MEDIA_PATH/helpdesk/

What do I do to make them "accessible"?

Margie


On Dec 3, 11:27 pm, "Hanny Wibisono" <[EMAIL PROTECTED]> wrote:
> http://www.jutdahelpdesk.com/
>
>
>
> -Original Message-
> From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED]
>
> On Behalf Of Margie
>
> Hi everyone,
>
> I would like to create a django project managment web app to be used
> internally in my company.  I am a software developer, but have little
> experience with web apps other than my recent work going through the
> sams django tutorial book.
>
> I'm wondering if anyone knows of any open source/free django web app
> that I might be able to use to get started on this project.  Let me
> describe the usage model to give you an idea of what I'm aiming for.
>
> At a very high level, the usage model for this web app is that a
> "manager" assigns tasks to "employees" on a weekly basis. Associated
> with each task is a set of measurements that must be performed by the
> employee as he/she does the task.  The measurements vary based on the
> task, and somemes the measurement is reported with a comment string,
> sometimes a number, or sometimes a check mark in one of 'n' radio
> boxes.   As the employees complete the tasks, they fill in the
> measurements.  At the end of the week, the manager can look at each
> task and review the resulting measurements, and based on that data,
> decide the next weeks'  tasks.
>
> Unlike a project mangament tool like MS Project, which helps you
> schedule and gannt chart the schedule, this is really a tool to for
> enhancing project communication.  It is intended to allow the manager
> to easily communicate tasks to the employees, get the results back,
> and then make decisions about what the next set of tasks sould be.
> All without having to spend a lot of time emailing and talking to
> people.  In the environement where it will be used, the manager is
> getting results back from maybe 100 different employees, each of which
> have a few tasks to do.  The data is not complex, but there is just
> too much of it to manage without a tool.  Currently folks are using
> wiki and excel, but in my opninion this is not really automated
> enough.
>
> My thought is that a django web client could provide a very simple and
> easy to use interface, and could also be extended to get all sorts of
> nice long term trend information.  For exmaple, t would be interesting
> to know if a project being run at site A executes task 'foo' more
> frequently or for longer periods of time than a project being run at
> site B.  As data is across multiple similar projects, it seems that it
> could be mined for lots of interesting info to help improve the
> productivity of future projects.
>
> Ok - so hopefully you get the idea.  Now for my questions:
>
> * Does anyone know of existing web apps (django or otherwise) like
> that already exists?
>
> * Does this sound like something that would be good to do in Django?
>
> * Does anyone know of any free/open source software (django based)
> that I could use as a starting point?  Not being a web developer, I
> know that if I do this from scratch, I will probably not do a great
> job.  No doubt there are a ton of intracacies to window layout, the
> structure of the models, the html templates, and other things I
> haven't even thought of.  So I'm thinking it would be great to
> bootstrap from some existing code, even if it doesn't do quite what I
> want.  I would be happy to contribute my own work back to the open
> source community.
>
> Thanks for any ideas!
>
> Margie- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: VPS Hosting - Webkeepers

2008-12-04 Thread James Matthews
I haven't heard anything and I think you should try posting this on
webhosting forums asking them.

On Thu, Dec 4, 2008 at 8:52 PM, John M <[EMAIL PROTECTED]> wrote:

>
> Anyone tried this for django?  http://www.webkeepers.com/index.html
>
> entry level is 6.95/mo, great for QA site I would think.
>
> Just curious
>
> Thanks
>
> John
> >
>


-- 
http://www.astorandblack.com/

http://www.jewelerslounge.com/

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Using managers for related object access

2008-12-04 Thread Luke Graybill
I am attempting to use a custom manager for related object access, as
documented 
here,
but it does not appear to be working properly. Upon accessing the reverse
relationship, I am getting an unfiltered queryset result. Using this trimmed
down code , and assuming that at least one
employee is entered, I should be getting an empty queryset on the third
lookup demonstrated below, rather than the full queryset:

>>> from models import Employee, Shift
>>> e = Employee.objects.get(id=1)
>>> s = Shift.objects.create(worked_by=e)
>>> s.is_dereferenced = True
>>> s.save()
>>> Shift.objects.all()
[]
>>> Shift.referenced.all()
[]
>>> e.shifts.all()
[]

The documentation that I linked above seems fairly straightforward, so am I
missing something obvious here? I'm hesitant to file this as a bug report,
because I have not found any mention of similar issues posted, and that
leads me to feel that I must be in the wrong.

Any help would be appreciated. Thanks!

Luke

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Python 3.0 released - what's the status of Django vs. 3.0?

2008-12-04 Thread James Bennett

On Thu, Dec 4, 2008 at 1:37 PM, ohmi <[EMAIL PROTECTED]> wrote:
> As the subject says - will Django compile and run on Python 3.0?

No, nor is it expected to for at least a year or two, something
entirely consistent with the general plan for pretty much all Python
software to migrate.

If you're genuinely interested in more, **please** search the archives
of this list for the many times this question has been asked and
answered before.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Python 3.0 released - what's the status of Django vs. 3.0?

2008-12-04 Thread ohmi

As the subject says - will Django compile and run on Python 3.0?

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Invalid block tag: render_comment_form (repost)

2008-12-04 Thread Florian Lindner

Hello,
since noone replied and I still found no answer I dare to repost.


I use the comments framework from the newest Django SVN checkout.

I have in my template:

{% load comments % }
[...]
{% render_comment_form for object %}

resulting in a Invalid block tag: 'render_comment_form'

I have found the same error in one other posting but no solution. What  
is wrong?

Thanks,

Florian

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



VPS Hosting - Webkeepers

2008-12-04 Thread John M

Anyone tried this for django?  http://www.webkeepers.com/index.html

entry level is 6.95/mo, great for QA site I would think.

Just curious

Thanks

John
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: open source project management app that uses django?

2008-12-04 Thread maeck

You can use the standard css from the admin for your both the admin
pages as the custom reports.
Just load the admin css and follow the same html.

Works for me.

Maeck

On Dec 4, 12:04 am, Margie <[EMAIL PROTECTED]> wrote:
> Thanks - yes, that is pretty much the approach I am planning to take,
> but I just figured I'd see if there was anything interesting out there
> that would give me a spiffy look and feel for the reporting pages.
> One thing that I find confusing is how to come up with a color
> scheme.  I know that seems sort of low priority, but I swear the first
> thing people notice is if your colors are "ugly" or very basic looking
> (ie, black and white).
>
> Anyway, I will proceed with putting the models together as that is
> clearly the meat of the project at this poitn.  I just learned about
> CRUD tonight, and I can see how that is very nice.
>
> Thanks,
> Margie
>
> On Dec 3, 5:59 pm, maeck <[EMAIL PROTECTED]> wrote:
>
> > Margie,
>
> > If you can think up a decent model, you might be able to setup the
> > core of the project management application in the Django contrib.admin
> > module.
> > Development will go fast as long as you can stay with standard CRUD
> > pages.
> > The admin model will also give you the user security hooks necessary
> > for the manager and employees.
>
> > As soon as you nee a need for reporting pages or ways to do things a
> > little more complex than the admin can give you, you can build custom
> > pages for those. But I would think you could have 80% of your app
> > running only by setting up the database models and nice admin pages.
>
> > Maeck
>
> > On Dec 3, 3:41 pm, Margie <[EMAIL PROTECTED]> wrote:
>
> > > Hi everyone,
>
> > > I would like to create a django project managment web app to be used
> > > internally in my company.  I am a software developer, but have little
> > > experience with web apps other than my recent work going through the
> > > sams django tutorial book.
>
> > > I'm wondering if anyone knows of any open source/free django web app
> > > that I might be able to use to get started on this project.  Let me
> > > describe the usage model to give you an idea of what I'm aiming for.
>
> > > At a very high level, the usage model for this web app is that a
> > > "manager" assigns tasks to "employees" on a weekly basis. Associated
> > > with each task is a set of measurements that must be performed by the
> > > employee as he/she does the task.  The measurements vary based on the
> > > task, and somemes the measurement is reported with a comment string,
> > > sometimes a number, or sometimes a check mark in one of 'n' radio
> > > boxes.   As the employees complete the tasks, they fill in the
> > > measurements.  At the end of the week, the manager can look at each
> > > task and review the resulting measurements, and based on that data,
> > > decide the next weeks'  tasks.
>
> > > Unlike a project mangament tool like MS Project, which helps you
> > > schedule and gannt chart the schedule, this is really a tool to for
> > > enhancing project communication.  It is intended to allow the manager
> > > to easily communicate tasks to the employees, get the results back,
> > > and then make decisions about what the next set of tasks sould be.
> > > All without having to spend a lot of time emailing and talking to
> > > people.  In the environement where it will be used, the manager is
> > > getting results back from maybe 100 different employees, each of which
> > > have a few tasks to do.  The data is not complex, but there is just
> > > too much of it to manage without a tool.  Currently folks are using
> > > wiki and excel, but in my opninion this is not really automated
> > > enough.
>
> > > My thought is that a django web client could provide a very simple and
> > > easy to use interface, and could also be extended to get all sorts of
> > > nice long term trend information.  For exmaple, t would be interesting
> > > to know if a project being run at site A executes task 'foo' more
> > > frequently or for longer periods of time than a project being run at
> > > site B.  As data is across multiple similar projects, it seems that it
> > > could be mined for lots of interesting info to help improve the
> > > productivity of future projects.
>
> > > Ok - so hopefully you get the idea.  Now for my questions:
>
> > > * Does anyone know of existing web apps (django or otherwise) like
> > > that already exists?
>
> > > * Does this sound like something that would be good to do in Django?
>
> > > * Does anyone know of any free/open source software (django based)
> > > that I could use as a starting point?  Not being a web developer, I
> > > know that if I do this from scratch, I will probably not do a great
> > > job.  No doubt there are a ton of intracacies to window layout, the
> > > structure of the models, the html templates, and other things I
> > > haven't even thought of.  So I'm thinking it would be great to
> > > bootstrap from some existing code, eve

Re: Can javascript call a python script?

2008-12-04 Thread Django Newbie

With AJAX you can.  Javascript is interpreted by the browser, and you 
want to call a serverside script.  Or you could do it as a form 
submission, but I assume you want it to happen without refreshing the 
page, so AJAX is how you would do that.

Eric wrote:
> Hello, this might be a silly question, but I'm wondering if javascript
> can call a python script, and if so, how?
>
> To elaborate, I'm trying to customize the admin change_list page so
> that editing can be done directly from the change_list, instead of
> clicking into the admin change_form page. To do this, I have a
> javascript that pops up a prompt box when an element in the
> change_list table is clicked. I'd then like to call a python script to
> modify that element in the database (since I don't believe the DB can
> be modified directly in the javascript).
>
> If this is unnecessary or just plain wrong, or if someone has a better
> way of editing items directly from the change_list, please let me
> know! Thanks much for the help.
> >   


--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: exclude() method bug

2008-12-04 Thread maeck

If quantity is an integer field, should you not use the exclude as:
Place.objects.exclude(itemplace__quantity = 0)
If this is not it, please show us the models.


Maeck


On Dec 4, 4:58 am, Karantir <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've just found strange django behaviour and want to understand is it
> a bug or an inconvenient feature. I have two models -- Place and Item
> bound through the intermediate table ItemPlace (that stores additional
> field -- quantity). Physically it describes some quantity of items
> lying on the some places.
>
> Then i've tried to fetch spare places with the following request:
> Place.objects.filter(itemplace__quantity = None) and it works
> perfectly. After that i've run Place.objects.exclude
> (itemplace__quantity = None) to fetch occupied places but this request
> anyway returns an empty list.
>
> Surely i can use Place.objects.filter(itemplace__quantity__gte = 0)
> and it works but why the previous request fails? Any ideas?
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: More User/Profile troubles

2008-12-04 Thread Brian Neal

On Dec 4, 11:08 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> I apologise for spamming everyone, here i stuck it up at dpaste with
> the comments which makes it a bit clearer-http://dpaste.com/96128/
>
You are almost there. You are assigning a form instance to your custom
profile's user foreign key. That is not what you want. You want to
assign the appropriate user instance to that foreign key field.

Instead of:
extraformedit.user = userformInstance

Try this:
extraformedit.user = request.user
or
extraformedit.user = userforminstance.user

Another suggestion: you probably need to check to see if both forms
are valid before going ahead with the saving.

if form.is_valid() and extraform.is_valid():

I recently did something similiar, I found my code and dpasted it. In
my case I am showing the view for a user to edit her existing profile.
I hope it helps:
http://dpaste.com/96150/
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Custom MultipleChoiceField for ManyToManyField

2008-12-04 Thread coderb

Hi All,

I have a detail entry linked to a category table with a manytomany
relationship

category model fields are (id, name, parent_id), and I've built the
category hierarchy.

The detail entry should only be linked to a lowest level category.

So when it comes to adding / editing the detail entry, can someone
please tell me how I can customize the standard MultipleChoiceField

lets say I want the category selector to be represented by a custom
widget similar to a calendar date selector,  so it pops up, allows you
to drill down the hierarchy of categories and only select a lowest
level category. perhaps it retains the selection as you navigate and
select other lowest level categories ( which is probably not wise) or
once one category is selected, it sets another display field (in a
breadcrumb style) showing the selected category/ies

But then I dont know how to relate that back to the manytomany field .


I dont really want to use the standard MultipleChoiceField, even if I
do manage to indent to show category hierarchy, it still is confusing
as to what level are allowed for selection, which in my case lowest
only.

any guidance would be greatly appreciated.  thanks.
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Why run two web-servers on the same host?

2008-12-04 Thread walterbyrd



On Dec 2, 10:25 am, bruno desthuilliers
<[EMAIL PROTECTED]> wrote:

> Because django runs as a long-running process, and does not rebuild
> the whole world on each and any request (which is what PHP do).

Seems to me that would make Python run faster. I suppose that must
take more system resources. Which, I further suppose, is why so many
low-cost web-hosters don't do Python? I am using a VPS, so it's not a
problem for me.
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Add fields to another app model

2008-12-04 Thread redmonkey

Hey Bojan

There is a few ways you could do this (certainly more that what I'm
about to tell you). It depends on the effect you want to create.

Perhaps the simplest way is to inherit from the existing class. But
inheriting classes should only strictly be used as an `is a`
relationship. So perhaps you could justify it by thinking of your
Contact model as just a different, specialised version of the satchmo
Contact model. It's worth baring in mind the DB joins this type of
thing could add though, and the consequences these joins bring with
them. In a recent project I was working on, I imported the model I
needed, changed `abstract = True` and then inherited from it in one of
my models to do a similar sort of thing to what you're trying to
create:

from voting.models import Vote as VoteBase
VoteBase._meta.abstract = True

class SpecialVote(VoteBase):
pass

There's a good TWiD article on inheriting models so you could take a
look at that to find out more about it
http://thisweekindjango.com/articles/2008/jun/17/abstract-base-classes-vs-model-tab/

The other option is to use a registering paradigm like that used in
Django-MPTT. You basically call a function with a bunch of models and
this function adds some properties to them. You can see it here in the
DJango-MPTT __init__.py file:
http://code.google.com/p/django-mptt/source/browse/trunk/mptt/__init__.py

If you read the docs for Django-MPTT you see that you have to add a
call to ``mptt.register`` with every model you want to have this
functionality. This function just adds a tonne of fields and
properties to your models using _meta. You can read more about that by
James Bennett:

http://www.b-list.org/weblog/2007/nov/04/working-models/

Have a poke around in loads of the project on Google Code though, see
what other people are doing, and how they're tackling problems like
you'll soon start having your own ideas about how to do stuff.

Hope all that helps.

RM

On Dec 4, 8:45 am, Bojan Mihelac <[EMAIL PROTECTED]> wrote:
> Hi all!
>
> I am looking for right way to add fields to model that is in another
> app. At first I created mysite application and in models.py put
>
> from satchmo.contact.models import Contact
> Contact.add_to_class("company_name", models.CharField(max_length =
> 200))
>
> that raises exception ProgrammingError sometimes:
> ProgrammingError: (1110, "Column 'company_name' specified twice")
>
> So now I check before if field is already in model:
>
> if 'company_name' not in Contact._meta.get_all_field_names():
>     Contact.add_to_class("company_name", models.CharField(max_length =
> 200))
>
> I have feeling that this is not right way to do. I'd appreciate any
> help, hint or thought on this.
> I also wonder how models are loaded in django.
>
> Bojan
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: More User/Profile troubles

2008-12-04 Thread [EMAIL PROTECTED]

I apologise for spamming everyone, here i stuck it up at dpaste with
the comments which makes it a bit clearer-
http://dpaste.com/96128/

On 4 Dec, 17:01, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> I dont know why the margins are squashing everything, ill try and post
> my code again this time without the comments
>
>     if request.method == 'POST':
>         form = UserCreationForm(request.POST)
>         extraform =  CustomProfileForm(request.POST)
>         if form.is_valid():
>             userformInstance = form.save()
>             extraformedit = extraform.save(commit=False)
>             extraformedit.user = userformInstance
>             extraformedit.save()
>             return HttpResponseRedirect("/")
>
> Hope that works a bit better.
>
> On 4 Dec, 16:57, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > Thanks for your help Brian, Im still quite confused. I think what Im
> > really not sure about is how to set the foreignkey manually as it
> > doesnt really talk about that in the documentation.
>
> > Here is what I have now, if extraformedit.user is a foreignkey, how do
> > i connect it to the form I just saved?-
>
> >     if request.method == 'POST':
> >         form = UserCreationForm(request.POST)
> >         extraform =  CustomProfileForm(request.POST)
> >         if form.is_valid():
> >             userformInstance = form.save
> > ()                                #save the form with the user data
> > and create an instance i can hook my profile to
> >             extraformedit = extraform.save(commit=False)
> > #save the profile form with commit=false so i can modify it
> >             extraformedit.user = userformInstance
> > #!!i think this is where im going wrong? assigning the user the
> > profile is attached to
> >             extraformedit.save
> > ()                                                 #save the edited
> > form to the database.
> >             return HttpResponseRedirect("/")
>
> > Am I way off? Again I am very new to this so sorry if this is a stupid
> > question.
>
> > Phil
>
> > On 3 Dec, 18:52, Brian Neal <[EMAIL PROTECTED]> wrote:
>
> > > On Dec 3, 12:22 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > > wrote:
>
> > > > ...
> > > > And here is my view for my signup page -
>
> > > > def signup(request):
> > > >     if request.method == 'POST':
> > > >         form = UserCreationForm(request.POST)
> > > >         extraform =  CustomProfileForm(request.POST)
> > > >         if form.is_valid():
> > > >             form.save()
> > > >             extraform.save()
> > > >             return HttpResponseRedirect("/")
> > > >     else:
> > > >         form = UserCreationForm()
> > > >         extraform =  CustomProfileForm()
>
> > > >     return render_to_response('signup.html', {
> > > >         'form': form,
> > > >         'extraform': extraform
> > > >     })
>
> > > > This view doesnt work because it is not saving 'user' in
> > > > CustomProfileForm.
>
> > > > Ok now the problem I am having is with the foreignkey in the custom
> > > > profile model, and successfully linking that to the User.
>
> > > Yes. You need to set the user foreign key inside the extraform before
> > > you save it. See the discussion here about ModelForms save() with
> > > commit=False:
>
> > >http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#the-sav...
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: More User/Profile troubles

2008-12-04 Thread [EMAIL PROTECTED]

I dont know why the margins are squashing everything, ill try and post
my code again this time without the comments

if request.method == 'POST':
form = UserCreationForm(request.POST)
extraform =  CustomProfileForm(request.POST)
if form.is_valid():
userformInstance = form.save()
extraformedit = extraform.save(commit=False)
extraformedit.user = userformInstance
extraformedit.save()
return HttpResponseRedirect("/")

Hope that works a bit better.

On 4 Dec, 16:57, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Thanks for your help Brian, Im still quite confused. I think what Im
> really not sure about is how to set the foreignkey manually as it
> doesnt really talk about that in the documentation.
>
> Here is what I have now, if extraformedit.user is a foreignkey, how do
> i connect it to the form I just saved?-
>
>     if request.method == 'POST':
>         form = UserCreationForm(request.POST)
>         extraform =  CustomProfileForm(request.POST)
>         if form.is_valid():
>             userformInstance = form.save
> ()                                #save the form with the user data
> and create an instance i can hook my profile to
>             extraformedit = extraform.save(commit=False)
> #save the profile form with commit=false so i can modify it
>             extraformedit.user = userformInstance
> #!!i think this is where im going wrong? assigning the user the
> profile is attached to
>             extraformedit.save
> ()                                                 #save the edited
> form to the database.
>             return HttpResponseRedirect("/")
>
> Am I way off? Again I am very new to this so sorry if this is a stupid
> question.
>
> Phil
>
> On 3 Dec, 18:52, Brian Neal <[EMAIL PROTECTED]> wrote:
>
> > On Dec 3, 12:22 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > wrote:
>
> > > ...
> > > And here is my view for my signup page -
>
> > > def signup(request):
> > >     if request.method == 'POST':
> > >         form = UserCreationForm(request.POST)
> > >         extraform =  CustomProfileForm(request.POST)
> > >         if form.is_valid():
> > >             form.save()
> > >             extraform.save()
> > >             return HttpResponseRedirect("/")
> > >     else:
> > >         form = UserCreationForm()
> > >         extraform =  CustomProfileForm()
>
> > >     return render_to_response('signup.html', {
> > >         'form': form,
> > >         'extraform': extraform
> > >     })
>
> > > This view doesnt work because it is not saving 'user' in
> > > CustomProfileForm.
>
> > > Ok now the problem I am having is with the foreignkey in the custom
> > > profile model, and successfully linking that to the User.
>
> > Yes. You need to set the user foreign key inside the extraform before
> > you save it. See the discussion here about ModelForms save() with
> > commit=False:
>
> >http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#the-sav...
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: More User/Profile troubles

2008-12-04 Thread [EMAIL PROTECTED]

Thanks for your help Brian, Im still quite confused. I think what Im
really not sure about is how to set the foreignkey manually as it
doesnt really talk about that in the documentation.

Here is what I have now, if extraformedit.user is a foreignkey, how do
i connect it to the form I just saved?-

if request.method == 'POST':
form = UserCreationForm(request.POST)
extraform =  CustomProfileForm(request.POST)
if form.is_valid():
userformInstance = form.save
()#save the form with the user data
and create an instance i can hook my profile to
extraformedit = extraform.save(commit=False)
#save the profile form with commit=false so i can modify it
extraformedit.user = userformInstance
#!!i think this is where im going wrong? assigning the user the
profile is attached to
extraformedit.save
() #save the edited
form to the database.
return HttpResponseRedirect("/")

Am I way off? Again I am very new to this so sorry if this is a stupid
question.

Phil


On 3 Dec, 18:52, Brian Neal <[EMAIL PROTECTED]> wrote:
> On Dec 3, 12:22 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > ...
> > And here is my view for my signup page -
>
> > def signup(request):
> >     if request.method == 'POST':
> >         form = UserCreationForm(request.POST)
> >         extraform =  CustomProfileForm(request.POST)
> >         if form.is_valid():
> >             form.save()
> >             extraform.save()
> >             return HttpResponseRedirect("/")
> >     else:
> >         form = UserCreationForm()
> >         extraform =  CustomProfileForm()
>
> >     return render_to_response('signup.html', {
> >         'form': form,
> >         'extraform': extraform
> >     })
>
> > This view doesnt work because it is not saving 'user' in
> > CustomProfileForm.
>
> > Ok now the problem I am having is with the foreignkey in the custom
> > profile model, and successfully linking that to the User.
>
> Yes. You need to set the user foreign key inside the extraform before
> you save it. See the discussion here about ModelForms save() with
> commit=False:
>
> http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#the-sav...
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



DateTimeField and input_formats

2008-12-04 Thread ReneMarxis

Hi i have some basic question on datetime formating. I have one form
and view as defined under
http://dpaste.com/96096/

Just to get it right: shouldn't the form format the dates while
rendering automaticly and show them formated according to the
input_formats? The form does not for me.

Also the form validation inside the view does not pass if i enter e.g.
01.01.2008 01:01:01nor does it if i enter 2008-01-01 01:01:01. Why?

Any help would be very welcome.
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Add fields to another app model

2008-12-04 Thread redmonkey

Hey Bojan

There is a few ways you could do this (certainly more that what I'm
about to tell you). It depends on the effect you want to create.

Perhaps the simplest way is to inherit from the existing class. But
inheriting classes should only strictly be used as an `is a`
relationship. So perhaps you could justify it by thinking of your
Contact model as just a different, specialised version of the satchmo
Contact model. It's worth baring in mind the DB joins this type of
thing could add though, and the consequences these joins bring with
them. In a recent project I was working on, I imported the model I
needed, changed `abstract = True` and then inherited from it in one of
my models to do a similar sort of thing to what you're trying to
create:

from voting.models import Vote as VoteBase
VoteBase._meta.abstract = True

class SpecialVote(VoteBase):
pass

There's a good TWiD article on inheriting models so you could take a
look at that to find out more about it
http://thisweekindjango.com/articles/2008/jun/17/abstract-base-classes-vs-model-tab/

The other option is to use a registering paradigm like that used in
Django-MPTT. You basically call a function with a bunch of models and
this function adds some properties to them. You can see it here in the
DJango-MPTT __init__.py file:
http://code.google.com/p/django-mptt/source/browse/trunk/mptt/__init__.py

If you read the docs for Django-MPTT you see that you have to add a
call to ``mptt.register`` with every model you want to have this
functionality. This function just adds a tonne of fields and
properties to your models using _meta. You can read more about that by
James Bennett:

http://www.b-list.org/weblog/2007/nov/04/working-models/

Have a poke around in loads of the project on Google Code though, see
what other people are doing, and how they're tackling problems like
you'll soon start having your own ideas about how to do stuff.

Hope all that helps.

RM

On Dec 4, 8:45 am, Bojan Mihelac <[EMAIL PROTECTED]> wrote:
> Hi all!
>
> I am looking for right way to add fields to model that is in another
> app. At first I created mysite application and in models.py put
>
> from satchmo.contact.models import Contact
> Contact.add_to_class("company_name", models.CharField(max_length =
> 200))
>
> that raises exception ProgrammingError sometimes:
> ProgrammingError: (1110, "Column 'company_name' specified twice")
>
> So now I check before if field is already in model:
>
> if 'company_name' not in Contact._meta.get_all_field_names():
>     Contact.add_to_class("company_name", models.CharField(max_length =
> 200))
>
> I have feeling that this is not right way to do. I'd appreciate any
> help, hint or thought on this.
> I also wonder how models are loaded in django.
>
> Bojan
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Authentication session timeout

2008-12-04 Thread mdp


>
> What did you set SESSION_COOKIE_AGE to?  It rather sounds like you set it to
> a string value when a numeric is expected.
>
> Karen

Doh!! You're right, I'd set:

SESSION_COOKIE_AGE = '600'

Thanks

Mike
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: unable to open database file

2008-12-04 Thread bruno desthuilliers

On 4 déc, 09:49, gaz <[EMAIL PROTECTED]> wrote:
> Hi I am trying to run Django Questionaire (http://djangoquest.aperte-
> it.com/) on Apache with mod_python using SQlite on Windows 2003.
>
> When I try to log in I get the unable to open database file error. I
> saw a number of posts mention that the parent
> directory should be writable and it is.
>
(snip)
> Here is my settings file and error output, any ideas ?
>
> # Django settings for django-questionnaire project.
(snip)
> WORKING_DIRECTORY = 'C:\djangoprojects\djangoquest'
(snip)
> DATABASE_NAME = 'C:\questionairedb\test_quest.sqlite' # Or

Remember that the settings.py file is python source code, and that in
Python (like in C and most other languages), '\t' is the escape
sequence for the tab character. For file path on Windows, you want to
either:
- escape the antislashes (ie : "C:\\questionairedb\
\test_quest.sqlite")
- use raw strings (ie : r"C:\questionairedb\test_quest.sqlite")
- or just use a slash as path separator (ie :  "C:/questionairedb/
test_quest.sqlite")


--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Cookie domain

2008-12-04 Thread globophobe

Since upgrading to django 1.0 I've noticed some strange behavior with
cookies.

1) Basically, if I do not set SESSION_COOKIE_DOMAIN to a value then my
site is not accessible by either Mac Safari or Mac/PC IE.

2) If I set a value of ".domain.com" then my site is accessible by all
Mac web browsers, Firefox, Opera, as well as Mac IE 5.2; however, it
is not accessible by PC IE 6+.

3) Finally, if I set a value of "www.domain.com" then my site is
accessible by Mac Firefox and Opera as well as PC IE 6+; however, is
then no longer accessible by Mac Safari or Mac IE 5.2

The following are my server response headers for (3):

Date: Thu, 04 Dec 2008 13:50:42 GMT
Server: nginx/0.7.19
Content-Type: text/html; charset=utf-8
Vary: Cookie,User-Agent
Cache-Control: must-revalidate, max-age=0
Content-Encoding: gzip
Set-Cookie: sessionid=b3eddeb72e4b93c8cbd0e4e74b349d6c;
Domain=www.domain.com; expires=Thu, 04-Dec-2008 15:50:42 GMT; Max-
Age=7200; Path=/
Keep-Alive: timeout=3, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked

200 OK

Any insight is greatly appreciated.

Luis.
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: open source project management app that uses django?

2008-12-04 Thread Kenneth Gonsalves

On Thursday 04 Dec 2008 4:22:15 pm Horst Gutmann wrote:
> Grrr again linebreaks
> 

this worked:
svn checkout http://jutda-helpdesk.googlecode.com/svn/trunk/ jutda


-- 
regards
KG
http://lawgon.livejournal.com

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django-tagging encoding errors

2008-12-04 Thread Alex Jonsson

Basically, we use a VPS that runs CentOS 4.7, in which Python 2.3 came
preinstalled. We've been on a tight schedule and therefore haven't
updated Python yet. I probably would've been better off upgrading
Python though than working with this bug ...

We're switching hosts within the next weeks as well, so soon enough
we'll be on 2.6 (sweet relief). I don't really see the point in
supporting 2.3 with Django much longer, it seems as ancient as
supporting IE5.5.

Alex

On Dec 4, 12:55 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> Glad to help.  Out of curiosity, where are you deploying that your
> production server has only Python 2.3?  There's been a conversation over on
> the developer's list about when to drop support for Python 2.3 in Django,
> and the general feeling seems to be that 2.3 ought to be getting pretty
> rarely seen nowadays.  I'm wondering if you still see needing to run on
> Python 2.3 in 3 months time, 6 months time, etc.?
>
> Karen
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



exclude() method bug

2008-12-04 Thread Karantir

Hi,

I've just found strange django behaviour and want to understand is it
a bug or an inconvenient feature. I have two models -- Place and Item
bound through the intermediate table ItemPlace (that stores additional
field -- quantity). Physically it describes some quantity of items
lying on the some places.

Then i've tried to fetch spare places with the following request:
Place.objects.filter(itemplace__quantity = None) and it works
perfectly. After that i've run Place.objects.exclude
(itemplace__quantity = None) to fetch occupied places but this request
anyway returns an empty list.

Surely i can use Place.objects.filter(itemplace__quantity__gte = 0)
and it works but why the previous request fails? Any ideas?
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



thread by latest post

2008-12-04 Thread Wim Feijen

Hello,

While writing a forum app, I ran into a problem: I am unable to sort a
list of threads by date of their latest post.

My models look like:

class Thread(models.Model):
club = models.ForeignKey(Club)
name= models.CharField(_('Thread'), max_length=100)
date = models.DateTimeField(auto_now = True )

def __unicode__(self):
return self.name

class Post(models.Model):
thread = models.ForeignKey(Thread)
date = models.DateTimeField(auto_now=True)
subject = models.CharField(_('Subject'), max_length=100)
text = models.TextField(_('Text'))

def __unicode__(self):
return self.subject

I know that I can get the date of the latest post of a thread by
using:
Thread.objects.get(id=3).post_set.all().latest('date').date

However, I do not know if there is any possibility of me using that
date to sort a QuerySet of threads, which I get by using
Thread.objects.filter(club=1). Is there any way to do this in Django?

Many thanks for your help!

Wim
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Question about i18n

2008-12-04 Thread Elvis Stansvik

2008/12/4 Malcolm Tredinnick <[EMAIL PROTECTED]>:
>
>
> On Wed, 2008-12-03 at 12:51 +0100, Elvis Stansvik wrote:
>> Hello django-users, first post to this list :)
>>
>> I often use the i18n support of Django in my projects, and I have a
>> small annoyance/problem that maybe someone can help me with.
>>
>> If I decide to customize e.g. admin/index.html, by copying it over
>> from django to my project, strings in that template such as "My
>> Actions" will now be treated as untranslated by manage.py makemessages
>> -a, even though they are indeed translated in Django's own django.po.
>>
>> This is all logical and all, and I can see why it is so, but it makes
>> my project's django.po unnecessarily cluttered with "untranslated"
>> strings that I in fact don't have translate, since they are translated
>> in Django's own django.po.
>
> There isn't a way to do this. Worth looking at whether there's a simple
> way to do this, although I can see it being slightly controversial: if
> some string is in Django's core, but not translated for language X,
> people are going to complain that they cannot translate it in there PO
> file because it's not included and they're being held hostage by the
> upstream Django translator. Adding yet another option is a possibility,
> although it's way down the list of preferred options, since adding
> options is always sub-optimal.

I can see the problem yes. I can only say that I would personally
_really_ like an option for this.

It think this option could be e.g.:

  -m POFILE, --merge=POFILE
Merge the pulled messages with the specified .po file.
Use -m multiple times to specify several files.

I'm not very gettext savvy, but to me it seems this would be a simple
msgmerge invocation. Would it be okay if I file a wish for this? I
might even look into making a patch, but not right now as I'm kind of
busy.

Thanks for your input Malcolm. Anyone else who feels something
strongly about this or have a better idea?

Elvis

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: open source project management app that uses django?

2008-12-04 Thread Horst Gutmann

Grrr again linebreaks


On Thu, Dec 4, 2008 at 11:51 AM, Horst Gutmann <[EMAIL PROTECTED]> wrote:
> Looks like you got hit by some evil linebreaks :-)
>
> svn checkout http://jutda-helpdesk.googlecode.com/svn/trunk/
> jutda-helpdesk-read-only
>
> On Thu, Dec 4, 2008 at 11:40 AM, Kenneth Gonsalves
> <[EMAIL PROTECTED]> wrote:
>> On Thursday 04 Dec 2008 12:57:14 pm Hanny Wibisono wrote:
>>> http://www.jutdahelpdesk.com/
>>
>> I get this error:
>> [EMAIL PROTECTED] ~]$ svn checkout
>> http://jutda-helpdesk.googlecode.com/svn/trunk/jutda-helpdesk-read-only jutda
>> svn:
>> URL 'http://jutda-helpdesk.googlecode.com/svn/trunk/jutda-helpdesk-read-only'
>> doesn't exist
>>
>> --
>> regards
>> KG
>> http://lawgon.livejournal.com
>>
>> >>
>>
>

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: open source project management app that uses django?

2008-12-04 Thread Horst Gutmann

Looks like you got hit by some evil linebreaks :-)

svn checkout http://jutda-helpdesk.googlecode.com/svn/trunk/
jutda-helpdesk-read-only

On Thu, Dec 4, 2008 at 11:40 AM, Kenneth Gonsalves
<[EMAIL PROTECTED]> wrote:
> On Thursday 04 Dec 2008 12:57:14 pm Hanny Wibisono wrote:
>> http://www.jutdahelpdesk.com/
>
> I get this error:
> [EMAIL PROTECTED] ~]$ svn checkout
> http://jutda-helpdesk.googlecode.com/svn/trunk/jutda-helpdesk-read-only jutda
> svn:
> URL 'http://jutda-helpdesk.googlecode.com/svn/trunk/jutda-helpdesk-read-only'
> doesn't exist
>
> --
> regards
> KG
> http://lawgon.livejournal.com
>
> >
>

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: open source project management app that uses django?

2008-12-04 Thread Kenneth Gonsalves

On Thursday 04 Dec 2008 12:57:14 pm Hanny Wibisono wrote:
> http://www.jutdahelpdesk.com/

I get this error:
[EMAIL PROTECTED] ~]$ svn checkout 
http://jutda-helpdesk.googlecode.com/svn/trunk/jutda-helpdesk-read-only jutda
svn: 
URL 'http://jutda-helpdesk.googlecode.com/svn/trunk/jutda-helpdesk-read-only' 
doesn't exist

-- 
regards
KG
http://lawgon.livejournal.com

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



RE: open source project management app that uses django?

2008-12-04 Thread Hanny Wibisono

http://www.jutdahelpdesk.com/


-Original Message-
From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED]
On Behalf Of Margie

Hi everyone,

I would like to create a django project managment web app to be used
internally in my company.  I am a software developer, but have little
experience with web apps other than my recent work going through the
sams django tutorial book.

I'm wondering if anyone knows of any open source/free django web app
that I might be able to use to get started on this project.  Let me
describe the usage model to give you an idea of what I'm aiming for.

At a very high level, the usage model for this web app is that a
"manager" assigns tasks to "employees" on a weekly basis. Associated
with each task is a set of measurements that must be performed by the
employee as he/she does the task.  The measurements vary based on the
task, and somemes the measurement is reported with a comment string,
sometimes a number, or sometimes a check mark in one of 'n' radio
boxes.   As the employees complete the tasks, they fill in the
measurements.  At the end of the week, the manager can look at each
task and review the resulting measurements, and based on that data,
decide the next weeks'  tasks.

Unlike a project mangament tool like MS Project, which helps you
schedule and gannt chart the schedule, this is really a tool to for
enhancing project communication.  It is intended to allow the manager
to easily communicate tasks to the employees, get the results back,
and then make decisions about what the next set of tasks sould be.
All without having to spend a lot of time emailing and talking to
people.  In the environement where it will be used, the manager is
getting results back from maybe 100 different employees, each of which
have a few tasks to do.  The data is not complex, but there is just
too much of it to manage without a tool.  Currently folks are using
wiki and excel, but in my opninion this is not really automated
enough.

My thought is that a django web client could provide a very simple and
easy to use interface, and could also be extended to get all sorts of
nice long term trend information.  For exmaple, t would be interesting
to know if a project being run at site A executes task 'foo' more
frequently or for longer periods of time than a project being run at
site B.  As data is across multiple similar projects, it seems that it
could be mined for lots of interesting info to help improve the
productivity of future projects.

Ok - so hopefully you get the idea.  Now for my questions:

* Does anyone know of existing web apps (django or otherwise) like
that already exists?

* Does this sound like something that would be good to do in Django?

* Does anyone know of any free/open source software (django based)
that I could use as a starting point?  Not being a web developer, I
know that if I do this from scratch, I will probably not do a great
job.  No doubt there are a ton of intracacies to window layout, the
structure of the models, the html templates, and other things I
haven't even thought of.  So I'm thinking it would be great to
bootstrap from some existing code, even if it doesn't do quite what I
want.  I would be happy to contribute my own work back to the open
source community.

Thanks for any ideas!

Margie


--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



unable to open database file

2008-12-04 Thread gaz

Hi I am trying to run Django Questionaire (http://djangoquest.aperte-
it.com/) on Apache with mod_python using SQlite on Windows 2003.

When I try to log in I get the unable to open database file error. I
saw a number of posts mention that the parent
directory should be writable and it is.

Here is a dir output of my SQlite file directory

C:\questionairedb>dir
 Volume in drive C has no label.
 Volume Serial Number is 14DE-9E3F

 Directory of C:\questionairedb

12/04/2008  05:42 PM  .
12/04/2008  05:42 PM  ..
10/16/2008  01:13 AM48,128 test_quest.sqlite
   1 File(s) 48,128 bytes
   2 Dir(s)  53,127,024,640 bytes free

C:\questionairedb>

Here is my settings file and error output, any ideas ?

# Django settings for django-questionnaire project.

import os.path

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
('Admin name', '[EMAIL PROTECTED]'),
)
PROJECT_NAME = 'djangoquest'
WORKING_DIRECTORY = 'C:\djangoprojects\djangoquest'
QUESTIONNAIRE_TEMPLATES = 'questionnaire/'
QUESTIONNAIRE_URL = 'http://10.21.1.124/questionnaire'

MANAGERS = ADMINS

DATABASE_ENGINE = 'sqlite3'   # 'postgresql_psycopg2',
'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
DATABASE_NAME = 'C:\questionairedb\test_quest.sqlite' # Or
path to database file if using sqlite3.
DATABASE_USER = '' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost.
Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not
used with sqlite3.

# The session of a user ends if he closes his browser

SESSION_COOKIE_DOMAIN = None

CACHE_BACKEND = 'dummy://'

# Local time zone for this installation. Choices can be found here:
# 
http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
# although not all variations may be possible on all operating
systems.
# If running in a Windows environment this must be set to the same as
your
# system time zone.
TIME_ZONE = 'America/Chicago'

# Language code for this installation. All choices can be found here:
# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
# http://blogs.law.harvard.edu/tech/stories/storyReader$15
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as
not
# to load the internationalization machinery.
USE_I18N = True

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = ''
STATIC_DOC_ROOT = WORKING_DIRECTORY + '/media'

# URL that handles the media served from MEDIA_ROOT.
# Example: "http://media.lawrence.com";
MEDIA_URL = ''

# URL prefix for admin media -- CSS, JavaScript and images. Make sure
to use a
# trailing slash.
# Examples: "http://foo.com/media/";, "/media/".
ADMIN_MEDIA_PREFIX = '/media/'

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'a%t_zponly^xf$dc)okcglbxrz8f!4!38932hd+st67ultd6pg'

# List of callables that know how to import templates from various
sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source',
# 'django.template.loaders.eggs.load_template_source',
)

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware',
)

ROOT_URLCONF = PROJECT_NAME + '.urls'

TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/
django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
WORKING_DIRECTORY + '/templates',
)

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.admin',
PROJECT_NAME + '.questionnaire'
)


OperationalError at /questionnaire/

unable to open database file

Request Method: POST
Request URL:http://localhost:8000/questionnaire/
Exception Type: OperationalError
Exception Value:

unable to open database file

Exception Location: C:\Python25\Lib\site-packages\django\db\backends
\sqlite3\base.py in _cursor, line 145
Python Executable:  C:\Python25\python.exe
Python Version: 2.5.0
Python Path:['C:\\djangoprojects\\djangoquest', 'C:\\Python25\\lib\
\site-packages\\tracdatefield-1.0.1-py2.5.egg', 'C:\\Python25\\lib\
\site-packages\\trachoursplugin-0.1-py2.5.egg', 'C:\\Python25\\lib\
\site-packages\\feedparser-4.1-py2.5.egg', 'C:\\Python25\\lib\\site-
packages\\dateutil-1.1-py2.5.egg', 'C:\\Python25\\lib\\site-packages\
\virtualenv-1.3-py2.5.egg', 'C:\\Python25\\lib\\site-packages\
\setuptools-0.6c9dev_r66750-py2.5.egg', 'C:\\Python25\\lib\\site-
packages\\batchmodify-0.2.0

Re: No module named urls

2008-12-04 Thread Rob Hudson

On Dec 4, 12:59 am, Rob Hudson <[EMAIL PROTECTED]> wrote:

> I'll keep poking around a bit and see if I can dig up anything
> further.

I think I tracked it down...

Looking at the tracebacks above, you can see the first time through,
it winds up on line 198 which tries to import the urls.py file.  In my
particular case, the urlconf_name was "profiles.urls".  And indeed, my
local (in my project) profiles app does not have a urls.py file in
it.  If I `touch profiles/urls.py` things work, sort of.

The thing is, I'm using James Bennett's django-profiles package and
it's not in my project but it's on my Python path.  There are no
models, so I never put it in my INSTALLED_APPS (though reading now,
the docs say I should have)... I only reference the profiles.urls in
my root urls via include(), and that pulls in the urls from the
profiles app on my Python path.  I have a local project app also
called profiles, however, that doesn't include a urls.py (because I'm
using the one from James'), and this is the reason for the breakage.

Having the app named `profiles` is the perfect name but it can't exist
on my Python path and in my project without a conflict.  I tested
renaming mine, putting the "profiles" in my INSTALLED_APPS, and all is
well now.

-Rob
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: cursors and raw sql

2008-12-04 Thread David Zhou

On Thu, Dec 4, 2008 at 3:56 AM, bcurtu <[EMAIL PROTECTED]> wrote:

> i need to perform some Raw SQL queries in my django app. I read in the
> doc (http://docs.djangoproject.com/en/dev/topics/db/sql/) I can do sth
> like:

...

> The question is... Do I have to close the cursor?

Assuming it's following standard Python database API practices, you
can, if you want, but it's optional.



-- 
---
David Zhou
[EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: No module named urls

2008-12-04 Thread Rob Hudson

On Dec 3, 11:01 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> This is an area where Django has poor error handling and we're slowly
> cutting them down. So you have to do a bit of commenting out and
> experimenting on the command line (just try a simple reverse() call each
> time to trigger it) to work out the problem.
>
> It's the first error that you should pay attention to here. Subsequent
> "successes" are misleading -- they're not raising errors, but something
> is still not working properly.

Is this helpful at all then?

This is importing `reverse` and running it twice with the same URL
named view where I'm seeing the error.  I'm doing it twice to see the
difference...

>>> from django.core.urlresolvers import reverse as r
>>> r('django-admindocs-docroot')
Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/rob/django/django-trunk/django/core/urlresolvers.py",
line 254, in reverse
*args, **kwargs)))
  File "/Users/rob/django/django-trunk/django/core/urlresolvers.py",
line 227, in reverse
possibilities = self.reverse_dict.getlist(lookup_view)
  File "/Users/rob/django/django-trunk/django/core/urlresolvers.py",
line 161, in _get_reverse_dict
for name in pattern.reverse_dict:
  File "/Users/rob/django/django-trunk/django/core/urlresolvers.py",
line 154, in _get_reverse_dict
if not self._reverse_dict and hasattr(self.urlconf_module,
'urlpatterns'):
  File "/Users/rob/django/django-trunk/django/core/urlresolvers.py",
line 198, in _get_urlconf_module
self._urlconf_module = __import__(self.urlconf_name, {}, {}, [''])
ImportError: No module named urls
>>> r('django-admindocs-docroot')
Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/rob/django/django-trunk/django/core/urlresolvers.py",
line 254, in reverse
*args, **kwargs)))
  File "/Users/rob/django/django-trunk/django/core/urlresolvers.py",
line 243, in reverse
"arguments '%s' not found." % (lookup_view, args, kwargs))
NoReverseMatch: Reverse for 'django-admindocs-docroot' with arguments
'()' and keyword arguments '{}' not found.


I was suspecting that not having this line in my urls.py was tripping
it up so I added it:

(r'^admin/doc/', include('django.contrib.admindocs.urls')),

A slight difference was observed...

>>> from django.core.urlresolvers import reverse as r
>>> r('django-admindocs-docroot')
Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/rob/django/django-trunk/django/core/urlresolvers.py",
line 254, in reverse
*args, **kwargs)))
  File "/Users/rob/django/django-trunk/django/core/urlresolvers.py",
line 227, in reverse
possibilities = self.reverse_dict.getlist(lookup_view)
  File "/Users/rob/django/django-trunk/django/core/urlresolvers.py",
line 161, in _get_reverse_dict
for name in pattern.reverse_dict:
  File "/Users/rob/django/django-trunk/django/core/urlresolvers.py",
line 154, in _get_reverse_dict
if not self._reverse_dict and hasattr(self.urlconf_module,
'urlpatterns'):
  File "/Users/rob/django/django-trunk/django/core/urlresolvers.py",
line 198, in _get_urlconf_module
self._urlconf_module = __import__(self.urlconf_name, {}, {}, [''])
ImportError: No module named urls
>>> r('django-admindocs-docroot')
'/admin/doc/'

I'll keep poking around a bit and see if I can dig up anything
further.

-Rob
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



cursors and raw sql

2008-12-04 Thread bcurtu

Hi,

i need to perform some Raw SQL queries in my django app. I read in the
doc (http://docs.djangoproject.com/en/dev/topics/db/sql/) I can do sth
like:

def my_custom_sql(self):
from django.db import connection
cursor = connection.cursor()
cursor.execute("SELECT foo FROM bar WHERE baz = %s", [self.baz])
row = cursor.fetchone()
return row

The question is... Do I have to close the cursor?

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Add fields to another app model

2008-12-04 Thread Bojan Mihelac

Hi all!

I am looking for right way to add fields to model that is in another
app. At first I created mysite application and in models.py put

from satchmo.contact.models import Contact
Contact.add_to_class("company_name", models.CharField(max_length =
200))

that raises exception ProgrammingError sometimes:
ProgrammingError: (1110, "Column 'company_name' specified twice")

So now I check before if field is already in model:

if 'company_name' not in Contact._meta.get_all_field_names():
Contact.add_to_class("company_name", models.CharField(max_length =
200))

I have feeling that this is not right way to do. I'd appreciate any
help, hint or thought on this.
I also wonder how models are loaded in django.

Bojan




--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: open source project management app that uses django?

2008-12-04 Thread Margie

Thanks - yes, that is pretty much the approach I am planning to take,
but I just figured I'd see if there was anything interesting out there
that would give me a spiffy look and feel for the reporting pages.
One thing that I find confusing is how to come up with a color
scheme.  I know that seems sort of low priority, but I swear the first
thing people notice is if your colors are "ugly" or very basic looking
(ie, black and white).

Anyway, I will proceed with putting the models together as that is
clearly the meat of the project at this poitn.  I just learned about
CRUD tonight, and I can see how that is very nice.

Thanks,
Margie

On Dec 3, 5:59 pm, maeck <[EMAIL PROTECTED]> wrote:
> Margie,
>
> If you can think up a decent model, you might be able to setup the
> core of the project management application in the Django contrib.admin
> module.
> Development will go fast as long as you can stay with standard CRUD
> pages.
> The admin model will also give you the user security hooks necessary
> for the manager and employees.
>
> As soon as you nee a need for reporting pages or ways to do things a
> little more complex than the admin can give you, you can build custom
> pages for those. But I would think you could have 80% of your app
> running only by setting up the database models and nice admin pages.
>
> Maeck
>
> On Dec 3, 3:41 pm, Margie <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi everyone,
>
> > I would like to create a django project managment web app to be used
> > internally in my company.  I am a software developer, but have little
> > experience with web apps other than my recent work going through the
> > sams django tutorial book.
>
> > I'm wondering if anyone knows of any open source/free django web app
> > that I might be able to use to get started on this project.  Let me
> > describe the usage model to give you an idea of what I'm aiming for.
>
> > At a very high level, the usage model for this web app is that a
> > "manager" assigns tasks to "employees" on a weekly basis. Associated
> > with each task is a set of measurements that must be performed by the
> > employee as he/she does the task.  The measurements vary based on the
> > task, and somemes the measurement is reported with a comment string,
> > sometimes a number, or sometimes a check mark in one of 'n' radio
> > boxes.   As the employees complete the tasks, they fill in the
> > measurements.  At the end of the week, the manager can look at each
> > task and review the resulting measurements, and based on that data,
> > decide the next weeks'  tasks.
>
> > Unlike a project mangament tool like MS Project, which helps you
> > schedule and gannt chart the schedule, this is really a tool to for
> > enhancing project communication.  It is intended to allow the manager
> > to easily communicate tasks to the employees, get the results back,
> > and then make decisions about what the next set of tasks sould be.
> > All without having to spend a lot of time emailing and talking to
> > people.  In the environement where it will be used, the manager is
> > getting results back from maybe 100 different employees, each of which
> > have a few tasks to do.  The data is not complex, but there is just
> > too much of it to manage without a tool.  Currently folks are using
> > wiki and excel, but in my opninion this is not really automated
> > enough.
>
> > My thought is that a django web client could provide a very simple and
> > easy to use interface, and could also be extended to get all sorts of
> > nice long term trend information.  For exmaple, t would be interesting
> > to know if a project being run at site A executes task 'foo' more
> > frequently or for longer periods of time than a project being run at
> > site B.  As data is across multiple similar projects, it seems that it
> > could be mined for lots of interesting info to help improve the
> > productivity of future projects.
>
> > Ok - so hopefully you get the idea.  Now for my questions:
>
> > * Does anyone know of existing web apps (django or otherwise) like
> > that already exists?
>
> > * Does this sound like something that would be good to do in Django?
>
> > * Does anyone know of any free/open source software (django based)
> > that I could use as a starting point?  Not being a web developer, I
> > know that if I do this from scratch, I will probably not do a great
> > job.  No doubt there are a ton of intracacies to window layout, the
> > structure of the models, the html templates, and other things I
> > haven't even thought of.  So I'm thinking it would be great to
> > bootstrap from some existing code, even if it doesn't do quite what I
> > want.  I would be happy to contribute my own work back to the open
> > source community.
>
> > Thanks for any ideas!
>
> > Margie- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this

Re: Solution for use Django with Ejabberd ?

2008-12-04 Thread Jarek Zgoda

Wiadomość napisana w dniu 2008-12-04, o godz. 01:03, przez E:

> I want to use my django website with chat system ( ejabberd ).
> I don't know how to


Not specific to ejabberd (or XMPP at all), but shows how to do basic  
chat using Django and orbited:

http://www.rkblog.rk.edu.pl/w/p/django-and-comet/

This example uses IRC, but apart of protocol the idea should be the  
same with Jabber/XMPP.

-- 
We read Knuth so you don't have to. - Tim Peters

Jarek Zgoda, R&D, Redefine
[EMAIL PROTECTED]


--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---