Re: error after updating from svn (v5479): unexpected keyword argument 'max_digits'

2007-06-15 Thread hotani

Thanks. It is on a dev server so no biggie. I changed the models to
DecimalFields and all is well.


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



Re: error after updating from svn (v5479): unexpected keyword argument 'max_digits'

2007-06-15 Thread Todd O'Bryan

On Fri, 2007-06-15 at 22:40 +, hotani wrote:
> Full error:
> [__init__() got an unexpected keyword argument 'max_digits']
> 
> Just updated from svn today and when I tried a syncdb that is what
> happened. Is 'max_digits' not allowed anymore?
> 
> Here is an example straight from the model:
> fine = models.FloatField(max_digits=9, decimal_places=2, blank=True,
> null=True, default='0.00')
> 
> It is a currency field.

Learn to love the new DecimalField:

http://www.djangoproject.com/documentation/model-api/#decimalfield

FloatField now just represents a float in all its glorious imprecision.

Todd


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



rendering fields in newforms

2007-06-15 Thread [EMAIL PROTECTED]

Say we have class MyForm with IntegerField called 'year'. When we
instantiate MyForm, say a = MyForm() we can get it rendered in html
before passing to template - a.as_table(); This will contain all
errors, previously entered data - if we instantiate MyForm from
request.POST.
The question is, how to get rendered field? I mean, only rendered
field 'year' without the rest of the form?
We can pass a.base_fieds['year'] to template - but how to do this
before rendering the template?
What I found out is that there is a class called BoundField and we can
get it via unicode(a['year']) - however, this renders widget only,
without data or errors. How to display them?
Of course I can get rendered template and then work with it - but due
to specific of my app, it raises UnicodeDecodeError, because it gets
merged with non-unicode string afterwards.

Any ideas, anyone?


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



Re: error after updating from svn (v5479): unexpected keyword argument 'max_digits'

2007-06-15 Thread Ramiro Morales

On 6/15/07, hotani <[EMAIL PROTECTED]> wrote:
>
> Full error:
> [__init__() got an unexpected keyword argument 'max_digits']
>
> Just updated from svn today and when I tried a syncdb that is what
> happened. Is 'max_digits' not allowed anymore?
>
> Here is an example straight from the model:
> fine = models.FloatField(max_digits=9, decimal_places=2, blank=True,
> null=True, default='0.00')
>
> It is a currency field.
>

http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#RenamedFloatFieldtoDecimalField

If you are usign SVN it's a good idea to read that wiki page and/or
follow the Trac timeline
(http://code.djangoproject.com/timeline/).

Regards,

-- 
 Ramiro Morales

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



error after updating from svn (v5479): unexpected keyword argument 'max_digits'

2007-06-15 Thread hotani

Full error:
[__init__() got an unexpected keyword argument 'max_digits']

Just updated from svn today and when I tried a syncdb that is what
happened. Is 'max_digits' not allowed anymore?

Here is an example straight from the model:
fine = models.FloatField(max_digits=9, decimal_places=2, blank=True,
null=True, default='0.00')

It is a currency field.


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



Re: Odd behaviour from Signals - dispatcher.connect

2007-06-15 Thread Malcolm Tredinnick

On Fri, 2007-06-15 at 03:17 -0700, Tipan wrote:
> 
> On Jun 14, 10:50 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
> wrote:
> > See django/db/models/loading.py, in the register_models() function.
> >
> > I'm not 100% certain that will be the right fix, but from reading the
> > ticket and the model dispatching code, it looked like the right idea.
> > Not a change worth making to core just yet, though, since Brian Harring
> > is rewriting signal dispatching, so it will either be done as part of
> > that or something we can fix when he's finished.
> >
> Thanks again Malcolm. I need to resolve this now so a workround is
> going to be essential.
> 
> I've looked through the loader.py code and although I understand the
> principle of what it's doing I'm not proficient enough in Python to
> execute the work round with ease.
> 
> My problem is how I can get the source filename of the object that is
> sending the signal and compare with that in the imported models.

One way would be to use Python's "inspect" module.

> I was planning to do this in the function that is run from the
> desptacher.connect statement.
> 
> For example - When I save to Table1, I want to update a total in Table
> 2. In my function, I was hoping to get the sourcefile name of the
> sender (Table1) and then check this with the imported models -
> wherever these reside.
> 
> Can you suggest a method (or line of code) that will help me establish
> the source details for comparison.
> 
> If the two don't match, I was then going to pass, so that it avoided
> the duplication.
> 
> Is this approach sound?

It might work. Try it out and see.

Regards,
Malcolm


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



Re: signals vs. save()

2007-06-15 Thread Malcolm Tredinnick

On Fri, 2007-06-15 at 14:53 +, Robert wrote:
> Hi,
> 
> What is a benefit of using django signals instead of modifying the
> save() method ?
> 
> Reading some code, I've noticed that many use counters columns in
> Models,
> and update with post_save() signal instead of doing this in save()
> method ?
> I understand them as it avoids of doing counts all the time (if not
> using cache).

For many cases, there's no benefit at all and using save() is by far the
most understandle way to code something. However, a save() method
applies to a particular model class. If you want to implement some
functionality that operates across multiple types of models, you need to
use the signal infrastructure, since the same signal is raised no matter
what the type of model (you can differentiate the model type in the
signal handler, though).

So for model-specific stuff, use save(). For something that is intended
to act across multiple model types, use signals.

Regards,
Malcolm



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



Re: Is it possible to give a verbose name to my projects ?

2007-06-15 Thread Malcolm Tredinnick

On Fri, 2007-06-15 at 13:43 +, olive wrote:
> Hello,
> 
> I can't remember if it is possible or not.
> 
> Is possible to have a different name for my projects in the admin Site
> Management panel ?

Not at the moment, no. There's an open ticket in Trac (which I can't
immediately hunt out -- try searching for summaries containing
"application" or "INSTALLED_APPS" or similar) that will add support for
this amongst other things. It hasn't been reviewed and finalised yet,
though.

Regards,
Malcolm



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



Re: ForeignKey reverse admin

2007-06-15 Thread Malcolm Tredinnick

On Fri, 2007-06-15 at 02:37 -0700, endi wrote:
> I have a little problem with ForeignKey's. It's easy to explain.
> My database model involves a many-to-one relationship which i would
> like to admin reversely.
> 
> ie. Articles and Authors, one Articles can have one Author, one
> Authors can have many Articles.
> 
> I would like to admin the thing from the Author, adding "child"
> Articles, instead of opening the article and setting its author.
> 
> Is it possible (and how) in the Django admin? Thank you!

No. It's not possible to do this in the admin.

Regards,
Malcolm



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



Re: Admin: Hiding fields from certain user groups

2007-06-15 Thread James Bennett

On 6/15/07, andyhume <[EMAIL PROTECTED]> wrote:
> Other than writing a new view for the change form, is there anything I
> can do to stop certain users or user groups from being able to edit a
> particular field of the model in the admin?

Not at the moment, no.

Please remember when considering the admin for a particular task that
the admin application was designed to be used only by people you
*trust* -- if you distrust them to the extent that you have to hide
parts of a model from them, then they probably shouldn't be
"administrators" of your site.

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

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



Re: Admin: Hiding fields from certain user groups

2007-06-15 Thread Bryan Chow

We have done this before by creating a second model with a different
fields definition in the Admin class, and then assigning the model to
the same database table by specifying db_table in the Meta class. This
allowed us to specify separate access permissions on each model, even
though both models were manipulating the same table.

Kind of a hack, but it worked.

(This was actually the impetus for submitting 
http://code.djangoproject.com/ticket/1766
)


On Jun 15, 10:04 am, andyhume <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> Other than writing a new view for the change form, is there anything I
> can do to stop certain users or user groups from being able to edit a
> particular field of the model in the admin?
>
> Cheers,
> Andy.


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



Re: Sitemap questions (probably dumb ones)

2007-06-15 Thread David Larlet

2007/6/15, John DeRosa <[EMAIL PROTECTED]>:
>
> David Larlet wrote:
> > 2007/6/13, John DeRosa <[EMAIL PROTECTED]>:
> >> David Larlet wrote:
> >>> 2006/12/7, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
>  I've been playing with the sitemap stuff and am finding it to be quite
>  slick. I do, however, have some questions about some unusual cases.
> 
>  1)It works beautifully for listing all the detail pages that make up a
>  list view, but what about the page that takes the list view? In my
>  case, For example, I've got all my guitar pages in there, but not the
>  "guitars" page itself.
> >> An list of objects returned in a sitemap can be for any page on your
> >> site.  The object will have an URL associated with it, as well as a
> >> frequency of change and priority, etc.  So you can make a list of
> >> objects that are entirely arbitrary, and as long as the URL returned for
> >> each object corresponds to a page on your site (i.e., as long as the URL
> >> returns a page on an HttpGet), everything works as you'd expect.
> >>
> > Is it possible that you just paste an example? Because I've tried with
> > a DummyModel with a get_absolute_url function and it doesn't work...
>
> Ah, that's your problem!  You need to define the method location(), not
> get_absolute_url()!
>
> See http://www.djangoproject.com/documentation/0.96/sitemaps/.
>
> An example:
>
> sitemap_classes.py:
> ***
> class BrowseTopicSitemap(Sitemap):
>  """Browse topic page."""
>  changefreq = "weekly"
>  priority = 0.9
>
>  def items(self):
>  """Return a list of objects represent the browse topic page.
>
>  The caller doesn't care what type of object these are; all that
> matters
>  is that these objects get passed to the location(), lastmod(),
>  changefreq() and priority() methods.
>  """
>  # Return a list containing the most recent topic on the site.
>  return
> [Topic.objects.filter(visible=True).order_by("-creation_time")[0]]
>
>  def location(self, obj):
>  """Return the absolute URL for the browse topic page "object"."""
>  return "/browse/"
>
>  def lastmod(self, obj):
>  """Etc..."""
>  
>  return result
>
>
> def sitemap_dict():
>  """Return the current sitemap dict."""
>  # Prepare mapping info for the static mapping sections.  Each of these
>  # sections aren't very large.
>  class_list = [("index", IndexSitemap),
>("browse", BrowseTopicSitemap),
>("author", AuthorSitemap),
>
>  ]
>
>
> *
>
>
> In the URL config:
> 
> urlpatterns += patterns('',
>  (r'^sitemap.xml$', "django.contrib.sitemaps.views.index",
>  sitemap_dict()),
>  (r'^sitemap-(?P.+).xml$',
> "django.contrib.sitemaps.views.sitemap",
>  sitemap_dict()),
>  )
> 
>
>
> John
>

Thanks for your suggestion, I've just done that:

class FakeObject(object):
def __init__(self, url):
self.url = url

class MainSitemap(Sitemap):
priority = 0.8

def items(self):
return [FakeObject('/'),
FakeObject('/archives/'),
...
]

def location(self, obj):
return obj.url

sitemaps = {
'index': MainSitemap(),
...
}

Any thoughts about this implementation?

David

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



CheckboxSelectMultiple error: Select a valid choice. That choice is not one of the available choices.

2007-06-15 Thread Gabriel Farrell

I've just replaced the RadioSelect widget with CheckboxSelectMultiple
for one field in my view.  Here's the relevant code:

self.fields['patron_type'] = forms.ChoiceField(choices=(
(pt.id, pt.name) for pt in patron_type_choices),
widget=widgets.CheckboxSelectMultiple())

It shows up fine in the browser, but now I receive the "Select a valid
choice. That choice is not one of the available choices." error no
matter which box I check on that field.  Have I missed something?

Gabe


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



Re: get subversion revision-number in a django-project

2007-06-15 Thread Joseph Heck

I don't know about Gabor, but I actually use it in a dashboard view on
my site to know what version of the software is deployed at any given
time. Very handy that way.

-joe

On 6/15/07, Udi <[EMAIL PROTECTED]> wrote:
>
> Mind if I ask why?
>
> Udi
>
>
> >
>

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



Re: Any new for MS SQL Server???

2007-06-15 Thread Jeremy Dunck

On 6/15/07, Bruno Tikami <[EMAIL PROTECTED]> wrote:
> I've
> already read the hole old bunch of topics and dicussions about this matter,
> jsut want to know if there is come news.

As far as I know, just what's been discussed on this 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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: why won't my wildcard url work?

2007-06-15 Thread [EMAIL PROTECTED]

Weird.. I cut and pasted the slug part from another URL that does
work. Anyways, that got it. Thanks!

On Jun 15, 2:00 pm, "Todd O'Bryan" <[EMAIL PROTECTED]> wrote:
> On Fri, 2007-06-15 at 11:44 -0700, [EMAIL PROTECTED] wrote:
> > I've got urls that could be /section/foo/slug/, /section/bar/slug/, /
> > section/whatever/slug/, so I'm trying to use a wildcard selector
> > (http://www.djangobook.com/en/beta/chapter03/#s-wildcard-urlpatterns)
>
> > I've tried lots of different ways, but the most promising seems to be
>
> > (r'^section/[^/]+/(?P[-w]+)/$', ... ),
>
> > If I'm reading right, that should match everything up to the next
> > slash, but no matter what I seem to try, I 404.
>
> It does. It's the slug that's not matching. [-w] will only match "-" or
> "w".
>
> Try:
>
> (r'^section/[^/]+/(?P(\w|-)+)/$, ...),
>
> and see if that works.
>
> Todd


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



Re: get subversion revision-number in a django-project

2007-06-15 Thread Udi

Mind if I ask why?

Udi


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



Re: why won't my wildcard url work?

2007-06-15 Thread Todd O'Bryan

On Fri, 2007-06-15 at 11:44 -0700, [EMAIL PROTECTED] wrote:
> I've got urls that could be /section/foo/slug/, /section/bar/slug/, /
> section/whatever/slug/, so I'm trying to use a wildcard selector
> (http://www.djangobook.com/en/beta/chapter03/#s-wildcard-urlpatterns)
> 
> I've tried lots of different ways, but the most promising seems to be
> 
> (r'^section/[^/]+/(?P[-w]+)/$', ... ),
> 
> If I'm reading right, that should match everything up to the next
> slash, but no matter what I seem to try, I 404.

It does. It's the slug that's not matching. [-w] will only match "-" or
"w".

Try:

(r'^section/[^/]+/(?P(\w|-)+)/$, ...),

and see if that works.

Todd


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



why won't my wildcard url work?

2007-06-15 Thread [EMAIL PROTECTED]

I've got urls that could be /section/foo/slug/, /section/bar/slug/, /
section/whatever/slug/, so I'm trying to use a wildcard selector
(http://www.djangobook.com/en/beta/chapter03/#s-wildcard-urlpatterns)

I've tried lots of different ways, but the most promising seems to be

(r'^section/[^/]+/(?P[-w]+)/$', ... ),

If I'm reading right, that should match everything up to the next
slash, but no matter what I seem to try, I 404.


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



Any new for MS SQL Server???

2007-06-15 Thread Bruno Tikami
Hi Django folks!

Does anyone have any news about Django supports to MS SQL Server? I've
already read the hole old bunch of topics and dicussions about this matter,
jsut want to know if there is come news.

Best regards my friends!

Tkm

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



Re: CSS on dev server, same old problem

2007-06-15 Thread alg

>  I can see the css files code on the web browser 
> through:http://145.23.6.135:8000/manager/appsmedia/css/css1.css

You're using an absolute path in the link element's href.


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



Admin: Hiding fields from certain user groups

2007-06-15 Thread andyhume

Hello all,

Other than writing a new view for the change form, is there anything I
can do to stop certain users or user groups from being able to edit a
particular field of the model in the admin?

Cheers,
Andy.


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



Re: Hosting for Django

2007-06-15 Thread Jay Parlar

On 6/15/07, arthur debert <[EMAIL PROTECTED]> wrote:
> In the end I've settle of webfaction. They have a very good setup with
> you own apache instance + mod_python, and it's very affordable. Great
> support as well.

I'll second that. I recently deployed a customer site on Webfaction,
and the experience has been pretty great. Their service really is
fantastic (especially their Django forum, which is one of their most
active forums).

Jay P.

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



Re: Sitemap questions (probably dumb ones)

2007-06-15 Thread John DeRosa

David Larlet wrote:
> 2007/6/13, John DeRosa <[EMAIL PROTECTED]>:
>> David Larlet wrote:
>>> 2006/12/7, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
 I've been playing with the sitemap stuff and am finding it to be quite
 slick. I do, however, have some questions about some unusual cases.

 1)It works beautifully for listing all the detail pages that make up a
 list view, but what about the page that takes the list view? In my
 case, For example, I've got all my guitar pages in there, but not the
 "guitars" page itself.
>> An list of objects returned in a sitemap can be for any page on your
>> site.  The object will have an URL associated with it, as well as a
>> frequency of change and priority, etc.  So you can make a list of
>> objects that are entirely arbitrary, and as long as the URL returned for
>> each object corresponds to a page on your site (i.e., as long as the URL
>> returns a page on an HttpGet), everything works as you'd expect.
>>
> Is it possible that you just paste an example? Because I've tried with
> a DummyModel with a get_absolute_url function and it doesn't work...

Ah, that's your problem!  You need to define the method location(), not 
get_absolute_url()!

See http://www.djangoproject.com/documentation/0.96/sitemaps/.

An example:

sitemap_classes.py:
***
class BrowseTopicSitemap(Sitemap):
 """Browse topic page."""
 changefreq = "weekly"
 priority = 0.9

 def items(self):
 """Return a list of objects represent the browse topic page.

 The caller doesn't care what type of object these are; all that 
matters
 is that these objects get passed to the location(), lastmod(),
 changefreq() and priority() methods.
 """
 # Return a list containing the most recent topic on the site.
 return 
[Topic.objects.filter(visible=True).order_by("-creation_time")[0]]

 def location(self, obj):
 """Return the absolute URL for the browse topic page "object"."""
 return "/browse/"

 def lastmod(self, obj):
 """Etc..."""
 
 return result


def sitemap_dict():
 """Return the current sitemap dict."""
 # Prepare mapping info for the static mapping sections.  Each of these
 # sections aren't very large.
 class_list = [("index", IndexSitemap),
   ("browse", BrowseTopicSitemap),
   ("author", AuthorSitemap),
   
 ]


*


In the URL config:

urlpatterns += patterns('',
 (r'^sitemap.xml$', "django.contrib.sitemaps.views.index",
 sitemap_dict()),
 (r'^sitemap-(?P.+).xml$', 
"django.contrib.sitemaps.views.sitemap",
 sitemap_dict()),
 )



John


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



signals vs. save()

2007-06-15 Thread Robert

Hi,

What is a benefit of using django signals instead of modifying the
save() method ?

Reading some code, I've noticed that many use counters columns in
Models,
and update with post_save() signal instead of doing this in save()
method ?
I understand them as it avoids of doing counts all the time (if not
using cache).

Example:
nr of posts posts in forum thread, scores.. etc.

When should I use post_save() and when should I use save() ?

Thanks,

--
Robert


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



Re: Path problems

2007-06-15 Thread Todd O'Bryan

I figured out the problem. I had missed adding the top-level module to
one of my

import settings

lines. The problem was that even with the debugging output, the actual
problem line never showed up in the exception trace. I actually found it
by using django-admin.py shell and then importing one of the views
modules that was giving me grief. Bingo, the evil import statement
appeared.

On Fri, 2007-06-15 at 09:33 -0400, Todd O'Bryan wrote:
> Hey all,
> 
> I'm trying to deploy a project I've been developing for a long time and,
> in preparation, have tried to move everything (including settings.py,
> etc.) into one overarching module. So, here's my setup: 
> [snip]
> django-admin.py validate --pythonpath=/home/tobryan1/workspace/dmi/src/
> --settings=dmi.settings
> 
> I get
> 
> dmi.orgs: No module named settings
> dmi.recommendations: No module named settings
> dmi.shared: No module named settings
> dmi.calendar: No module named settings
> dmi.assignments: No module named settings
> 5 errors found.



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



Re: Captcha module Version 1.1 ready for testing

2007-06-15 Thread Forest Bond
On Fri, Jun 15, 2007 at 09:48:02AM -0400, Forest Bond wrote:
> Do note that it must be symmetric, since you need to be able to decrypt the
> answer.

Sorry, this is not true.  It must not be a hash, anyway, and I don't see the
benefit of using public key crypto here.  To me, it makes the most sense to use
a symmetric algo.

-Forest


signature.asc
Description: Digital signature


Re: Hosting for Django

2007-06-15 Thread arthur debert

Hi Christian.

I've tried a few hosting setups in the paste year with various degrees
of success too. I've never been able to get a good, stable fcgi setup
myself.

In the end I've settle of webfaction. They have a very good setup with
you own apache instance + mod_python, and it's very affordable. Great
support as well.

If you need more control, meaning root access, a VPS will probably be
your best bet.

 Also, (mt) is working on a django-container.
> But I was disappointed the minute I knew they'd be running it off lighttpd +
> fcgi. They're working closely together with the two guys who made django, so
> I wonder what they'd be telling them about "the right way".
I am curious to see what Media Temple will come up with as well.

Cheers.
Arthur



On Jun 15, 7:53 am, Christian M Hoeppner <[EMAIL PROTECTED]> wrote:
> Hi there!
>
> This is a message for all those that have been successful in deploying django.
> It is not that I find myself unable to get a django project to show up in a
> web browser, but I'm wondering about "best practises", "the right way", and
> all that stuff.
>
> It's been hard to find a hosting provider giving a django-capable hosting
> solution at an affordable price, and I have found myself paying for a
> dedicated just for this matter.
>
> I have started a quest to gather all relevant information about django
> deployment, since I have found many lagoons in what I have found, including
> the django book's chapter "deploying django". They're talking about server
> farms and load balancing, but not a single side note is thrown about what
> some not-so-guru-like person might be wondering about when first deploying a
> django app.
>
> I can understand that you might think that apache and postgresql matters are
> out of scope. Maybe. But I don't think so. For the sake of completeness and
> comprehensiveness, I'll be seeking and throwing together whatever I might
> find usefull for all those django-noobs out there.
>
> Anyone up to help gathering? I might need some help :-)
>
> Sincerely,
> Chris Hoeppnerwww.pixware.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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Captcha module Version 1.1 ready for testing

2007-06-15 Thread Forest Bond
On Fri, Jun 15, 2007 at 09:55:30AM +0200, Martin Winkler wrote:
> 
> Am Thu, 14 Jun 2007 15:51:10 -0400
> schrieb Forest Bond <[EMAIL PROTECTED]>:
> 
> > You can do it without external persistence (sessions and/or database
> > table) by encrypting the correct response in the image filename.
> 
> So when the request to get the image is sent to django, we have to
> decrypt the solution according to the image's URL. In my
> opinion that raises some problems, because it could be decrypted by
> someone else too, unless you use a private/public key encryption,
> which means more work on the django server than using just hashed
> filenames like my approach does.

If encrypting the answer in the image filename, the encryption scheme would have
to be somewhat secure (or at least obscure enough to fool bots).  I should think
a simple symmetric algorithm using settings.SECRET_KEY.  It needn't be a strong
form of encryption, since the pay-off from breaking it hardly justifies even the
smallest computation time (for the bot, that is).  The simpler the algorithm,
the lower you server load, too.  Do note that it must be symmetric, since you
need to be able to decrypt the answer.

> Furthermore I don't see a real reason to generate images on the
> fly instead of storing them directly. My approach is quite speedy even
> with auto_cleanup, when there are many captcha images sitting in the
> filesystem all the time. I ran an apache benchmark test on my
> development machine (not the fastest hardware) multiple times where
> each of them creating 1000 captchas:

[...]

Performance wasn't my primary concern.  Writing images to the filesystem makes
scalability more challenging and increases the potential for race conditions.  I
avoid it as a matter of principle whenever possible.

Really, though, it's your code, do things however you want.

My guess is that django.contrib apps need to be a little more flexible, though.
It should be possible to use the app with or without filesystem writes (which
are not an option for all sites).  I'm also under the impression that the django
core devs are generally not huge fans of Captcha systems, but I could be making
that up.

-Forest


signature.asc
Description: Digital signature


Is it possible to give a verbose name to my projects ?

2007-06-15 Thread olive

Hello,

I can't remember if it is possible or not.

Is possible to have a different name for my projects in the admin Site
Management panel ?

Olive.


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



Path problems

2007-06-15 Thread Todd O'Bryan

Hey all,

I'm trying to deploy a project I've been developing for a long time and,
in preparation, have tried to move everything (including settings.py,
etc.) into one overarching module. So, here's my setup:

/dmi
__init__.py
manage.py (which I realize I now can't use)
settings.py
urls.py
/assignments
/calendar
/orgs
/recommendations
/shared

This is all inside a src folder in my Eclipse workspace.

When I run

django-admin.py validate --pythonpath=/home/tobryan1/workspace/dmi/src/
--settings=dmi.settings

I get

dmi.orgs: No module named settings
dmi.recommendations: No module named settings
dmi.shared: No module named settings
dmi.calendar: No module named settings
dmi.assignments: No module named settings
5 errors found.

I'm sure the problem must be something to do with my path and
where Django apps expect their settings to come from, but I can't
figure out what's going on. I've searched for explicit mention of
settings in my apps, but don't see anything. I thought maybe I
needed to use configure() or something, but I thought the --settings
option to django-admin.py would handle that.

Does anyone see the problem?

Todd


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



Re: Hosting for Django

2007-06-15 Thread Christian M Hoeppner

> Christian,
>
> I would think that the 'best way' is whatever suits you. If you're
> used to mod_python/mysql/apache, then use those. If you're more
> comfortable with a tinyhttpd/fcgi setup then use that.
>
> You'll find links on how to use these two setups on the main django
> site:
>
> http://www.djangoproject.com/documentation/modpython/
> http://www.djangoproject.com/documentation/fastcgi/
>
> If you've used neither then I would suggest trying the mod_python/
> apache route as you can then server the django app and the media all
> from the same place (if you want to).
>
> Hope that is of some help.
>
> Thanks,
>
> David

Hi David.

First, thanks for the reply.

I must note that I've been running on apache/mod_python for some time now, and 
it's pretty nice. I have not tested a fcgi setup yet, but I'm trying to find 
the time.

However, what I'm aiming to do is to build a documentation repository about 
running one's own webserver for django.

Sincerely,
Chris Hoeppner
www.pixware.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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Hosting for Django

2007-06-15 Thread David Reynolds

Christian,

I would think that the 'best way' is whatever suits you. If you're  
used to mod_python/mysql/apache, then use those. If you're more  
comfortable with a tinyhttpd/fcgi setup then use that.


You'll find links on how to use these two setups on the main django  
site:


http://www.djangoproject.com/documentation/modpython/
http://www.djangoproject.com/documentation/fastcgi/

If you've used neither then I would suggest trying the mod_python/ 
apache route as you can then server the django app and the media all  
from the same place (if you want to).


Hope that is of some help.

Thanks,

David


On 15 Jun 2007, at 11:53 am, Christian M Hoeppner wrote:



Hi there!

This is a message for all those that have been successful in  
deploying django.
It is not that I find myself unable to get a django project to show  
up in a
web browser, but I'm wondering about "best practises", "the right  
way", and

all that stuff.

It's been hard to find a hosting provider giving a django-capable  
hosting

solution at an affordable price, and I have found myself paying for a
dedicated just for this matter. Also, (mt) is working on a django- 
container.
But I was disappointed the minute I knew they'd be running it off  
lighttpd +
fcgi. They're working closely together with the two guys who made  
django, so

I wonder what they'd be telling them about "the right way".

I have started a quest to gather all relevant information about django
deployment, since I have found many lagoons in what I have found,  
including
the django book's chapter "deploying django". They're talking about  
server
farms and load balancing, but not a single side note is thrown  
about what
some not-so-guru-like person might be wondering about when first  
deploying a

django app.

I can understand that you might think that apache and postgresql  
matters are
out of scope. Maybe. But I don't think so. For the sake of  
completeness and
comprehensiveness, I'll be seeking and throwing together whatever I  
might

find usefull for all those django-noobs out there.

Anyone up to help gathering? I might need some help :-)

Sincerely,
Chris Hoeppner
www.pixware.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-users@googlegroups.com
To unsubscribe from this group, send email to django-users- 
[EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/ 
group/django-users?hl=en

-~--~~~~--~~--~--~---



--
David Reynolds
[EMAIL PROTECTED]




smime.p7s
Description: S/MIME cryptographic signature


Hosting for Django

2007-06-15 Thread Christian M Hoeppner

Hi there!

This is a message for all those that have been successful in deploying django. 
It is not that I find myself unable to get a django project to show up in a 
web browser, but I'm wondering about "best practises", "the right way", and 
all that stuff.

It's been hard to find a hosting provider giving a django-capable hosting 
solution at an affordable price, and I have found myself paying for a 
dedicated just for this matter. Also, (mt) is working on a django-container. 
But I was disappointed the minute I knew they'd be running it off lighttpd + 
fcgi. They're working closely together with the two guys who made django, so 
I wonder what they'd be telling them about "the right way".

I have started a quest to gather all relevant information about django 
deployment, since I have found many lagoons in what I have found, including 
the django book's chapter "deploying django". They're talking about server 
farms and load balancing, but not a single side note is thrown about what 
some not-so-guru-like person might be wondering about when first deploying a 
django app.

I can understand that you might think that apache and postgresql matters are 
out of scope. Maybe. But I don't think so. For the sake of completeness and 
comprehensiveness, I'll be seeking and throwing together whatever I might 
find usefull for all those django-noobs out there.

Anyone up to help gathering? I might need some help :-)

Sincerely,
Chris Hoeppner
www.pixware.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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Sitemap questions (probably dumb ones)

2007-06-15 Thread David Larlet

2007/6/13, John DeRosa <[EMAIL PROTECTED]>:
>
> David Larlet wrote:
> > 2006/12/7, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
> >> I've been playing with the sitemap stuff and am finding it to be quite
> >> slick. I do, however, have some questions about some unusual cases.
> >>
> >> 1)It works beautifully for listing all the detail pages that make up a
> >> list view, but what about the page that takes the list view? In my
> >> case, For example, I've got all my guitar pages in there, but not the
> >> "guitars" page itself.
>
> An list of objects returned in a sitemap can be for any page on your
> site.  The object will have an URL associated with it, as well as a
> frequency of change and priority, etc.  So you can make a list of
> objects that are entirely arbitrary, and as long as the URL returned for
> each object corresponds to a page on your site (i.e., as long as the URL
> returns a page on an HttpGet), everything works as you'd expect.
>
Is it possible that you just paste an example? Because I've tried with
a DummyModel with a get_absolute_url function and it doesn't work...

Anyway, thanks for your help.

David

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



Re: Odd behaviour from Signals - dispatcher.connect

2007-06-15 Thread Tipan


On Jun 14, 10:50 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> See django/db/models/loading.py, in the register_models() function.
>
> I'm not 100% certain that will be the right fix, but from reading the
> ticket and the model dispatching code, it looked like the right idea.
> Not a change worth making to core just yet, though, since Brian Harring
> is rewriting signal dispatching, so it will either be done as part of
> that or something we can fix when he's finished.
>
Thanks again Malcolm. I need to resolve this now so a workround is
going to be essential.

I've looked through the loader.py code and although I understand the
principle of what it's doing I'm not proficient enough in Python to
execute the work round with ease.

My problem is how I can get the source filename of the object that is
sending the signal and compare with that in the imported models.
I was planning to do this in the function that is run from the
desptacher.connect statement.

For example - When I save to Table1, I want to update a total in Table
2. In my function, I was hoping to get the sourcefile name of the
sender (Table1) and then check this with the imported models -
wherever these reside.

Can you suggest a method (or line of code) that will help me establish
the source details for comparison.

If the two don't match, I was then going to pass, so that it avoided
the duplication.

Is this approach sound?


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



Re: new forms and read-only rendering

2007-06-15 Thread eXt

On 14 Cze, 09:06, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> I think your expectations are a little different than what Django
> provides. Django gives you a framework for hndling the pieces of a
> project that can be automated most of the time. Laying out the
> information on a page is not one of those pieces, since it's very
> particular to each project.
Thanks for clarification.

> SThere isn't anything in core that takes a model and produces any sort
> of HTML static page for it.
Forms are such thing. Forms are able to render themselves as_p,
as_table etc. I thought that it is possible to render the form as read-
only (display mode). It is possible with zope formlib for example.

> It would be simple enough for you to write
> one for your own purposes if you wanted. Have a look at how, say,
> django.newsforms.utils.form_for_model() iterates over the fields and use
> that to generate a template string.
Right, but I wanted to be sure that I won't reinvent the wheel.

> The newforms portion is not appropriate for this though, since forms are
> for input, not static data presentation.
Why not? Formlib has a DisplayForm and it is really cool and useful.


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



CSS on dev server, same old problem

2007-06-15 Thread AnaReis

Hi,
I still don't understand if the Djangos' dev server allows the usage
of css files on a web page or if it only allows accessing the files
directly (for ex. http:something:8000/proj/appsmedia/css1.css shows
the css code on the browser).
If it does allow the usage of css on templates then here is my code:

On the urls.py:
(r'^manager/appsmedia/(?P.*)$', 'django.views.static.serve',
{'document_root': '/nobackup/reis/Project/Manager/templates/
appsmedia'}),

On the template:


The css files location:
/nobackup/reis/Project/Manager/templates/appsmedia/css/

I can see the css files code on the web browser through:
http://145.23.6.135:8000/manager/appsmedia/css/css1.css

Is there anything wrong here?
When I try viewing the page with the css applied I don't get any
formating at all... :(


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



Re: Generic Views: "Could not parse the remainder: % object.title %"

2007-06-15 Thread Martin Winkler

Am Thu, 14 Jun 2007 14:53:42 -0700
schrieb "Evan H. Carmi" <[EMAIL PROTECTED]>:
>  {{% object.title %}} 
>  {{% object.body %}} 

this is a syntax error and should be:
 {{ object.title }} 
 {{ object.body }} 

They are variables, and not tags.

just check http://djangoproject.com/documentation/templates/#variables

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



Generic Views: "Could not parse the remainder: % object.title %"

2007-06-15 Thread Evan H. Carmi

I am trying to use generic views for a hand built weblog app.

I am getting a template error of "Could not parse the remainder: %
object.title %"

My blog/urls.py is:
-
from django.conf.urls.defaults import *
from binarymanipulations.blog.models import Entry

info_dict = {
'queryset': Entry.objects.all(),
'date_field': 'pub_date',
}

urlpatterns = patterns('django.views.generic.date_based',

(r'^(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/(?P[-\w]+)/$',
'object_detail', dict(info_dict, slug_field='slug')),
(r'^(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/$',
'archive_day',  info_dict),
(r'^(?P\d{4})/(?P[a-z]{3})/$', 'archive_month',
   info_dict),
(r'^(?P\d{4})/$', 'archive_year', info_dict),
(r'^$', 'archive_index',info_dict),
)

-

My blog/models.py is:
-
from django.db import models
import datetime

# Create your models here.
class Entry(models.Model):
title = models.CharField(maxlength=255, core=True)
pub_date = models.DateTimeField(core=True)
slug = models.SlugField(maxlength=30, prepopulate_from= ['title'])
body = models.TextField(core=True)
class Admin:
fields = (
(None, {'fields': ('slug', 'title', 'pub_date', 'body',)}),
)

def __str__(self):
return self.title

-

My template/blog/entry_archive.html is:
-
{% extends blog_base.html %}

{% block content %}

{% for object in latest %}
 {{% object.title %}} 
 {{% object.body %}} 
{% endfor %}

{% endblock %}
-

I think my problem is that I am calling latest instead of something else
. I am not sure what the name for it should be. I tried to define a
template_object_name but that raised an error that it was unexpected.

Any help would be appreciated.

Thanks, Evan

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



ForeignKey reverse admin

2007-06-15 Thread endi

I have a little problem with ForeignKey's. It's easy to explain.
My database model involves a many-to-one relationship which i would
like to admin reversely.

ie. Articles and Authors, one Articles can have one Author, one
Authors can have many Articles.

I would like to admin the thing from the Author, adding "child"
Articles, instead of opening the article and setting its author.

Is it possible (and how) in the Django admin? Thank you!


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



Re: get subversion revision-number in a django-project

2007-06-15 Thread David Reynolds

Gabor,

On 15 Jun 2007, at 9:18 am, Gábor Farkas wrote:



hi,

in my project i need to get the svn-revision-number of the project  
somehow.


in other words, i need to be able to find out my project's revision
number in python

(i am not talking about django's revision-number. i'm talking about my
own revision number)


the best way i could find is to execute "svnversion" and get it's  
output.

i'm planning to do this in settings.py is there a better way?



How about using pysvn? [http://pysvn.tigris.org/] which I think is  
the same as doing apt-get install python-subversion on Debian. These  
give you python svn client bindings so you should be able to use that  
to find out the revision number.


Cheers,

Dave

--
David Reynolds
[EMAIL PROTECTED]




smime.p7s
Description: S/MIME cryptographic signature


get subversion revision-number in a django-project

2007-06-15 Thread Gábor Farkas

hi,

in my project i need to get the svn-revision-number of the project somehow.

in other words, i need to be able to find out my project's revision 
number in python

(i am not talking about django's revision-number. i'm talking about my 
own revision number)


the best way i could find is to execute "svnversion" and get it's output.
i'm planning to do this in settings.py is there a better way?

thanks,
gabor

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



Re: App.objects.get(user='John') error

2007-06-15 Thread Vincent Nijs

Thanks! That works.

Vincent


On 6/14/07 3:32 PM, "Iapain" <[EMAIL PROTECTED]> wrote:

> 
> Of course it'll give you error,  suppose your User is
> 
> class User(models.Model):
>   first_name = models.CharField(maxlength=256)
> 
> class App(models.Model):
>user = models.ForeignKey(User, unique=True, editable=False)
> 
> then use:
> try:
>   user_exists = Application.objects.get(user__first_name='john')
> except Application.DoesNotExist:
>   #whatever you want here
> 
> Cheers,
> Deepak
> 
> On Jun 15, 12:20 am, Vincent Nijs <[EMAIL PROTECTED]>
> wrote:
>> Hi,
>> 
>> I have the following model
>> 
>> class App(models.Model):
>> user = models.ForeignKey(User, unique=True, editable=False)
>> 
>> In a view I now want to check if a user is indeed in the database table. I
>> tried the following
>> 
>> user_exists = Application.objects.get(user='john')
>> 
>> But this give the following error:
>> 
>> invalid input syntax for integer: "john"
>> 
>> Any ideas on how to do this check?
>> 
>> Thanks,
>> 
>> Vi ncent
> 
> 
> > 

-- 
Vincent R. Nijs
Assistant Professor of Marketing
Kellogg School of Management, Northwestern University
2001 Sheridan Road, Evanston, IL 60208-2001
Phone: +1-847-491-4574 Fax: +1-847-491-2498
E-mail: [EMAIL PROTECTED]
Skype: vincentnijs




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



Re: Captcha module Version 1.1 ready for testing

2007-06-15 Thread Martin Winkler

Am Fri, 15 Jun 2007 14:53:59 +0800
schrieb "Nimrod A. Abing" <[EMAIL PROTECTED]>:

> I will be downloading your module and testing it out soon. 

Cool! I'd love to get some feedback especially with different setup
than I have.

> If I have patches for your module, do I send it here on django-users
> or can I send to you directly?

For patches it's better if you send them to me directly for the time
being. (Attachments on django-users are not a good idea, as far as I
know)
And maybe the module will be good enough for the django developers to
put into trunk soon? (can someone of the core developers inform me how
the chances are?)

Martin

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



Re: Captcha module Version 1.1 ready for testing

2007-06-15 Thread Martin Winkler

Am Thu, 14 Jun 2007 15:51:10 -0400
schrieb Forest Bond <[EMAIL PROTECTED]>:

> You can do it without external persistence (sessions and/or database
> table) by encrypting the correct response in the image filename.

So when the request to get the image is sent to django, we have to
decrypt the solution according to the image's URL. In my
opinion that raises some problems, because it could be decrypted by
someone else too, unless you use a private/public key encryption,
which means more work on the django server than using just hashed
filenames like my approach does.

Furthermore I don't see a real reason to generate images on the
fly instead of storing them directly. My approach is quite speedy even
with auto_cleanup, when there are many captcha images sitting in the
filesystem all the time. I ran an apache benchmark test on my
development machine (not the fastest hardware) multiple times where
each of them creating 1000 captchas:

With auto_cleanup:
captchas on disk at startRequests per second
first run   0  22.82
second run   1000  13.06
third run2000   9.16
fourth run   3000   7.02

Without auto_cleanup:
captchas on disk at startRequests per second
first run   0  39.05
second run   1000  39.45
third run2000  37.27
fourth run   3000  38.46

disk space used for 4000 captchas: 48MB

And these are really extreme cases, since they imply that no one of the
1000 visitors in each run ever submits a form back, so its captcha image
would be deleted automatically.

If you really have concerns regarding speed, you might use a cronjob
that deletes the old captchas in the background, so the whole system
stays very responsive.

If you have a compelling reason why this solution is bad, I'll be happy
to know. Otherwise I think, I'll stick with images in the filesystem.
In my opinion it's fast for most sites even with auto_cleanup, and for
really high volume sites just disable auto_cleanup, use your own
cronjob, and everything should be ok. Right now, I just can't see a
benefit in using images created on the fly.

Martin

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



Re: Captcha module Version 1.1 ready for testing

2007-06-15 Thread Nimrod A. Abing

On 6/15/07, Martin Winkler <[EMAIL PROTECTED]> wrote:
>
> Am Thu, 14 Jun 2007 12:00:11 +0800
> schrieb "Nimrod A. Abing" <[EMAIL PROTECTED]>:
>
> > Are you planning to implement a configuration to allow in-memory
> > images?
>
> One thing that annoys me with in-memory images is that you have to
> change your urls.py, and I want the CaptchaField as unobtrusive as
> possible. Furthermore this method needs some kind of session data
> stored somewhere, and therefore also cookies. All this annoys me a bit,
> to be honest.

Heheh, you nailed it right there. My own implementation requires both
a urls.py entry as well as session variables. Modifying urls.py is not
really a big issue with me. However, things get problematic when the
user does not have cookies enabled.

> > Characters that can confuse users have been removed from this set. But
> > some fonts are more legible than others, so it should be possible to
> > configure the characters to use. Are considering implementing this?
>
> Good idea! Although I already have used an incomplete alphabet for
> this, it seems natural that developers want to use their own "alphabet"
> - which might be only digits, and no characters.
> So I made a nice configuration possibility for my captcha module. You
> can define it in your settings.py, and also adjust individual forms, if
> you wish.

That's great!

> > 3. No "twists" are applied to characters. I have found that distorting
> > characters tends to confuse users even more. Will there be a
> > configuration that will disable "twists"?
>
> Yes. You can specify rotation, sizes, vertical positions and other
> values according to your needs. The only thing that is not so elegant
> is: all characters are aligned on top. That means that a lowercase
> character might look as if it is superscript. If you only use uppercase
> and numbers, then this is no problem.
> (BTW: The user can enter only lowercase characters - the captcha test
> is also successful, even if the image also shows uppercase characters)

Yes, that was actually one of the requirements for my project: to make
sure that lazy users are taken into account :)

I will be downloading your module and testing it out soon. If I have
patches for your module, do I send it here on django-users or can I
send to you directly?
-- 
_nimrod_a_abing_

http://abing.gotdns.com/
http://www.preownedcar.com/

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