Re: New tutorial added to Django by Example

2010-08-03 Thread Mario
Thank you for sharing the application. I would like to make the start
day of the week Sunday instead of Monday.

_Mario

On Aug 3, 12:14 am, Rainy  wrote:
> I've added a new tutorial: Calendar App to
> my Django by Example site.  As always, feedback is appreciated.
>
> What would be a good tutorial to do next?
>
>    http://LightBird.net/dbe/
>
>   -ak

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: passing a keyword argument from form to a field in that form

2010-08-03 Thread Daniel Roseman
On Aug 2, 11:06 pm, Jim  wrote:
> Hello,
>
> I have a custom field whose behavior depends on a parameter show_all.
> (It makes the field pull from the database for display only those
> keywords where show=True.)
>
>     class KeywordsField(forms.ChoiceField):
>         def __init__(self, choices=(), required=True,
> widget=widgets.KeywordsWidget, label=None, initial=None,
> show_all=False, help_text=None):
>             self.show_all=show_all
>             super(KeywordsField, self).__init__(choices=self.choices,
> required=required, widget=widget, label=label, initial=initial,
> help_text=help_text)
>
> (edited; I hope I didn't introduce any typos.)
>
> I have a form that I'd like to call as
>     f0=KeywordsForm(show_all=True)
> and pass show_all to the field.  Here is my try.
>
>     class KeywordsForm(forms.Form):
>         keywords=KeywordsField(required=False)
>
>         def __init__(self, show_all=False, *args, **kwargs):
>             self.show_all = show_all
>             super(KeywordsForm, self).__init__(*args, **kwargs)
>             self.fields['keywords'].show_all=show_all
>
> Setting self.fields didn't work (or I wouldn't be writing).  Neither
> did calling this.
>     keywords=KeywordsField(required=False,show_all=self.show_all)
> Neither did a fair amount of looking at the documentation, the source,
> and googling, although no doubt I didn't do it right.
>
> Can someone give me a hint about how I should do it?  I'd be grateful.
> Jim

This code looks absolutely right. What do you mean by 'setting
self.fields didn't work'? How did it not work? What didn't happen that
you expected to happen? Did you get errors?

That is the usual way of dynamically setting an attribute on a field,
and I've used it many times with no problems.
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Need help setting up dynamic options for select (drop down) box of form.

2010-08-03 Thread Daniel Roseman
On Aug 3, 5:04 am, Chris Seberino  wrote:
> I'm trying to make the options of a particular drop down box be
> determined at runtime.
>
> I added a __init__ constructor to my django.forms.Form subclass as
> follows...
>
>         def __init__(self,
>                            data                = None,
>                            error_class         =
> django.forms.util.ErrorList,
>                            manage_sites_domain = None):
>
> """
>
> constructor
>                 """
>
>                 super(InputPostsForm, self).__init__(data,
>                                                      error_class =
> error_class)
>                 if manage_sites_domain:
>                         domain     = manage_sites_domain
>                         site       = SITE.objects.get(domain = domain)
>                         categories = CATEGORY.objects.filter(site =
> site)
>                         choices    = [2 * (e.name,) for e in categories]
>                         pc         = self.fields["post_category"]
>                         pc.widget  = SELECT()
>                         pc.choices = choices
>
> I printed the choices list to verify the list contains a tuple with 2
> strings.
>
> When I view the form in a browser I see a drop down box with NO
> choices.  Or rather, a blank choice.
>
> Chris

I can't read this code at all. What's with all the spaces everywhere?
Why are you using BLOCK CAPITALS for class names?

Anyway, I suspect the cause is setting the widget. I've no idea what
the SELECT widget does - it's not the same as the built-in Select
widget, since Python is case-sensitive - but I would try without that
and see if it now works. If not, please post the code of that widget
class.
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



problem using mod_wsgi with djapian

2010-08-03 Thread watad
dear all

i am using django with apache2 and mod_wsgi with djapian as my search
engine
i have noticed a major issue:

when i use djapian im stuck in a deadlock when i
call any Xapian method or function (this is explained in this ticket
http://trac.xapian.org/ticket/185)
i used the solution posted there for mod_wsgi
i added WSGIApplicationGroup %{GLOBAL} then djapian search started to
work again
but i noticed that my sites css and contents was corrupted and the
content of my sites was mixed, i removed WSGIApplicationGroup %
{GLOBAL}  and the sites was rendering normally again.(of course I am
restarting apache continually)

any suggestion will be appriciated

thanks in advance

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



problem using mod_wsgi with djapian

2010-08-03 Thread watad
dear all

i am using django with apache2 and mod_wsgi with djapian as my search
engine
i have noticed a major issue:

when i use djapian im stuck in a deadlock when i
call any Xapian method or function (this is explained in this ticket
http://trac.xapian.org/ticket/185)
i used the solution posted there for mod_wsgi
i added WSGIApplicationGroup %{GLOBAL} then djapian search started to
work again
but i noticed that my sites css and contents was corrupted and the
content of my sites was mixed, i removed WSGIApplicationGroup %
{GLOBAL}  and the sites was rendering normally again.(of course I am
restarting apache continually)

any suggestion will be appriciated

thanks in advance

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Which program will run when we execute "djano-admin.py startproject mysite" command?

2010-08-03 Thread DZ
win7 can do

2010/8/3 Steve Holden 

> Balu:
>
> This is not a Windows 7-specific issue. There are obviously differences
> between your Windows 7 and Windows XP environments that are cuasing you
> to see this message.
>
> As has already been pointed out, you need to make sure that the
> directory containing django-admin.py is on your PATH, and that your
> system is conditioned to run the Python interpreter on programs with the
> ".py" extension.
>
> Otherwise you need to run
>
> python c:\PythonXX\Scripts\django-admin.py ...
>
> and make sure that the Python interpreter is found on your path.
>
> regards
>  Steve
>
> On 8/2/2010 12:03 PM, balu wrote:
> > Hi Jirka
> >
> > First of all let me thank you for replying to my question. I did as
> > you said. But that also not working. If you don't mine please try this
> > in Windows 7 operating system.
> >
> > Thank you
> > Balu
> >
> > On Aug 1, 11:16 pm, Jirka Vejrazka  wrote:
> >> Hi Balu,
> >>
> >>django-admin.py uis copied to C:\Python2x\Scripts on your PC
> >> (depending on the specific Python version). This is not typically on
> >> you system path, so Windows can't find it.
> >>
> >>   A simple solution is to copy or move the django-admin.py from
> >> Scripts subdir to C:\Python2x (where python.exe resides.
> >>
> >>   Cheers
> >>
> >>  Jirka
> >>
> >> On 01/08/2010, balu  wrote:> Thank you. I could able
> to run python programs well using the Python
> >>> GUI. It is the problem raised when I tried to execute "django-admin.py
> >>> startproject mysite" command on Windows 7
> >>
> >>> On Aug 1, 9:26 pm, Karen Tracey  wrote:
>  On Sun, Aug 1, 2010 at 11:47 AM, balu  wrote:
> > Still I couldn't made it on window 7. May be it is incompatible with
> > Django
> >>
>  I don't have Windows 7 to test, but the problem you are describing
>  (Windows
>  not knowing what executable is associated with .py files) is not a
>  Django-specific problem: it would affect any Python application.
> >>
>  You might have better luck if you search generally on getting the
> python
>  executable properly associated with the .py file extension on Windows
> 7.
> >>
>  The alternative way of running the command, that is including "python"
> at
>  the front of the command, requires that the path to the python.exe
> file be
>  included in your windows PATH. So if you cannot find out how to get
> the
>  .py
>  file association set up properly, you could instead figure out where
>  python.exe is add that directory to your PATH.
> >>
>  Karen
>  --http://tracey.org/kmt/
> >>
> >>> --
> >>> You received this message because you are subscribed to the Google
> Groups
> >>> "Django users" group.
> >>> To post to this group, send email to django-us...@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> django-users+unsubscr...@googlegroups.com
> .
> >>> For more options, visit this group at
> >>> http://groups.google.com/group/django-users?hl=en.
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: passing a keyword argument from form to a field in that form

2010-08-03 Thread Jim
On Aug 3, 3:59 am, Daniel Roseman  wrote:
> This code looks absolutely right.

Boy there's a phrase I don't hear often!

> What do you mean by 'setting
> self.fields didn't work'? How did it not work? What didn't happen that
> you expected to happen? Did you get errors?

If I put in a statement logging the value of self.show_all, it is
unaffected by whether I call KeywordsForm as
KeywordsForm(show_all=True) or KeywordsForm(show_all=False).

> That is the usual way of dynamically setting an attribute on a field,
> and I've used it many times with no problems.

Thank you, Daniel; it is helpful to know that I have the right
approach but must have a bug somewhere.  I'll have another whack at
it-- sometimes a nights sleep makes plain some imbecility on my
part.  :-)

Jim

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Large static files served through django come out ~1kb short

2010-08-03 Thread Tom
This was a problem with my antivirus! Turning it off fixed the
problem. If anyone runs into this problem again the antivirus that
caused it is ESET NOD32 4.0.474.

Tom

On Aug 2, 5:36 pm, ashwoods  wrote:
> try looking if there is something like that in the bugtracker, and if
> not, you can help a lot by filing a bug, if posible with some sample
> files.
> thx.
>
> cheers,
> ashley
>
> On Aug 2, 7:29 pm, Tom  wrote:
>
>
>
> > I am using django.views.static.serve() from a fresh project. The only
> > change I made was based on this 
> > tutorialhttp://docs.djangoproject.com/en/dev/howto/static-files/
> > . When I download a large (60-75mb) 7zip file the size of the file is
> > ~1kb smaller than the actual length. The downloaded size is also
> > nondeterministic. For example one file is 66,560,297 bytes and when I
> > downloaded it I got 66,559,372 bytes and 66,559,940 bytes. The
> > download goes quickly and then pauses at 99% done for a while and then
> > finishes. I can't reproduce this on a 7zip file smaller than 60mb.
>
> > I'm using django 1.2.1 on windows 7 and chrome. When I use firefox I
> > get the error:
> > ".part could not be saved, because the source file
> > could not be read.
>
> > Try again later, or contact the server administrator."
>
> > I don't have a place to upload an example file, but the file was
> > generated by writing a bunch of random numbers to a file then
> > compressing it with 7zip so that the resulting file was ~64mb.
>
> > Thanks!
> > Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django.contrib.auth

2010-08-03 Thread Seaky
Hi,

I want to modify type of hash by default in auth (sha1 -> md5) and
change name of the table/model.
It's possible ?

Thanks.
Seak

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



is it possible to pass a dynamic list of choices to a select widget?

2010-08-03 Thread shofty
consider the following code as part of an online shop (im sort of
working through jim mcgaws ecommerce book).
in the view

if product.has_options:
form = ProductSizeOptionsAddToCartForm(request=request,
label_suffix=':')
else:
form = ProductAddToCartForm(request=request, label_suffix=':')

then in the forms.py

def create_choices():
if self.product:
options = self.product.options
output = [u'(']
for k, v in self.product.options:
option_value = smart_unicode(k)
option_label = smart_unicode(v)
output.append(u"('%s','%s'),")
output.append(')')
return output

class ProductSizeOptionsAddToCartForm(forms.Form):
quantity =
forms.IntegerField(widget=forms.TextInput(attrs={'size':'2',
'value':'1', 'class':'quantity', 'maxlength':'5'}),
error_messages={'invalid':'Please enter a valid quantity.'},
min_value=1)
size_option =
forms.CharField(widget=forms.Select(choices=create_choices))
product_slug = forms.CharField(widget=forms.HiddenInput())


I have tried to write a function that is called from the Select widget
and i get the "'function' object is not iterable" error message, which
is quite obvious. what if every product doesn't have the same options
as CLOTHING_CHOICES list? I've been trying to work out how to store
the options in the db (product.options as a comma separated CharField)
and then pass them into the form as part of the product view.

Anyone done anything like this?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django, Rails but a cost to pay ?

2010-08-03 Thread didier rano
What do you think about this post ?
http://blog.skeedy.com/django-rails-but-a-cost-to-pay

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django, Rails but a cost to pay ?

2010-08-03 Thread Masklinn
On 2010-08-03, at 16:19 , didier rano wrote:
> What do you think about this post ?
> http://blog.skeedy.com/django-rails-but-a-cost-to-pay
That it's empty and useless, and solely written for getting hits.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: is it possible to pass a dynamic list of choices to a select widget?

2010-08-03 Thread Steve Holden
On 8/3/2010 10:05 AM, shofty wrote:
> consider the following code as part of an online shop (im sort of
> working through jim mcgaws ecommerce book).
> in the view
> 
> if product.has_options:
> form = ProductSizeOptionsAddToCartForm(request=request,
> label_suffix=':')
> else:
> form = ProductAddToCartForm(request=request, label_suffix=':')
> 
> then in the forms.py
> 
> def create_choices():
> if self.product:
> options = self.product.options
> output = [u'(']
> for k, v in self.product.options:
> option_value = smart_unicode(k)
> option_label = smart_unicode(v)
> output.append(u"('%s','%s'),")
> output.append(')')
> return output
> 
> class ProductSizeOptionsAddToCartForm(forms.Form):
> quantity =
> forms.IntegerField(widget=forms.TextInput(attrs={'size':'2',
> 'value':'1', 'class':'quantity', 'maxlength':'5'}),
> error_messages={'invalid':'Please enter a valid quantity.'},
> min_value=1)
> size_option =
> forms.CharField(widget=forms.Select(choices=create_choices))
> product_slug = forms.CharField(widget=forms.HiddenInput())
> 
> 
> I have tried to write a function that is called from the Select widget
> and i get the "'function' object is not iterable" error message, which
> is quite obvious. what if every product doesn't have the same options
> as CLOTHING_CHOICES list? I've been trying to work out how to store
> the options in the db (product.options as a comma separated CharField)
> and then pass them into the form as part of the product view.
> 
> Anyone done anything like this?
> 
It isn't clear to me why you aren't using a ChoiceField here, which
would seem to make more sense than a CharField.

If you used a ChoiceField then you could supply choices directly to it,
and those choices could in turn be passed to the __init__() method of
your form (which would also need to call forms.Form.__init__() to ensure
the necessary initializations occurred).

That way, as long as you instantiate the form each time it is used
(clearly you can't expect to use the same form with different choices -
tweaking an exisint form that way isn't advisable).

The choices object needs to be an iterable (tuple or list, usually) of
(value, display) pairs, so the only way that your function might work is
if you applied eval() to the current return value, but again that's an
unnecessary complication. Also note that your create_choices() function
returns None if the product has no choices. The choices value needs to
be the result of a *call* to some function, not a function.

Further, it's not really clear from the code you present whether
create_choices() is supposed to be a function or a method. It refers to
self, but it's not obvious how that reference is satisfied. If it's a
form method then it should take self as an argument.

So it's hard to suggest what will work, but I hope I have given you a
few pointers as to why your current code doesn't. Work through it slowly
and deliberately and you'll get there in the end.

regards
 Steve

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Good practices for storing "constant" values?

2010-08-03 Thread derek
I am currently using two files - constants.py and choices.py to store
all the "fixed" (and also-to-be-translated) data that I use in my
app.  I am now wondering:

(a) is this a good/worthwhile/common thing to do?

(b) should I be doing the same for other fixed strings, even if they
do not need to be translated e.g. custom SQL code that is used in
other files (the idea being that there is one place to look to find
everything - particularly useful if the models+database change in some
way)

Thanks
Derek

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django, Rails but a cost to pay ?

2010-08-03 Thread Javier Guerra Giraldez
On Tue, Aug 3, 2010 at 9:23 AM, Masklinn  wrote:
> On 2010-08-03, at 16:19 , didier rano wrote:
>> What do you think about this post ?
>> http://blog.skeedy.com/django-rails-but-a-cost-to-pay
> That it's empty and useless, and solely written for getting hits.

add to that terrible grammar and disconnected discourse.  it reads
like a bunch of SMS messages.

-- 
Javier

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django, Rails but a cost to pay ?

2010-08-03 Thread Steve Holden
On 8/3/2010 10:19 AM, didier rano wrote:
> What do you think about this post
> ? http://blog.skeedy.com/django-rails-but-a-cost-to-pay

I'd say the whole thing looks like flame bait. When it isn't wrong it's
obvious, and when it isn't obvious it's wrong.

regards
 Steve

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django.contrib.auth

2010-08-03 Thread euan.godd...@googlemail.com
Why would you want to do such a thing? md5 is very week compared to
sha1 and has known vulnerabilities, e.g.
http://searchsecurity.techtarget.com/news/article/0,289142,sid14_gci1430587,00.html

On Aug 3, 2:45 pm, Seaky  wrote:
> Hi,
>
> I want to modify type of hash by default in auth (sha1 -> md5) and
> change name of the table/model.
> It's possible ?
>
> Thanks.
> Seak

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django.contrib.auth

2010-08-03 Thread Seaky
Thanks,
I know it but I would this it is possible to do it and how?

je suis au courant mais je voudrais juste savoir si il est possible de
le faire, si oui comment?

On 3 août, 16:45, "euan.godd...@googlemail.com"
 wrote:
> Why would you want to do such a thing? md5 is very week compared to
> sha1 and has known vulnerabilities, 
> e.g.http://searchsecurity.techtarget.com/news/article/0,289142,sid14_gci1...
>
> On Aug 3, 2:45 pm, Seaky  wrote:
>
>
>
> > Hi,
>
> > I want to modify type of hash by default in auth (sha1 -> md5) and
> > change name of the table/model.
> > It's possible ?
>
> > Thanks.
> > Seak

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



help

2010-08-03 Thread André Asantos
I am totaly new to Python world...

I would like to konw:

1- py is Python class extension?
2-does django have any similar .jsp GUI? or is only use HTML for GUI?
3-is netbeans IDE the best IDE?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django, Rails but a cost to pay ?

2010-08-03 Thread Alexandre González
I think that this argument is stupid: "Be part of a small and smart
community. Finally, we think to be special ;) “Think different” then I have
an iPhone, MacBook Air… "

Ok, be part of a community is the best, but compare the FLOSS community with
the "Think different"...

On Tue, Aug 3, 2010 at 16:28, Steve Holden  wrote:

> On 8/3/2010 10:19 AM, didier rano wrote:
> > What do you think about this post
> > ? http://blog.skeedy.com/django-rails-but-a-cost-to-pay
>
> I'd say the whole thing looks like flame bait. When it isn't wrong it's
> obvious, and when it isn't obvious it's wrong.
>
> regards
>  Steve
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
and/or .pptx
http://mirblu.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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: help

2010-08-03 Thread Maksymus007
1 - no
2 - no
3 - no

On Tue, Aug 3, 2010 at 4:57 PM, André Asantos  wrote:
> I am totaly new to Python world...
>
> I would like to konw:
>
> 1- py is Python class extension?
> 2-does django have any similar .jsp GUI? or is only use HTML for GUI?
> 3-is netbeans IDE the best IDE?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: help

2010-08-03 Thread André A . Santos
and how's your point of you abuot my questions in more detail?

On Tue, Aug 3, 2010 at 12:00 PM, Maksymus007  wrote:

> 1 - no
> 2 - no
> 3 - no
>
> On Tue, Aug 3, 2010 at 4:57 PM, André Asantos 
> wrote:
> > I am totaly new to Python world...
> >
> > I would like to konw:
> >
> > 1- py is Python class extension?
> > 2-does django have any similar .jsp GUI? or is only use HTML for GUI?
> > 3-is netbeans IDE the best IDE?
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> > For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
André Asantos
Skype - andredecotia
MSN - andre_deco...@hotmail.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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: New tutorial added to Django by Example

2010-08-03 Thread Rainy


On Aug 3, 3:27 am, Mario  wrote:
> Thank you for sharing the application. I would like to make the start
> day of the week Sunday instead of Monday.
>
> _Mario

All you have to do use calendar module's method to
set starting day of week:

calendar.setfirstweekday(calendar.SUNDAY)

(and update template).

 -ak

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: help

2010-08-03 Thread Franklin Einspruch
Here's more detail:

http://docs.python.org/release/2.5.2/tut/tut.html

Enjoy! It's a great language.

Franklin

On Tue, Aug 3, 2010 at 11:03 AM, André A. Santos
 wrote:
> and how's your point of you abuot my questions in more detail?
>
> On Tue, Aug 3, 2010 at 12:00 PM, Maksymus007  wrote:
>>
>> 1 - no
>> 2 - no
>> 3 - no
>>
>> On Tue, Aug 3, 2010 at 4:57 PM, André Asantos 
>> wrote:
>> > I am totaly new to Python world...
>> >
>> > I would like to konw:
>> >
>> > 1- py is Python class extension?
>> > 2-does django have any similar .jsp GUI? or is only use HTML for GUI?
>> > 3-is netbeans IDE the best IDE?
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Django users" group.
>> > To post to this group, send email to django-us...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/django-users?hl=en.
>> >
>> >
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> --
> André Asantos
> Skype - andredecotia
> MSN - andre_deco...@hotmail.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-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Art, writing, journal: http://einspruch.com
Comics: http://themoonfellonme.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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Flexigrid

2010-08-03 Thread Gonzalo Delgado
El 02/08/10 12:45, Ramesh escribió:
> It looks like you are just showing me how to search on google which I
> already did but couldn't find the solution I was looking for.
>
> I am still looking forward for the help on flexigrid for my project. I
> really appreciate your help.
>   

The first result I get searching with Google turns up a snippet for
integrating Flexigrid into Django[0], did you try that?

[0] http://snippets.dzone.com/posts/show/6917

-- 
Gonzalo Delgado 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: New tutorial added to Django by Example

2010-08-03 Thread Rainy


On Aug 3, 2:25 am, Nikhil Somaru  wrote:
> How to set up a virtual python/django installation
>

There is already a tutorial for this here:

http://codytaylor.org/2010/07/django-on-dreamhost-virtual-python-install.html

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: is it possible to pass a dynamic list of choices to a select widget?

2010-08-03 Thread shofty
Steve,

the choices are different for each product in the shop.
some choices are clothing sizes, some physical sizes etc.

So with that in mind i could go with a bunch of choices hooked up to a
choices field if i can tell the form which choice field to use based
around the product attribute stored.

but what if im not the shop admin?
in that case i'd have to amend the code every time something goes out
of stock in a certain size.

so i came upon the plan to have a boolean denote whether or not the
object has a size option and if so store the options in the model so
that it could be amended in the admin pages. then draw a select at
runtime with the right options in it.

thanks for the other pointers, i had an idea the function wasn't right
and indeed it isn't going to work at all since the widget won't allow
a callable.

i'll try turning that function into a method on the form and see if it
won't work that way

Matt

On 3 Aug, 15:26, Steve Holden  wrote:
> On 8/3/2010 10:05 AM, shofty wrote:
>
> > consider the following code as part of an online shop (im sort of
> > working through jim mcgaws ecommerce book).
> > in the view
>
> > if product.has_options:
> >     form = ProductSizeOptionsAddToCartForm(request=request,
> > label_suffix=':')
> > else:
> >     form = ProductAddToCartForm(request=request, label_suffix=':')
>
> > then in the forms.py
>
> > def create_choices():
> >     if self.product:
> >         options = self.product.options
> >         output = [u'(']
> >         for k, v in self.product.options:
> >             option_value = smart_unicode(k)
> >             option_label = smart_unicode(v)
> >             output.append(u"('%s','%s'),")
> >         output.append(')')
> >         return output
>
> > class ProductSizeOptionsAddToCartForm(forms.Form):
> >     quantity =
> > forms.IntegerField(widget=forms.TextInput(attrs={'size':'2',
> > 'value':'1', 'class':'quantity', 'maxlength':'5'}),
> > error_messages={'invalid':'Please enter a valid quantity.'},
> > min_value=1)
> >     size_option =
> > forms.CharField(widget=forms.Select(choices=create_choices))
> >     product_slug = forms.CharField(widget=forms.HiddenInput())
>
> > I have tried to write a function that is called from the Select widget
> > and i get the "'function' object is not iterable" error message, which
> > is quite obvious. what if every product doesn't have the same options
> > as CLOTHING_CHOICES list? I've been trying to work out how to store
> > the options in the db (product.options as a comma separated CharField)
> > and then pass them into the form as part of the product view.
>
> > Anyone done anything like this?
>
> It isn't clear to me why you aren't using a ChoiceField here, which
> would seem to make more sense than a CharField.
>
> If you used a ChoiceField then you could supply choices directly to it,
> and those choices could in turn be passed to the __init__() method of
> your form (which would also need to call forms.Form.__init__() to ensure
> the necessary initializations occurred).
>
> That way, as long as you instantiate the form each time it is used
> (clearly you can't expect to use the same form with different choices -
> tweaking an exisint form that way isn't advisable).
>
> The choices object needs to be an iterable (tuple or list, usually) of
> (value, display) pairs, so the only way that your function might work is
> if you applied eval() to the current return value, but again that's an
> unnecessary complication. Also note that your create_choices() function
> returns None if the product has no choices. The choices value needs to
> be the result of a *call* to some function, not a function.
>
> Further, it's not really clear from the code you present whether
> create_choices() is supposed to be a function or a method. It refers to
> self, but it's not obvious how that reference is satisfied. If it's a
> form method then it should take self as an argument.
>
> So it's hard to suggest what will work, but I hope I have given you a
> few pointers as to why your current code doesn't. Work through it slowly
> and deliberately and you'll get there in the end.
>
> regards
>  Steve

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: help

2010-08-03 Thread Steve Holden
On 8/3/2010 11:03 AM, André A. Santos wrote:
> and how's your point of you abuot my questions in more detail?
> 
> On Tue, Aug 3, 2010 at 12:00 PM, Maksymus007  > wrote:
> 
> 1 - no
> 2 - no
> 3 - no
> 
> On Tue, Aug 3, 2010 at 4:57 PM, André Asantos
> mailto:ti.andreasan...@gmail.com>> wrote:
> > I am totaly new to Python world...
> >
> > I would like to konw:
> >
> > 1- py is Python class extension?
> > 2-does django have any similar .jsp GUI? or is only use HTML for GUI?
> > 3-is netbeans IDE the best IDE?

I suspect the simplistic answers were given as a hint that the questions
themselves were simplistic.

It only takes half a day for an experienced programmer to pick up enough
Python from the tutorial to learn the answers to the first question. The
other two, what more could you expect?

Django is purely a web-based framework, so of course it uses HTML/CSS to
style the user interface. Python does have several GUI systems (Tkinter,
wxPython, Pyqt), but none of them are usable in a Django-bases system
(though there is nothing to stop GUI based programs using the same
database).

Netbeans is OK, but how does this relate to Python or Django? Both Wing
IDE (commercial) and Eclipse/pydev (open source) offer excellent support
for creating and debugging Django apps.

regards
 Steve

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: is it possible to pass a dynamic list of choices to a select widget?

2010-08-03 Thread Steve Holden
On 8/3/2010 11:12 AM, shofty wrote:
> Steve,
> 
> the choices are different for each product in the shop.
> some choices are clothing sizes, some physical sizes etc.
> 
> So with that in mind i could go with a bunch of choices hooked up to a
> choices field if i can tell the form which choice field to use based
> around the product attribute stored.
> 
> but what if im not the shop admin?
> in that case i'd have to amend the code every time something goes out
> of stock in a certain size.
> 
> so i came upon the plan to have a boolean denote whether or not the
> object has a size option and if so store the options in the model so
> that it could be amended in the admin pages. then draw a select at
> runtime with the right options in it.
> 
> thanks for the other pointers, i had an idea the function wasn't right
> and indeed it isn't going to work at all since the widget won't allow
> a callable.
> 
> i'll try turning that function into a method on the form and see if it
> won't work that way
> 
Good stuff. This is a pretty helpful group, so do post again when you
have further issues. Nobody gets it right the first time ...

regards
 Steve

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django, Rails but a cost to pay ?

2010-08-03 Thread didier rano
I am very surprise about these aggressive answers. Ok, my english is very
bad ! I know. I'd like to be better. But I'd like to share my opinion with
Django community.

I am a Python, Java, Ruby, .NET, C developer. There are some advantages to
use each of them, but not only advantages with Python and Ruby.

Be respectful should be normal in open source community, no ?

Thanks


2010/8/3 Alexandre González 

> I think that this argument is stupid: "Be part of a small and smart
> community. Finally, we think to be special ;) “Think different” then I have
> an iPhone, MacBook Air… "
>
> Ok, be part of a community is the best, but compare the FLOSS community
> with the "Think different"...
>
> On Tue, Aug 3, 2010 at 16:28, Steve Holden  wrote:
>
>> On 8/3/2010 10:19 AM, didier rano wrote:
>> > What do you think about this post
>> > ? http://blog.skeedy.com/django-rails-but-a-cost-to-pay
>>
>> I'd say the whole thing looks like flame bait. When it isn't wrong it's
>> obvious, and when it isn't obvious it's wrong.
>>
>> regards
>>  Steve
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>
>
> --
> Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
> and/or .pptx
> http://mirblu.com
>



-- 
Didier Rano
didier.r...@gmail.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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



change SelectDateWidget() display format

2010-08-03 Thread pengbo xue
i use function SelectDateWidget() in form,it display date format on web page
by moth-date-year,what can i do for it display date format  by
year-month-date?

-- 

cowboy

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django, Rails but a cost to pay ?

2010-08-03 Thread Masklinn
On 2010-08-03, at 17:37 , didier rano wrote:
> I am very surprise about these aggressive answers.
None of the answers are aggressive. You asked for opinions on the post you 
linked, they were provided and pretty dispassionate as far as I can tell.

> I am a Python, Java, Ruby, .NET, C developer. There are some advantages to
> use each of them, but not only advantages with Python and Ruby.
Uh… so what?

> Be respectful should be normal in open source community, no ?
Since you're apparently the author of the post you linked, you might want to 
take this advice for yourself. In your writing and your self-promotion both.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django error can't adapt

2010-08-03 Thread Daniel França
anyone?

2010/8/1 Daniel França :
> Hi, I'm not running on Apache, just trying to run in the django
> standalone server
>
> On Sun, Aug 1, 2010 at 5:47 AM, Antoni Aloy  wrote:
>> 2010/8/1 Daniel França :
>>> Hi,
>>> I just migrated from Linux to Mac OS, and I'm getting an error message
>>> when I try register a new user of my django site, (at my page)
>>> I get the error: can't adapt type 'US/Eastern'
>>> I'm using Postgresql and psycopg2, I tried to change the TIME_ZONE to
>>> 'America/Sao_Paulo'(I'm in Brazil), but the error still happens.
>>>
>>> I tried anothers possibilities of TIME_ZONE but no success.
>>>
>>> Anyone know how to solve that?
>>>
>>> Best Regards,
>>> Daniel França
>>>
>> Do you have more than one django instance on mod_python? If this is
>> the case it's a bug with mod_python and Postgres. Change to wsgi and
>> the problem would dissapear.
>>
>> Hope it helps!
>>
>>
>> --
>> Antoni Aloy López
>> Blog: http://trespams.com
>> Site: http://apsl.net
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django, Rails but a cost to pay ?

2010-08-03 Thread Joshua D. Drake
On Tue, 2010-08-03 at 10:28 -0400, Steve Holden wrote:
> On 8/3/2010 10:19 AM, didier rano wrote:
> > What do you think about this post
> > ? http://blog.skeedy.com/django-rails-but-a-cost-to-pay
> 
> I'd say the whole thing looks like flame bait. When it isn't wrong it's
> obvious, and when it isn't obvious it's wrong.

Well the blog certainly has issues but it has valid points. Specifically
in things like finding developers. No it is not difficult to find a
Django developer, but you do have to look.

All I have to do is spit and I will hit a dozen Java developers.
(Really, I have done it, its funny to see the look on their face).

Sincerely,

Joshua D. Drake

> 
> regards
>  Steve
> 

-- 
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 509.416.6579
Consulting, Training, Support, Custom Development, Engineering
http://twitter.com/cmdpromptinc | http://identi.ca/commandprompt

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



generic view error help

2010-08-03 Thread yalda.nasirian
hi every body
i did all of steps of djangoproject.com but in last step when i want
to see my generic view i have error
this is my project link :

http://www.4shared.com/file/fOrKUIyM/mysite.html

 please help me but don't forget to change template dir in your
system .
tanx

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django, Rails but a cost to pay ?

2010-08-03 Thread Masklinn
On 2010-08-03, at 18:31 , Joshua D. Drake wrote:
> On Tue, 2010-08-03 at 10:28 -0400, Steve Holden wrote:
>> On 8/3/2010 10:19 AM, didier rano wrote:
>>> What do you think about this post
>>> ? http://blog.skeedy.com/django-rails-but-a-cost-to-pay
>> 
>> I'd say the whole thing looks like flame bait. When it isn't wrong it's
>> obvious, and when it isn't obvious it's wrong.
> 
> Well the blog certainly has issues but it has valid points. Specifically
> in things like finding developers. No it is not difficult to find a
> Django developer, but you do have to look.
> 
> All I have to do is spit and I will hit a dozen Java developers.
> (Really, I have done it, its funny to see the look on their face).

Yes, but that is a fallacy because it only works if what you want are warm 
bodies to sell to a client. It doesn't help you anywhere as much if you want 
good developers, and in any case good developers can get up to speed quite fast 
on new languages (especially languages whose concepts are pretty close to the 
ones they already know, it's not like you're taking a VB6 dev and trying to get 
him productive in Haskell or Prolog).

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



convert mysql database tables into classes of model.py file

2010-08-03 Thread Jagdeep Singh Malhi
I have the backup of mysql database with tables and fields data.
I want to use these  tables and fields to create the classes in
model.py file for django.

Is it possible?
Is any tool and script for convert the database tables with fields
into a modey.py to create class?

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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: convert mysql database tables into classes of model.py file

2010-08-03 Thread Steve Holden
On 8/3/2010 12:53 PM, Jagdeep Singh Malhi wrote:
> I have the backup of mysql database with tables and fields data.
> I want to use these  tables and fields to create the classes in
> model.py file for django.
> 
> Is it possible?
> Is any tool and script for convert the database tables with fields
> into a modey.py to create class?
> 
> Thanks
> 
http://docs.djangoproject.com/en/dev/ref/django-admin/#inspectdb

You should expect to perform some tweaking on the output, however, as
it's difficult for the system to introspect every detail.

regards
 Steve

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: root_path in admin sites is None

2010-08-03 Thread Filip Gruszczyński
I have set:

admin.site.root = ''

in settings.py and this helped. I can't right now check publishing
server (I am sick at home), but I know, that we are using mod_wsgi and
I am pretty sure, that we use Django 1.2 (at least I have username
with a dot there, which wasn't possible earlier ;-)).

Is there a better way other than setting admin.site.root myself?

2010/7/24 Gautier :
> do you still have this problem?
>
> If so, can you tell how do you publish your django application (Apache/
> mod_wsgi ...), and check that you actually use Django 1.2.
>
> And if you don't please tell it too, so that the ticket you opened can
> be closed.
>
> Cheers
>
> On Jun 23, 6:00 pm, Filip Gruszczyński  wrote:
>> > before: ('^admin/(.*)',admin.site.root),
>>
>> > after: (r'^admin/', include(admin.site.urls)),
>>
>> Well, I had to change it before and about two weeks ago I changed it
>> too (this is how my urls.py looks like):
>>
>>     (r'^admin/doc/', include('django.contrib.admindocs.urls')),
>>     # (r'^admin/(.*)',admin.site.root),
>>     (r'^admin/', include(admin.site.urls)),
>>
>> It solved some other problems (admindidn't work at all), but I still
>> have the problems with links inadminsite.
>>
>>
>>
>>
>>
>> > it work good now!!!
>>
>> > bye
>>
>> > 2010/6/23 Filip Gruszczyński 
>>
>> >> After migrating to 1.2 I encountered a problem inadminpanel. My
>> >> change password ang logout links look like this:
>>
>> >>https://example.com/admin/Nonelogout/
>> >>https://example.com/admin/Nonepassword_change/
>>
>> >> I have taken a look into django source and it seems, thatroot_pathis
>> >> None (at least this variable is rendered in those urls). What I might
>> >> have forgotten to set and how can I change it to an empty string?
>>
>> >> --
>> >> Filip Gruszczyński
>>
>> >> --
>> >> You received this message because you are subscribed to the Google Groups
>> >> "Django users" group.
>> >> To post to this group, send email to django-us...@googlegroups.com.
>> >> To unsubscribe from this group, send email to
>> >> django-users+unsubscr...@googlegroups.com.
>> >> For more options, visit this group at
>> >>http://groups.google.com/group/django-users?hl=en.
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups
>> > "Django users" group.
>> > To post to this group, send email to django-us...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> >http://groups.google.com/group/django-users?hl=en.
>>
>> --
>> Filip Gruszczyński
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>



-- 
Filip Gruszczyński

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django.contrib.auth

2010-08-03 Thread Eric Chamberlain

On Aug 3, 2010, at 6:45 AM, Seaky wrote:

> Hi,
> 
> I want to modify type of hash by default in auth (sha1 -> md5) and
> change name of the table/model.
> It's possible ?
> 

It's possible, but modifying django.contrib.auth can be a pain, other apps rely 
on it a lot.

It sounds like what you really want is a custom authentication backend so that 
you can authenticate against an existing table with MD5 passwords.

--
Eric Chamberlain




-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django, Rails but a cost to pay ?

2010-08-03 Thread James Bennett
On Tue, Aug 3, 2010 at 9:19 AM, didier rano  wrote:
> What do you think about this post
> ? http://blog.skeedy.com/django-rails-but-a-cost-to-pay

I think...

* A community, but it is not so easy to find developers compared to Java or .NET

True, but finding *good* developers in any language, which is the real
goal no matter what you're working with, is so difficult people write
whole books on it and *still* fail.

* With dynamic languages, we cannot use powerful IDE as Visual Studio.
It is not a problem for me, but some developers like completion,
compilation…

Eclipse/PyDev will do this. Komodo will do this. Aptana will do this.
Visual Studio will do it with IronPython. Shall we continue the list
of IDEs which work with dynamic languages and offer all the crutches
people are used to?

* Quality check tools are less powerful because dynamic languages

Just in the Python world, PyLint, Cheesecake, coverage.py and quite a
few other quality-checking libraries would like to have a word with
you, along with approximately eight zillion testing frameworks,
harnesses and mock-object libraries.

* Difficult to use Java or .NET libraries. Example: A lot of analytics
semantic libraries exist in Java, but not in Python.

So use Jython, which lets you blend together Python code and Java
libraries any way you like, and even lets you deploy your Python
applications as Java WAR files. Or IronPython which does pretty much
the same with .NET.

* Small and smart community then some developers could be arrogant, be
“the chosen one”.

Says the guy who's been factually wrong on every technical statement
he's made about Python so far in this post?

* “Religions” wars are useless…

And of course, no Java developers or .NET developers ever have silly
or pointless arguments. Only people who use dynamic languages do
that... or something?

* A lot of freelance developers, but startups needs to have internal
developers too.

Doesn't this contradict the first point? "It's so hard to find
developers" versus "wow, there are so many developers I can contract
with".

In other words, this is poorly researched, factually wrong on most of
its points, arguably self-contradictory... and you expected people not
to argue with you about it?

2/10. Do better next time.


-- 
"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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django, Rails but a cost to pay ?

2010-08-03 Thread Masklinn
On 2010-08-03, at 19:18 , James Bennett wrote:
> 
> * With dynamic languages, we cannot use powerful IDE as Visual Studio.
> It is not a problem for me, but some developers like completion,
> compilation…
> 
> Eclipse/PyDev will do this. Komodo will do this. Aptana will do this.
> Visual Studio will do it with IronPython. Shall we continue the list
> of IDEs which work with dynamic languages and offer all the crutches
> people are used to?

Though, to be fair and even when IDEs were specifically invented during the 
development of a dynamically typed programming language (Smalltalk-80), 
dynamically typed languages won't have the completion precision of a statically 
typed language.

On the other hand, that's an argument for going far beyond crummy languages 
such as Java or C#, not to stop there.

Also, you forgot the up-and-coming PyCharm in your list ;)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: renaming database constraint names

2010-08-03 Thread Ian
On Aug 2, 8:42 am, Shirley Cohen  wrote:
> Hi,
>
> I was wondering if anyone has ever tried to rename the database
> constraint names that are created by Django? In particular, I'm
> working with Oracle and would like to rename all the SYS_C* constraint
> names in my Django schema to something more descriptive. If anyone has
> any experience with that and has some suggestions on how to do it, I'd
> love to hear from you.
>
> Thanks,
>
> Shirley

In a dbshell:

ALTER TABLE tablename RENAME CONSTRAINT old_name TO new_name;

HTH,
Ian

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Need help setting up dynamic options for select (drop down) box of form.

2010-08-03 Thread Chris Seberino


On Aug 3, 3:29 am, Daniel Roseman  wrote:
> Anyway, I suspect the cause is setting the widget.

I found my bug.  To convert a textbox to a drop down box, it isn't
enough to reset the widget and choices settings.  It is also necessary
of course to reset the field type from a CharField to a ChoicesField.

All the best,

Chris

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django, Rails but a cost to pay ?

2010-08-03 Thread Ramdas S
On Tue, Aug 3, 2010 at 10:48 PM, James Bennett wrote:

> On Tue, Aug 3, 2010 at 9:19 AM, didier rano  wrote:
> > What do you think about this post
> > ? http://blog.skeedy.com/django-rails-but-a-cost-to-pay
>
> I think...
>
> * A community, but it is not so easy to find developers compared to Java or
> .NET
>
> True, but finding *good* developers in any language, which is the real
> goal no matter what you're working with, is so difficult people write
> whole books on it and *still* fail.
>
> * With dynamic languages, we cannot use powerful IDE as Visual Studio.
> It is not a problem for me, but some developers like completion,
> compilation…
>
> Eclipse/PyDev will do this. Komodo will do this. Aptana will do this.
> Visual Studio will do it with IronPython. Shall we continue the list
> of IDEs which work with dynamic languages and offer all the crutches
> people are used to?
>
> * Quality check tools are less powerful because dynamic languages
>
> Just in the Python world, PyLint, Cheesecake, coverage.py and quite a
> few other quality-checking libraries would like to have a word with
> you, along with approximately eight zillion testing frameworks,
> harnesses and mock-object libraries.
>
> * Difficult to use Java or .NET libraries. Example: A lot of analytics
> semantic libraries exist in Java, but not in Python.
>
> So use Jython, which lets you blend together Python code and Java
> libraries any way you like, and even lets you deploy your Python
> applications as Java WAR files. Or IronPython which does pretty much
> the same with .NET.
>
> * Small and smart community then some developers could be arrogant, be
> “the chosen one”.
>
> Says the guy who's been factually wrong on every technical statement
> he's made about Python so far in this post?
>
> * “Religions” wars are useless…
>
> And of course, no Java developers or .NET developers ever have silly
> or pointless arguments. Only people who use dynamic languages do
> that... or something?
>
> * A lot of freelance developers, but startups needs to have internal
> developers too.
>
> Doesn't this contradict the first point? "It's so hard to find
> developers" versus "wow, there are so many developers I can contract
> with".
>
> In other words, this is poorly researched, factually wrong on most of
> its points, arguably self-contradictory... and you expected people not
> to argue with you about it?
>
> 2/10. Do better next time.
>

1.5/10

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: is it possible to pass a dynamic list of choices to a select widget?

2010-08-03 Thread shofty
cheers for reading Steve.

I've been through the documentation again and it definitely states
that the widget wants an iterable. so i dont think im going to be able
to do what i wanted to do, need another approach.

Matt

On 3 Aug, 16:15, Steve Holden  wrote:
> On 8/3/2010 11:12 AM, shofty wrote:
>
> > Steve,
>
> > the choices are different for each product in the shop.
> > some choices are clothing sizes, some physical sizes etc.
>
> > So with that in mind i could go with a bunch of choices hooked up to a
> > choices field if i can tell the form which choice field to use based
> > around the product attribute stored.
>
> > but what if im not the shop admin?
> > in that case i'd have to amend the code every time something goes out
> > of stock in a certain size.
>
> > so i came upon the plan to have a boolean denote whether or not the
> > object has a size option and if so store the options in the model so
> > that it could be amended in the admin pages. then draw a select at
> > runtime with the right options in it.
>
> > thanks for the other pointers, i had an idea the function wasn't right
> > and indeed it isn't going to work at all since the widget won't allow
> > a callable.
>
> > i'll try turning that function into a method on the form and see if it
> > won't work that way
>
> Good stuff. This is a pretty helpful group, so do post again when you
> have further issues. Nobody gets it right the first time ...
>
> regards
>  Steve

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django, Rails but a cost to pay ?

2010-08-03 Thread Alexandre González
Excuse if my answer was hard. I didn't know that you were the author, but I
think that compare the Open Source community with things as Apple consumers
is a stupid point of view IMHO.

Some of the points are correct, but not all, I agree with James Benett
arguments.

Your post is an opinion, and some of use can have another opinions, however
you tell for opinions, so we give them to you :D But really sorry if you
felt offended.

On Tue, Aug 3, 2010 at 20:01, Ramdas S  wrote:

>
>
> On Tue, Aug 3, 2010 at 10:48 PM, James Bennett wrote:
>
>> On Tue, Aug 3, 2010 at 9:19 AM, didier rano 
>> wrote:
>> > What do you think about this post
>> > ? http://blog.skeedy.com/django-rails-but-a-cost-to-pay
>>
>> I think...
>>
>> * A community, but it is not so easy to find developers compared to Java
>> or .NET
>>
>> True, but finding *good* developers in any language, which is the real
>> goal no matter what you're working with, is so difficult people write
>> whole books on it and *still* fail.
>>
>> * With dynamic languages, we cannot use powerful IDE as Visual Studio.
>> It is not a problem for me, but some developers like completion,
>> compilation…
>>
>> Eclipse/PyDev will do this. Komodo will do this. Aptana will do this.
>> Visual Studio will do it with IronPython. Shall we continue the list
>> of IDEs which work with dynamic languages and offer all the crutches
>> people are used to?
>>
>> * Quality check tools are less powerful because dynamic languages
>>
>> Just in the Python world, PyLint, Cheesecake, coverage.py and quite a
>> few other quality-checking libraries would like to have a word with
>> you, along with approximately eight zillion testing frameworks,
>> harnesses and mock-object libraries.
>>
>> * Difficult to use Java or .NET libraries. Example: A lot of analytics
>> semantic libraries exist in Java, but not in Python.
>>
>> So use Jython, which lets you blend together Python code and Java
>> libraries any way you like, and even lets you deploy your Python
>> applications as Java WAR files. Or IronPython which does pretty much
>> the same with .NET.
>>
>> * Small and smart community then some developers could be arrogant, be
>> “the chosen one”.
>>
>> Says the guy who's been factually wrong on every technical statement
>> he's made about Python so far in this post?
>>
>> * “Religions” wars are useless…
>>
>> And of course, no Java developers or .NET developers ever have silly
>> or pointless arguments. Only people who use dynamic languages do
>> that... or something?
>>
>> * A lot of freelance developers, but startups needs to have internal
>> developers too.
>>
>> Doesn't this contradict the first point? "It's so hard to find
>> developers" versus "wow, there are so many developers I can contract
>> with".
>>
>> In other words, this is poorly researched, factually wrong on most of
>> its points, arguably self-contradictory... and you expected people not
>> to argue with you about it?
>>
>> 2/10. Do better next time.
>>
>
> 1.5/10
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
and/or .pptx
http://mirblu.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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



how to make readonly in change but editable in add?

2010-08-03 Thread snipinben

I was wondering how to make a field readonly when you click on it or want to
change the record. and i have done that with the readonly_feilds method. but
that makes it to where you cant add information to that feild when you add a
new record. is there something i can use where you are not able to edit a
feild in the change view, but when you add new, you are able to edit the
field until you press save? thanks alot
-- 
View this message in context: 
http://old.nabble.com/how-to-make-readonly-in-change-but-editable-in-add--tp29338689p29338689.html
Sent from the django-users mailing list archive at Nabble.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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: is it possible to pass a dynamic list of choices to a select widget?

2010-08-03 Thread Alec Shaner
Based on what you described as your intent, have you looked at
ModelChoiceField?  You could create a new table, e.g. ProductOptions, that
has a foreign key to your Product table. In your form class you can then
pass a queryset into the ModelChoiceField that selects only the options for
that product, and if necessary even filter out any options that aren't
available  - assuming your ProductOption table had a quantity field.

If you have many products that share a common set of options (e.g., all
shirts have S, M, L, XL, etc.) you might design the tables a little
differently, but ultimately a ModelChoiceField can be passed any queryset
that filters the correct options.

If you prefer to store each product's options as a comma separated field,
you can still do what was suggested previously and just pass the choices
into the init method of the form.

Regarding your issue of needing an iterable - as was stated by Steve Holden
if you have a method that produces the choices, then you want to call that
method, e.g., choices=foo.create_choices(), not choices=foo.create_choices.

On Tue, Aug 3, 2010 at 2:29 PM, shofty  wrote:

> cheers for reading Steve.
>
> I've been through the documentation again and it definitely states
> that the widget wants an iterable. so i dont think im going to be able
> to do what i wanted to do, need another approach.
>
> Matt
>
> On 3 Aug, 16:15, Steve Holden  wrote:
> > On 8/3/2010 11:12 AM, shofty wrote:
> >
> > > Steve,
> >
> > > the choices are different for each product in the shop.
> > > some choices are clothing sizes, some physical sizes etc.
> >
> > > So with that in mind i could go with a bunch of choices hooked up to a
> > > choices field if i can tell the form which choice field to use based
> > > around the product attribute stored.
> >
> > > but what if im not the shop admin?
> > > in that case i'd have to amend the code every time something goes out
> > > of stock in a certain size.
> >
> > > so i came upon the plan to have a boolean denote whether or not the
> > > object has a size option and if so store the options in the model so
> > > that it could be amended in the admin pages. then draw a select at
> > > runtime with the right options in it.
> >
> > > thanks for the other pointers, i had an idea the function wasn't right
> > > and indeed it isn't going to work at all since the widget won't allow
> > > a callable.
> >
> > > i'll try turning that function into a method on the form and see if it
> > > won't work that way
> >
> > Good stuff. This is a pretty helpful group, so do post again when you
> > have further issues. Nobody gets it right the first time ...
> >
> > regards
> >  Steve
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Python question about subprocess.Popen() and stdout

2010-08-03 Thread Joshua Russo
On Mon, Aug 2, 2010 at 6:41 PM, Joshua Russo  wrote:

> I'm creating a wxPython application that the client can run to make
> sure the installation stack is functioning properly. I want to include
> the unit test processing in this application but I've run into some
> difficulties. An additional wrinkle I threw in was that I am using
> py2exe so they don't also need to install wxPython, we'll see if that
> will actually work or not.
>
> It seems like the most appropriate thing to do is to use
> subprocess.Popen() to trigger "manage.py test --noinput". The problem
> I am trying to solve is that this runs for a while and I want to
> display the stdio output into a text box on the window.
>
> I had this working using django.core.management.call_command but
> creating the exe broke the pathing within Django and even some Python
> libraries (thus dumping py2exe could be what I need to do).
>
> The problem with switching to Popen is that it expects a file type
> object with a fileno() method. The file class cannot be extended in
> the stdio instance because you can't write back to the __class__
> property. I guess what I need to know is how do I mimic stdout? Stdout
> doesn't output to a file, but it still uses the file object. It seems
> like I want to open a file object onto a Nul output. Can this be
> done?
>
> Thanks
> Josh
>

Ok, so it appears that (in Python 2.5 at least) there is no way to capture
the stdout of subprocess.Popen(). I've tried many different suggestions from
questions that have already been posted to Stack Overflow and everything
either buffers until the end of processing or just plain doesn't work.

So I dumped Py2exe and went back to using
django.core.management.call_command() and everything works like a dream.

In case you care.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django, Rails but a cost to pay ?

2010-08-03 Thread didier rano
Thanks Alexandre :)

I knew that my post could be attacked easily. It is just an opinion.

I love python. I'd like to work only in python. But, not all good developers
are able to use efficiently dynamic languages.
And, sometimes, to choose an open source framework could be more problematic
than proprietary frameworks.

I don't need powerful IDE. Textmate is enough for me. But, we cannot compare
Pydev in Visual Studio.

Why Google has updated Youtube framework for Java, .NET and PHP, but not for
Python ?


2010/8/3 Alexandre González 

> Excuse if my answer was hard. I didn't know that you were the author, but I
> think that compare the Open Source community with things as Apple consumers
> is a stupid point of view IMHO.
>
> Some of the points are correct, but not all, I agree with James Benett
> arguments.
>
> Your post is an opinion, and some of use can have another opinions, however
> you tell for opinions, so we give them to you :D But really sorry if you
> felt offended.
>
>
> On Tue, Aug 3, 2010 at 20:01, Ramdas S  wrote:
>
>>
>>
>> On Tue, Aug 3, 2010 at 10:48 PM, James Bennett wrote:
>>
>>> On Tue, Aug 3, 2010 at 9:19 AM, didier rano 
>>> wrote:
>>> > What do you think about this post
>>> > ? http://blog.skeedy.com/django-rails-but-a-cost-to-pay
>>>
>>> I think...
>>>
>>> * A community, but it is not so easy to find developers compared to Java
>>> or .NET
>>>
>>> True, but finding *good* developers in any language, which is the real
>>> goal no matter what you're working with, is so difficult people write
>>> whole books on it and *still* fail.
>>>
>>> * With dynamic languages, we cannot use powerful IDE as Visual Studio.
>>> It is not a problem for me, but some developers like completion,
>>> compilation…
>>>
>>> Eclipse/PyDev will do this. Komodo will do this. Aptana will do this.
>>> Visual Studio will do it with IronPython. Shall we continue the list
>>> of IDEs which work with dynamic languages and offer all the crutches
>>> people are used to?
>>>
>>> * Quality check tools are less powerful because dynamic languages
>>>
>>> Just in the Python world, PyLint, Cheesecake, coverage.py and quite a
>>> few other quality-checking libraries would like to have a word with
>>> you, along with approximately eight zillion testing frameworks,
>>> harnesses and mock-object libraries.
>>>
>>> * Difficult to use Java or .NET libraries. Example: A lot of analytics
>>> semantic libraries exist in Java, but not in Python.
>>>
>>> So use Jython, which lets you blend together Python code and Java
>>> libraries any way you like, and even lets you deploy your Python
>>> applications as Java WAR files. Or IronPython which does pretty much
>>> the same with .NET.
>>>
>>> * Small and smart community then some developers could be arrogant, be
>>> “the chosen one”.
>>>
>>> Says the guy who's been factually wrong on every technical statement
>>> he's made about Python so far in this post?
>>>
>>> * “Religions” wars are useless…
>>>
>>> And of course, no Java developers or .NET developers ever have silly
>>> or pointless arguments. Only people who use dynamic languages do
>>> that... or something?
>>>
>>> * A lot of freelance developers, but startups needs to have internal
>>> developers too.
>>>
>>> Doesn't this contradict the first point? "It's so hard to find
>>> developers" versus "wow, there are so many developers I can contract
>>> with".
>>>
>>> In other words, this is poorly researched, factually wrong on most of
>>> its points, arguably self-contradictory... and you expected people not
>>> to argue with you about it?
>>>
>>> 2/10. Do better next time.
>>>
>>
>> 1.5/10
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> --
> Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
> and/or .pptx
> http://mirblu.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-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Didier Rano
didier.r...@gmail.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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Free Django Hosting

2010-08-03 Thread kostia
I'm looking for a free Django hosting. Please, write me, if you can
help.

The web site will look like this one http://kostia.pythonic.nl

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



error 404

2010-08-03 Thread yalda.nasirian
hi
i don't know why i cant see generic view , please help me .
i have this error


Page not found (404)
Request Method: GET
Request URL:http://127.0.0.1:8000/

Using the URLconf defined in mysite.urls, Django tried these URL
patterns, in this order:

   1. ^polls/$
   2. ^polls/(?P\d+)/$
   3. ^polls/(?P\d+)/results/$
   4. ^polls/(?P\d+)/vote/$
   5. ^admin/

The current URL, , didn't match any of these.

mysite.urls.py

from django.conf.urls.defaults import *

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
(r'^polls/$', 'mysite.polls.views.index'),
(r'^polls/(?P\d+)/$', 'mysite.polls.views.detail'),
(r'^polls/(?P\d+)/results/$',
'mysite.polls.views.results'),
(r'^polls/(?P\d+)/vote/$', 'mysite.polls.views.vote'),
(r'^admin/', include(admin.site.urls)),

)

mysite.polls.urls.py

from django.conf.urls.defaults import *
from mysite.polls.models import Poll

info_dict = {
'queryset': Poll.objects.all(),
}

urlpatterns = patterns('',
(r'^$', 'django.views.generic.list_detail.object_list',
info_dict),
(r'^(?P\d+)/$',
'django.views.generic.list_detail.object_detail', info_dict),
url(r'^(?P\d+)/results/$',
'django.views.generic.list_detail.object_detail', dict(info_dict,
template_name='polls/results.html'), 'poll_results'),
(r'^(?P\d+)/vote/$', 'mysite.polls.views.vote'),
)

models.py

from django.db import models
import datetime

class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __str__(self):
   return self.question
def was_published_today(self):
   return self.pub_date.date() == datetime.date.today()
was_published_today.short_description = 'Published today?'


class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(max_length=200)
votes = models.IntegerField()
def __str__(self):
return self.choice

admin.py

from mysite.polls.models import Poll
from django.contrib import admin
from mysite.polls.models import Choice

class ChoiceInline(admin.StackedInline):
model = Choice
extra = 3

class PollAdmin(admin.ModelAdmin):
fieldsets = [
(None,   {'fields': ['question']}),
('Date information', {'fields': ['pub_date'], 'classes':
['collapse']}),
]
inlines = [ChoiceInline]
list_display = ('question', 'pub_date', 'was_published_today')
list_filter = ['pub_date']
search_fields = ['question']
date_hierarchy = 'pub_date'

admin.site.register(Poll, PollAdmin)
admin.site.register(Choice)


what is my wrong ?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



TypeError: decoding Unicode is not supported

2010-08-03 Thread sohesado
Hi

I'm currently developing a django project and i've encountered a
problem regarding Unicode string manipulation.

There is a backend python module in my project that perform's mainly
shutil (shell utilities) tasks.

I get an TypeError: "decoding Unicode is not supported" exception
while running the following method

-
def create_base(name, reg):
path = unicode(ROOT + name, 'utf-8')  error at this line
shutil.copytree(ROOT + 'matrix', path)
shutil.copystat(ROOT + 'matrix', path)

f = codecs.open(path + '/conf/local.php', "w", "UTF-8")
tmp = unicode("http://groups.google.com/group/django-users?hl=en.



Re: TypeError: decoding Unicode is not supported

2010-08-03 Thread Alec Shaner
unicode gives me nightmares.

Taking django out of the picture for a moment:
>>> unicode('foo', 'utf-8')
u'foo'
>>> unicode(u'foo', 'utf-8')
Traceback (most recent call last):
  File "", line 1, in 
TypeError: decoding Unicode is not supported

So I would assume when you run it inside django you're already using a
unicode string. Do you need to pass the encoding argument ('utf-8') to
unicode?

On Tue, Aug 3, 2010 at 3:30 PM, sohesado  wrote:

> Hi
>
> I'm currently developing a django project and i've encountered a
> problem regarding Unicode string manipulation.
>
> There is a backend python module in my project that perform's mainly
> shutil (shell utilities) tasks.
>
> I get an TypeError: "decoding Unicode is not supported" exception
> while running the following method
>
>
> -
> def create_base(name, reg):
>path = unicode(ROOT + name, 'utf-8')  error at this line
>shutil.copytree(ROOT + 'matrix', path)
>shutil.copystat(ROOT + 'matrix', path)
>
>f = codecs.open(path + '/conf/local.php', "w", "UTF-8")
>tmp = unicode("f.write(tmp)
>if not reg:
>f.write("$conf['disableactions'] = 'register';\n")
>
> ---
>
> The weird thing that puzzles me is that when i test the module in a
> python shell , the method runs flawlessly which yields me to the
> assumption that it's a django thing.
> By the way i use apache+mod-python as a web-server
>
> I can't get adequate information regarding this type of exception. I'm
> stuck , please 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-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django sites framework

2010-08-03 Thread commonzenpython
hey guys, i have been reading about django sites, but i still dont
understand how to implement it to manage multiple sites using the
admin, i have two domains, ashtangayogavideo.com, and
abilityexplosion.org, im using mod_wsgi in a django project inside
ashtangayogavideo.com, how can i link a model to from
ashtangayogavideo.com to display info, in  abilityexplosion.org ?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: uncomplete internationalization of 'auth' in admin panel

2010-08-03 Thread bagheera
Dnia 29-07-2010 o 23:17:13 Dennis Kaarsemaker   
napisał(a):



On do, 2010-07-29 at 13:43 -0700, bagheera wrote:

Internationalization of 'auth' app in django 1.2 isn't complete. In
user edit form there are user permissions displayed in two windows,
like "auth | permission | Can add permission", etc. I want it all
fully localized, but i can't digg up right code. Any ideas how to
solve that?


These strings do not come from the code but from the database.
Unfortunately django does not yet have a built-in mechanism for
internationalizing and translating those. There are third party addons
for this, though I have no idea whether they can be used for standard
django models.



Ok, with little help, we figure most of it out:
I had to modify django/contrib/auth/management/__init__.py

def _get_all_permissions(opts):
"Returns (codename, name) for all permissions in the given opts."
perms = []
for action, action_pl in ( ('add', 'dodać'), ('change', 'zmienić'),  
('delete', 'usunąć') ):
perms.append((_get_permission_codename(action, opts), u'Może %s  
%s' % (action_pl, opts.verbose_name_raw)))

return perms + list(opts.permissions)

Now "Can add", and rest of it is translated during model creation

To use custom verbose name of 'auth' application i've created function

def get_verbose_name(app_label):
try:
return getattr(settings, "VERBOSE_APP_NAMES", {} ).get( app_label )
except:
return app_label

and changed django/contrib/auth/models.py


def __unicode__(self):
verbose_name = get_verbose_name(self.content_type.app_label)
return u"%s | %s | %s" % (
unicode(verbose_name),
unicode(self.content_type),
unicode(self.name))

Now i only have one last element, model name, witch is raw, untranslated  
verbose_name. How to change that?


1. Should i change all verbose_name strings to static, nonlocalizable  
strings?
2. Should i modify view function to pass altered strings to template,  
witch view exactly?
3. Should i change verbose_name_raw property? How to do it right? It's  
located in db/models/options.py

4. Other suggestions

--
Linux user

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



modify default admin action - delete_selected

2010-08-03 Thread bagheera


Lets say i have a Person model and a book model. Each Person can have many  
books. Person model have PositiveIntegerField that stores, how many books  
that person has. If new book is added, respective counter is incremented,  
now i want to modify default admin action - delete_selected, so it would  
change values of respective counters, but only if i confirm deletion of  
selected books.


How to override delete_seleted properly?

Sorry for my bad english.
--
Linux user

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: modify default admin action - delete_selected

2010-08-03 Thread Steve Holden
On 8/3/2010 5:06 PM, bagheera wrote:
> 
> Lets say i have a Person model and a book model. Each Person can have
> many books. Person model have PositiveIntegerField that stores, how many
> books that person has. If new book is added, respective counter is
> incremented, now i want to modify default admin action -
> delete_selected, so it would change values of respective counters, but
> only if i confirm deletion of selected books.
> 
> How to override delete_seleted properly?
> 
> Sorry for my bad english.

It would be easier if you used the database to count the books each
person has. I presume you have specific efficiency reasons for designing
your database with redundant data in it? ("Yes" Is an acceptable answer
to this question ...)

regards
 Steve

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Saving formsets with multiple databases

2010-08-03 Thread Melanie
I am developing a formset for an application which uses multiple
databases.  On load of the formset, I am able to utilize:

model.objects.using(database).get(id)

to get an instance of the object from the active database.  However,
when the formset is submitted, I generate a new formset from the data
in request.POST:

formset = SampleFormSet(request.POST)

When attempting to save the formset to the database, I attempted to
pass the "using" parameter in the save method:

formset.save(using=database)

and got the error:

save() got an unexpected keyword argument 'using'

which suggests to me that the save method on the formset does not
support multiple databases.  Is there any known way to save a formset
when using multiple databases?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Get request path without having a request object

2010-08-03 Thread cootetom
I have finished and made this app available via it's own web site.
Take a look http://poedit.tomcoote.co.uk/




On Aug 1, 1:18 pm, cootetom  wrote:
> I have found some code that can get the request object.
>
> f = sys._getframe()
> while f:
>     request = f.f_locals.get('request')
>     if isinstance(request, HttpRequest):
>         path = request.path
>         break
>     f = f.f_back
>
> James: I understand completely what you are saying and have thought
> long and hard about how I can achieve what I'm doing without needing
> the above code. I am creating an app that will provide a UI to admins
> to translate the text on each web page. The app needs to keep a track
> of which text from the current active language locale files has been
> used in the rendering of the current page they're on. At the same time
> I didn't want to have to change the way in which developers mark text
> for translation. This meant that I needed to override the gettext and
> template translation tags with custom ones which first remembered what
> message ID's were being used and second just called the default Django
> versions of these methods. However neither gettext or the template
> translation tags need to be aware of the request but to remember which
> message ID's are in use for a page I needed to know about the request.
> My options were either change my overriding methods to also accept a
> request object or find the object via another means. The latter seemed
> easier on future development.
>
> My app is almost finished. I need to do a load of testing on it. I'm
> then going to place it into an existing site that uses locale files
> for it's text. After that, I plan to release it for download so that
> others can use it. It turns out really useful to have a UI that will
> manage locale text. I have looked at another one called rosetta but it
> was implemented into the admin system and so didn't have a way of
> showing which text was used on specific pages which I think is really
> useful, especially if clients want to get involved with text
> translation.
>
> On Aug 1, 4:23 am, James Bennett  wrote:
>
>
>
> > On Sat, Jul 31, 2010 at 12:37 PM, cootetom  wrote:
> > > Thanks Carlos but I'm trying to achieve getting the path without
> > > having to pass the request object.
>
> > In a word: don't.
>
> > Instead, design your system to pass the information you need where and
> > when you need it. This doesn't mean everything always has to sling
> > around a request object, just that you need to think carefully about
> > separation of concerns and which code needs to get at the request.
>
> > Do this, and in 6-12 months when you have to start making changes to
> > update your application, you'll be incredibly thankful that you did it
> > right the first time around.
>
> > --
> > "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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Announces django-guardian: per object permissions for Django 1.2

2010-08-03 Thread lukaszb
Hi all,

I'd like to announce django-guardian - very basic yet usable per
object permissions
implementation for Django 1.2, using new authorization backend
facilities.

It was created during 2 days sprint, code have been released and may
be found at http://github.com/lukaszb/django-guardian/.
Documentation is available at http://packages.python.org/django-guardian/.

Currently I think there should be better integration with admin app
and some shortcuts (permission assignment/removal)
should support table-level permissions as well.

If you spot a bug or have an idea how to improve this little app,
please spare a minute at issue tracker, which is located at
http://github.com/lukaszb/django-guardian/issues.

Hope someone would find this useful.

Take care,
Lukasz

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Announces django-guardian: per object permissions for Django 1.2

2010-08-03 Thread Russell Keith-Magee
On Wed, Aug 4, 2010 at 7:20 AM, lukaszb  wrote:
> Hi all,
>
> I'd like to announce django-guardian - very basic yet usable per
> object permissions
> implementation for Django 1.2, using new authorization backend
> facilities.
>
> It was created during 2 days sprint, code have been released and may
> be found at http://github.com/lukaszb/django-guardian/.
> Documentation is available at http://packages.python.org/django-guardian/.
>
> Currently I think there should be better integration with admin app
> and some shortcuts (permission assignment/removal)
> should support table-level permissions as well.
>
> If you spot a bug or have an idea how to improve this little app,
> please spare a minute at issue tracker, which is located at
> http://github.com/lukaszb/django-guardian/issues.
>
> Hope someone would find this useful.
>
> Take care,
> Lukasz

Hi Lukasz,

Great stuff! Thanks for taking the effort to implement this and put it
out in the open. It's a fantastic example of the sort of thing that
can be very useful without needing to be part of core, which is the
reason that we put the object-based permissions API into the auth
backends.

Regarding admin app integration -- integration of object-level
permissions with the admin app is one area where I am aware there are
some bugs (or, at least, some areas where the object-based permissions
API isn't being used as it should). This aspect of Django's admin
could do with some attention, so if your experience of implementing an
object-based permissions backend has you contemplating a bigger
project, auditing the admin for adherence to object-based permissions
could be an interesting candidate.

Yours,
Russ Magee %-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Strange error overriding changelist_view in ModelAdmin

2010-08-03 Thread Erisa
I have a Settings model that contains settings for my application.

class Settings(models.Model):
database_name = models.CharField(max_length=50)
current_campaign = models.ForeignKey('Campaign')

It only contains one object.  I would like to be able to use the admin
pages to edit it. Since it only contains one object, I would like to
skip the changelist_view page and go directly to the change_view
page.  I figured I could get the object_id of the single object and
simply override changelist_view by replacing it with a call to
change_view. Here is my admin.py I thought would work:

from wolkdata.database.models import *
from django.contrib import admin

class SettingsAdmin(admin.ModelAdmin):
def changelist_view(self, request, extra_context=None):
object_id = Settings.objects.all()[0].id
return super(SettingsAdmin, self).change_view(self, request,
object_id, extra_context=None)

admin.site.register(Settings, SettingsAdmin)

Unfortunately, it gave the following error:

Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
base.py" in get_response
  100. response = callback(request,
*callback_args, **callback_kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/
options.py" in wrapper
  239. return self.admin_site.admin_view(view)(*args,
**kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/utils/
decorators.py" in _wrapped_view
  76. response = view_func(request, *args,
**kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/views/decorators/
cache.py" in _wrapped_view_func
  69. response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/
sites.py" in inner
  190. return view(request, *args, **kwargs)
File "/home/bruce/django/wolkdata/../wolkdata/database/admin.py" in
changelist_view
  7. return super(SettingsAdmin, self).change_view(self,
request, object_id, extra_context=None)
File "/usr/local/lib/python2.6/dist-packages/django/utils/
decorators.py" in _wrapper
  21. return decorator(bound_func)(*args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/utils/
decorators.py" in _wrapped_view
  72. result = middleware.process_view(request,
view_func, args, kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/middleware/
csrf.py" in process_view
  83. request.META["CSRF_COOKIE"] =
request.COOKIES[settings.CSRF_COOKIE_NAME]

Exception Type: AttributeError at /admin/database/settings/
Exception Value: 'SettingsAdmin' object has no attribute 'COOKIES'

Can anyone see what I am doing wrong?  Could it possibly have
something to do with the decorators?  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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Free Django Hosting

2010-08-03 Thread lzzzing
Google App Engine.

On Aug 4, 12:57 am, kostia  wrote:
> I'm looking for a free Django hosting. Please, write me, if you can
> help.
>
> The web site will look like this onehttp://kostia.pythonic.nl

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: help

2010-08-03 Thread André A . Santos
thx

On Tue, Aug 3, 2010 at 12:07 PM, Franklin Einspruch <
franklin.einspr...@gmail.com> wrote:

> Here's more detail:
>
> http://docs.python.org/release/2.5.2/tut/tut.html
>
> Enjoy! It's a great language.
>
> Franklin
>
> On Tue, Aug 3, 2010 at 11:03 AM, André A. Santos
>  wrote:
> > and how's your point of you abuot my questions in more detail?
> >
> > On Tue, Aug 3, 2010 at 12:00 PM, Maksymus007 
> wrote:
> >>
> >> 1 - no
> >> 2 - no
> >> 3 - no
> >>
> >> On Tue, Aug 3, 2010 at 4:57 PM, André Asantos <
> ti.andreasan...@gmail.com>
> >> wrote:
> >> > I am totaly new to Python world...
> >> >
> >> > I would like to konw:
> >> >
> >> > 1- py is Python class extension?
> >> > 2-does django have any similar .jsp GUI? or is only use HTML for GUI?
> >> > 3-is netbeans IDE the best IDE?
> >> >
> >> > --
> >> > You received this message because you are subscribed to the Google
> >> > Groups "Django users" group.
> >> > To post to this group, send email to django-us...@googlegroups.com.
> >> > To unsubscribe from this group, send email to
> >> > django-users+unsubscr...@googlegroups.com
> .
> >> > For more options, visit this group at
> >> > http://groups.google.com/group/django-users?hl=en.
> >> >
> >> >
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Django users" group.
> >> To post to this group, send email to django-us...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> django-users+unsubscr...@googlegroups.com
> .
> >> For more options, visit this group at
> >> http://groups.google.com/group/django-users?hl=en.
> >>
> >
> >
> >
> > --
> > André Asantos
> > Skype - andredecotia
> > MSN - andre_deco...@hotmail.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-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com
> .
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.
> >
>
>
>
> --
> Art, writing, journal: http://einspruch.com
> Comics: http://themoonfellonme.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-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
André Asantos
Skype - andredecotia
MSN - andre_deco...@hotmail.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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: how to make readonly in change but editable in add?

2010-08-03 Thread shmengie
I cobbled these two classes together which work very nicely for me,
wish they could make into django.
Drop these two classes into a util.py and import them instead of Form
or ModelForm.  When you want your form readonly instantiate it with
"form=MyForm(record, readonly=True)"

class roForm(forms.Form):
def __init__(self, *args, **kwargs):
self.readonly = False
if kwargs.has_key('readonly'):
if kwargs['readonly']:
self.readonly = True
kwargs.pop('readonly')
super(roForm, self).__init__(*args, **kwargs)
if self.readonly:
for key in self.fields.iterkeys():
self.fields[key].widget.attrs['disabled'] = True


class roModelForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
self.readonly = False
if kwargs.has_key('readonly'):
if kwargs['readonly']:
self.readonly = True
kwargs.pop('readonly')
super(roModelForm, self).__init__(*args, **kwargs)
if self.readonly:
for key in self.fields.iterkeys():
self.fields[key].widget.attrs['disabled'] = True


On Aug 3, 2:36 pm, snipinben  wrote:
> I was wondering how to make a field readonly when you click on it or want to
> change the record. and i have done that with the readonly_feilds method. but
> that makes it to where you cant add information to that feild when you add a
> new record. is there something i can use where you are not able to edit a
> feild in the change view, but when you add new, you are able to edit the
> field until you press save? thanks alot
> --
> View this message in 
> context:http://old.nabble.com/how-to-make-readonly-in-change-but-editable-in-...
> Sent from the django-users mailing list archive at Nabble.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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Strange error overriding changelist_view in ModelAdmin

2010-08-03 Thread natebeacham
Try not passing "self" to your super call. That parameter should be
handled internally.

ie: return super(SettingsAdmin, self).change_view(request, object_id,
extra_context=None)

On Aug 3, 8:26 pm, Erisa  wrote:
> I have a Settings model that contains settings for my application.
>
> class Settings(models.Model):
>     database_name = models.CharField(max_length=50)
>     current_campaign = models.ForeignKey('Campaign')
>
> It only contains one object.  I would like to be able to use the admin
> pages to edit it. Since it only contains one object, I would like to
> skip the changelist_view page and go directly to the change_view
> page.  I figured I could get the object_id of the single object and
> simply override changelist_view by replacing it with a call to
> change_view. Here is my admin.py I thought would work:
>
> from wolkdata.database.models import *
> from django.contrib import admin
>
> class SettingsAdmin(admin.ModelAdmin):
>     def changelist_view(self, request, extra_context=None):
>         object_id = Settings.objects.all()[0].id
>         return super(SettingsAdmin, self).change_view(self, request,
> object_id, extra_context=None)
>
> admin.site.register(Settings, SettingsAdmin)
>
> Unfortunately, it gave the following error:
>
> Traceback:
> File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
> base.py" in get_response
>   100.                     response = callback(request,
> *callback_args, **callback_kwargs)
> File "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/
> options.py" in wrapper
>   239.                 return self.admin_site.admin_view(view)(*args,
> **kwargs)
> File "/usr/local/lib/python2.6/dist-packages/django/utils/
> decorators.py" in _wrapped_view
>   76.                     response = view_func(request, *args,
> **kwargs)
> File "/usr/local/lib/python2.6/dist-packages/django/views/decorators/
> cache.py" in _wrapped_view_func
>   69.         response = view_func(request, *args, **kwargs)
> File "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/
> sites.py" in inner
>   190.             return view(request, *args, **kwargs)
> File "/home/bruce/django/wolkdata/../wolkdata/database/admin.py" in
> changelist_view
>   7.         return super(SettingsAdmin, self).change_view(self,
> request, object_id, extra_context=None)
> File "/usr/local/lib/python2.6/dist-packages/django/utils/
> decorators.py" in _wrapper
>   21.             return decorator(bound_func)(*args, **kwargs)
> File "/usr/local/lib/python2.6/dist-packages/django/utils/
> decorators.py" in _wrapped_view
>   72.                     result = middleware.process_view(request,
> view_func, args, kwargs)
> File "/usr/local/lib/python2.6/dist-packages/django/middleware/
> csrf.py" in process_view
>   83.             request.META["CSRF_COOKIE"] =
> request.COOKIES[settings.CSRF_COOKIE_NAME]
>
> Exception Type: AttributeError at /admin/database/settings/
> Exception Value: 'SettingsAdmin' object has no attribute 'COOKIES'
>
> Can anyone see what I am doing wrong?  Could it possibly have
> something to do with the decorators?  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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django IDE

2010-08-03 Thread carlos
I use Gedit, but when I get bored using the same vim

cheer

On Sun, Jul 18, 2010 at 5:39 PM, Fabian Ezequiel Gallina  wrote:

> 2010/7/18 Roald de Vries :
> >
> > Comparison of VIM and Emacs (what I've read):
> > - Emacs is monolithic (does everything, for example includes shell), VIM
> is
> > unix style (does one thing well, why reproduce the shell?)
>
> Wrong, all it's features are in separated Emacs' Lisp modules which
> can be activated or deactivated at user's will. Emacs provides
> different kind of programs to allow user's edit text without exiting
> from Emacs, that's why it is nice to have a shell (that without
> mentioning the cool features you can develop with a shell interface).
>
> > - Emacs doesn't have different (confusing) modes, VIM doesn't leave you
> with
> > a crippled little finger (from all the 's)
>
> For me having two modes is annoying and confusing, I don't mind
> hitting modifiers to execute things but that's a personal taste, the
> good thing is that if you are a vi(m)'s keybinding dependant person
> you can activate viper-mode and Emacs will have the same keybindings
> as vi(m).
>
> > - VIM has more commands than Emacs
>
> I disagree with that. Just install Emacs, hit M-x apropos-commands and
> count them for yourself :). Emacs is a Lisp interpreter with text
> editor commands and primitives included into it. So it is a complete
> development environment for itself and the GNU/Emacs distribution
> comes with batteries-included, it supports by default languages you
> probably never heard of.
>
> > I would say Emacs makes you more productive on shorter term, VIM makes
> you
> > more productive on longer term.
> >
>
> I disagree with that too, both editors are so advanced that let you
> increase your productivity in time to limits you wouldn't imagine.
> Emacs is known to be the most extensible of both (that's its
> philosophy) so your productivity limit is your imagination, as long as
> you willing to learn some Emacs Lisp.
>
> I'm not sending this email to start a flame on Emacs and Vim. Being a
> relatively advanced Emacs user I just like to correct some points
> expressed here.
>
> And to finish I like to mention that I tried myself Vim and Emacs some
> years ago when looking for better ways to work, and I stayed with
> Emacs mainly because of two things:
>* The extension language (I like Lisp).
>* I don't like having two editing modes.
>
> Whatever you choose should be fine, it's just a matter of personal taste.
>
>
> Best Regards,
> --
> Fabián E. Gallina
> http://www.from-the-cloud.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-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django IDE

2010-08-03 Thread Nick Arnett
On Sun, Jul 18, 2010 at 10:19 AM, Biju Varghese wrote:

> Eclipse is the best IDE for python and django.
>
>
I don't know if it is actually the best, but I'm happy with it.

Nick

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django IDE

2010-08-03 Thread Alexander Jeliuc
gvim, emacs, eclipse, eric

On Wed, Aug 4, 2010 at 6:50 AM, Nick Arnett  wrote:

>
>
> On Sun, Jul 18, 2010 at 10:19 AM, Biju Varghese wrote:
>
>> Eclipse is the best IDE for python and django.
>>
>>
> I don't know if it is actually the best, but I'm happy with it.
>
> Nick
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django, Rails but a cost to pay ?

2010-08-03 Thread Eugene Wee
Hi,

On Wed, Aug 4, 2010 at 3:21 AM, didier rano  wrote:
> But, not all good developers
> are able to use efficiently dynamic languages.

I suspect that there will always be a programming language for which
there exists a good developer who is currently unable to use it
efficiently. Programming languages are tools, and not everyone is
engaged in the same tasks, hence some will be more proficient with
some tools than others. So, find a good developer who is currently
able to use the programming language (and platform, framework, etc)
efficiently, or wait for for your good developer to catch up (which
will happen eventually, if he/she is any good).

> And, sometimes, to choose an open source framework could be more problematic
> than proprietary frameworks.

And, sometimes, to choose a proprietary framework could be more
problematic than open source frameworks. You should show by reasoned
argument that choosing an open source framework tends to lead to more
problems than choosing a proprietary framework, otherwise you are just
making a vague assertion that does not really mean anything.

> Why Google has updated Youtube framework for Java, .NET and PHP, but not for
> Python ?

Why did Google support Python for App Engine before Java? Why does it
still not support .NET and PHP? It really is quite ironic to see that
you wrote that '"Religions" wars are useless' :)

Regards,
Eugene

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Strange error overriding changelist_view in ModelAdmin

2010-08-03 Thread Erisa
I can't believe I missed the "self" problem, but when I fixed that I
still received another strange error:

Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
base.py" in get_response
  100. response = callback(request,
*callback_args, **callback_kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/
options.py" in wrapper
  239. return self.admin_site.admin_view(view)(*args,
**kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/utils/
decorators.py" in _wrapped_view
  76. response = view_func(request, *args,
**kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/views/decorators/
cache.py" in _wrapped_view_func
  69. response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/
sites.py" in inner
  190. return view(request, *args, **kwargs)
File "/home/bruce/django/wolkdata/../wolkdata/database/admin.py" in
changelist_view
  7. return super(SettingsAdmin, self).change_view(request,
object_id, extra_context=None)
File "/usr/local/lib/python2.6/dist-packages/django/utils/
decorators.py" in _wrapper
  21. return decorator(bound_func)(*args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/utils/
decorators.py" in _wrapped_view
  76. response = view_func(request, *args,
**kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/utils/
decorators.py" in bound_func
  17. return func(self, *args2, **kwargs2)
File "/usr/local/lib/python2.6/dist-packages/django/db/transaction.py"
in _commit_on_success
  299. res = func(*args, **kw)
File "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/
options.py" in change_view
  860. obj = self.get_object(request, unquote(object_id))
File "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/
util.py" in unquote
  35. list = s.split('_')

Exception Type: AttributeError at /admin/database/settings/
Exception Value: 'long' object has no attribute 'split'

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Strange error overriding changelist_view in ModelAdmin

2010-08-03 Thread Erisa
I found the problem.  The object_id needs to be a string!  So the
following works like a charm:

from wolkdata.database.models import *
from django.contrib import admin

class SettingsAdmin(admin.ModelAdmin):
def changelist_view(self, request, extra_context=None):
object_id = str(Settings.objects.all()[0].id)
return super(SettingsAdmin, self).change_view(self, request,
object_id, extra_context=None)

admin.site.register(Settings, SettingsAdmin)

When I click on the Settings option on the admin page I go right to
the change_view 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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: MultiPartParserError HTTP_CONTENT_LENGTH zero when uploading a file

2010-08-03 Thread hcarvalhoalves
Now that someone else mentioned, yes, I believe we have the same
problem.

I run Django thru FastCGI to a Cherokee Web Server, and occasionally,
uploads fail to continue (the traceback shows that the code hanged at
consuming the input stream, then the connection got reset by the
client's browser, raising EOFError).

At first, I filled a bug against Cherokee, but it didn't turned out
that we were able to narrow the issue. Now I know it's not related to
the web server, as you run Lighttpd.

The only things I can think of are, a bug on FastCGI (Flup), Django,
or a bug only triggered when you run Django thru FastCGI.

I've also ran my Django install with SCGI, and with different options
(fork / threaded), but the intermittent error persists. SCGI still
uses Flup though.

This bug proved to be really, really hard to reproduce or track down.
I only get it because I run a SaaS with dozens users uploading photos
every day, and some requests happen to fail starting the upload and
end 500'ing.

What about filling a ticket against Django?

On 2 ago, 18:49, Eric Chamberlain  wrote:
> We have an intermittent problem when uploading files.  About one in five 
> uploads fails, when the MultiPartParser receives an HTTP_CONTENT_LENGTH of 
> zero.
>
> We are running Django with lighttpd and fastcgi, has anyone else encountered 
> this problem?
>
> --
> Eric Chamberlain

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Free Django Hosting

2010-08-03 Thread kostia
I'm looking for private person from some government institution/
university or with his own hosting server. The web site will be
launched for a couple of months. Than I will find payed hosting
provider and now I just want the site to be published.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



PIL failed in virtualenv?

2010-08-03 Thread kostia
Good day,

I created via ssh my virtualenv ENV and installed over there Django,
its modules like captcha, modeltranslation and thumbs. But I have a
trouble with Imaging-1.1.7! See below. My Django project is called
"projector".

When running the server I do:

(ENV)kos...@au-kbc:~/ENV/projector$ python manage.py runserver
127.0.0.1:9980
Validating models...
modeltranslation: Registered 0 models for translation ().
Unhandled exception in thread started by 
Traceback (most recent call last):
  File "/home/kostia/ENV/lib/python2.6/site-packages/django/core/
management/commands/runserver.py", line 48, in inner_run
self.validate(display_num_errors=True)
  File "/home/kostia/ENV/lib/python2.6/site-packages/django/core/
management/base.py", line 249, in validate
raise CommandError("One or more models did not validate:\n%s" %
error_text)
django.core.management.base.CommandError: One or more models did not
validate:
main.project: "image": To use ImageFields, you need to install the
Python Imaging Library. Get it at http://www.pythonware.com/products/pil/
.

And it shows that PIL was not installed. Ok, I go to /home/kostia/ENV/
django modules/Imaging-1.1.7 and manually run
python setup.py install

Then it shows an error within the long log:

(ENV)kos...@au-kbc:~/ENV/django modules/Imaging-1.1.7$ python setup.py
install

running install
running build
running build_py
running build_ext
building '_imaging' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -
Wstrict-prototypes -fPIC -DHAVE_LIBJPEG -DHAVE_LIBZ -I/usr/include/
freetype2 -IlibImaging -I/home/kostia/ENV/include -I/usr/local/include
-I/usr/include -I/usr/include/python2.6 -c _imaging.c -o build/
temp.linux-i686-2.6/_imaging.o
_imaging.c:75:20: error: Python.h: No such file or directory
In file included from libImaging/Imaging.h:14,
 from _imaging.c:77:
libImaging/ImPlatform.h:14:2: error: #error Sorry, this library
requires support for ANSI prototypes.
libImaging/ImPlatform.h:17:2: error: #error Sorry, this library
requires ANSI header files.
libImaging/ImPlatform.h:55:2: error: #error Cannot find required 32-
bit integer type
In file included from _imaging.c:77:
libImaging/Imaging.h:90: error: expected specifier-qualifier-list
before ‘INT32’
libImaging/Imaging.h:264: error: expected specifier-qualifier-list
before ‘INT32’
libImaging/Imaging.h:395: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or
‘__attribute__’ before ‘ImagingCRC32’
_imaging.c:124: error: expected specifier-qualifier-list before
‘PyObject_HEAD’
_imaging.c:129: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or
‘__attribute__’ before ‘PyTypeObject’
_imaging.c:143: error: expected specifier-qualifier-list before
‘PyObject_HEAD’
_imaging.c:151: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or
‘__attribute__’ before ‘PyTypeObject’
_imaging.c:154: error: expected specifier-qualifier-list before
‘PyObject_HEAD’
_imaging.c:160: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or
‘__attribute__’ before ‘PyTypeObject’
_imaging.c:165: error: expected specifier-qualifier-list before
‘PyObject_HEAD’
_imaging.c:170: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or
‘__attribute__’ before ‘PyTypeObject’
_imaging.c:172: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or
‘__attribute__’ before ‘*’ token
_imaging.c: In function ‘_dealloc’:
_imaging.c:204: error: ‘ImagingObject’ has no member named ‘access’
_imaging.c:206: error: ‘ImagingObject’ has no member named ‘image’
_imaging.c:207: warning: implicit declaration of function ‘PyMem_DEL’
_imaging.c: At top level:
_imaging.c:212: error: expected ‘)’ before ‘*’ token
_imaging.c: In function ‘ImagingSectionEnter’:
_imaging.c:230: error: ‘PyThreadState’ undeclared (first use in this
function)
_imaging.c:230: error: (Each undeclared identifier is reported only
once
_imaging.c:230: error: for each function it appears in.)
_imaging.c:230: error: expected expression before ‘)’ token
_imaging.c: In function ‘ImagingSectionLeave’:
_imaging.c:237: warning: implicit declaration of function
‘PyEval_RestoreThread’
_imaging.c:237: error: ‘PyThreadState’ undeclared (first use in this
function)
_imaging.c:237: error: expected expression before ‘)’ token
_imaging.c: At top level:
_imaging.c:248: error: expected ‘)’ before ‘*’ token
_imaging.c:257: error: expected ‘)’ before ‘*’ token
_imaging.c: In function ‘ImagingError_IOError’:
_imaging.c:301: warning: implicit declaration of function
‘PyErr_SetString’
_imaging.c:301: error: ‘PyExc_IOError’ undeclared (first use in this
function)
_imaging.c:302: error: ‘NULL’ undeclared (first use in this function)
_imaging.c: In function ‘ImagingError_MemoryError’:
_imaging.c:308: warning: implicit declaration of function
‘PyErr_NoMemory’
_imaging.c:308: warning: return makes pointer from integer without a
cast
_imaging.c: In function ‘ImagingError_Mismatch’:
_imaging.c:314: error: ‘PyExc_ValueError’ undeclared (first use in
this function)
_imaging.c:315: error: ‘NULL’ undeclared (first use in this function)
_imaging.c: In function ‘ImagingError_Mod