Re: Upload image or select from existing

2007-06-29 Thread Andrews Medina

2007/6/29, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
>
> Hello,
>
> I have a model with ImageField, i want to let users to upload their
> own images or select existing from a list (images are used for article
> icon). How can i do that (esecially in admin if this is possible)?

I can create a other model for images.

ex:

class Entry(models.Model):
title = model.CharField(maxlength=50)
image = models.ForeignKey(Image)
...

class Admin:
pass

class Image(models.Model):
picture = models.ImageField(upload_to='/images/')

class Admin:
pass

-- 
Andrews Medina
http://pyman.blogspot.com/
www.andrewsmedina.com.br

--~--~-~--~~~---~--~~
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: use Django's database layer for a regular python program?

2007-06-29 Thread ahlongxp

I found python shelve module quite suitable for my need.
Thanks anyway.


--~--~-~--~~~---~--~~
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: Announcing the birth of Fluther.com

2007-06-29 Thread Andrew

Hi David,

"Real-time" means that if you're in the same discussion as another
member, you can see them crafting their response in real-time (similar
to the ellipsis you see during an iChat) -- something that's happening
more and more as we keep doubling our users.

We only "use" the data we have to automagically build people's
profiles and match/filter questions that may interest them. We will
never share any information (email, IM, etc) with any third party
unless we're compelled to by law or imminent danger (perhaps a suicide
note or something similar).

Does that answer your questions? Should we make the privacy policy
more explicit?

Best,
Andrew

On Jun 29, 4:42 pm, "David M. Besonen" <[EMAIL PROTECTED]> wrote:
> the interface looks good and appears to function well.
>
> On Wed, June 27, 2007 4:03 pm, Andrew wrote:
> > with some new twists like real-time discussion
>
> what exactly does "real-time" mean?
>
> i read the privacy statement.  how do you plan on using the
> data you gather?
>
> peace,
> 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: Using more than one database in the project

2007-06-29 Thread Ben Ford
Hi Ana,
I'm hoping that I'll get an answer from someone in the next few days and be
able to check these changes in. Otherwise I can send you the patch. Help
with the testing would be ideal, it's one of the week areas! One of the
tests is broken to the extent that it locks the dajngo_session table in the
test db (under postgres) completely and I have to close bash to kill it!
I'll let you know :-)
Ben

On 29/06/07, AnaReis <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
> Do you already have an ETA for that? If there is anything I can do to
> help, even if just testing, I'd be glad to help, since I really need
> this module for my project.
> Ana
>
> On Jun 28, 10:21 am, "Ben Ford" <[EMAIL PROTECTED]> wrote:
> > Hi
> > There is a branch that supports multiple databases and I'm working on
> > getting the merges I've made from trunk checked in at the moment...
> That's
> > probably your best bet, watch this space!
> > Ben
> >
> > On 28/06/07, AnaReis <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> >
> > > Hi!
> > > As I said in previous posts I'm a newbie in these django stuff.
> > > I'm creating a project that consists in a web based GUI for managing
> > > some databases. This project has several modules. The user is
> > > presented with a start page where it is possible to chose which
> > > database to manage.
> > > I have now finished working on one of the databases module and
> > > everything is running smoothly.
> > > I will now have to start working with another database but I have no
> > > idea how to do this. The problem is, the server runs with a certain
> > > settings.py file, in this settings file I have my database
> > > configuration information. How can I use another database if the
> > > settings file only has information about one database?
> > > Another question I have is, the user will have to login before
> > > entering the system. When using sessions with Django, there is a table
> > > "django_session" that is created on the database that you are using.
> > > My problem is, if the user has to login and after loggin the user can
> > > access any of the databases, where should I store this table? It
> > > doesn't make sense to make the user login again each time there is a
> > > need to go manage a different database.
> > > I'm kind of lost and a bit stuck here because I have no idea how to
> > > deal with these two problems.
> > > I read several other posts about this matter but none of them seemed
> > > to help me.
> >
> > --
> > Regards,
> > Ben Ford
> > [EMAIL PROTECTED]
> > +628111880346
>
>
> >
>


-- 
Regards,
Ben Ford
[EMAIL PROTECTED]
+628111880346

--~--~-~--~~~---~--~~
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: how I can get the proper get_absolute_url?

2007-06-29 Thread SmileyChris

I'm guessing your model defines a foreign key to User. Use that
instead of User.username (so, for example, self.user.username).


--~--~-~--~~~---~--~~
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: how I can get the proper get_absolute_url?

2007-06-29 Thread [EMAIL PROTECTED]

It could be that I don't understand the question, but don't you need
to use reverse() to resolve the url from the model? A quick google
search found this blog posting showing what I thought was the way to
do it: 
http://blog.micampe.it/articles/2007/01/06/a-little-django-feature-nobody-tells-you-about

On Jun 29, 9:59 am, "Young Gyu Park" <[EMAIL PROTECTED]> wrote:
> I think it is better to show my code
>
> This is my models's get_absoute_url function
>
> def get_absolute_url(self):
> return ('blog.views.tag_main', None, {'username':User.username,
> 'slug': str(self.Slug)})
> get_absolute_url = permalink(get_absolute_url)
>
> This is a part of my urls.py which is equivalent to above model.
>
> urlpatterns = patterns('blog.views',
> (r'^(?P\w+)/$', 'main'),
> (r'^(?P\w+)/page/(?P\d+)/$', 'main'),
> (r'^(?P\w+)/tag/(?P[-\w]+)/$', 'tag_main'),
> (r'^(?P\w+)/id/(?P\d+)/$', 'entry_detail'),
> )
>
> On 6/29/07, Young Gyu Park <[EMAIL PROTECTED]> wrote:
>
>
>
> > I try to get the proper get_absolute_url.
>
> > Under the this circumstances.
>
> > I have username parameter in my URL.
>
> > like thishttp://.../(? .
>
> > I need to pass this username parameter to the get_absolute_url function.
>
> > But I don't know how to get the proper username. Because the User model is
> > out of the the model where I manage the get_absolute_url.
>
> > Can you have any clue? or Is there anyone who have experienced the similar
> > this?
>
> > Thanks always.


--~--~-~--~~~---~--~~
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: how I can get the proper get_absolute_url?

2007-06-29 Thread Young Gyu Park
I think it is better to show my code

This is my models's get_absoute_url function

def get_absolute_url(self):
return ('blog.views.tag_main', None, {'username':User.username,
'slug': str(self.Slug)})
get_absolute_url = permalink(get_absolute_url)


This is a part of my urls.py which is equivalent to above model.

urlpatterns = patterns('blog.views',
(r'^(?P\w+)/$', 'main'),
(r'^(?P\w+)/page/(?P\d+)/$', 'main'),
(r'^(?P\w+)/tag/(?P[-\w]+)/$', 'tag_main'),
(r'^(?P\w+)/id/(?P\d+)/$', 'entry_detail'),
)


On 6/29/07, Young Gyu Park <[EMAIL PROTECTED]> wrote:
>
>
> I try to get the proper get_absolute_url.
>
> Under the this circumstances.
>
> I have username parameter in my URL.
>
> like this http://.../(? .
>
> I need to pass this username parameter to the get_absolute_url function.
>
> But I don't know how to get the proper username. Because the User model is
> out of the the model where I manage the get_absolute_url.
>
> Can you have any clue? or Is there anyone who have experienced the similar
> this?
>
> Thanks always.
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



how I can get the proper get_absolute_url?

2007-06-29 Thread Young Gyu Park
I try to get the proper get_absolute_url.

Under the this circumstances.

I have username parameter in my URL.

like this http://.../(? .

I need to pass this username parameter to the get_absolute_url function.

But I don't know how to get the proper username. Because the User model is
out of the the model where I manage the get_absolute_url.

Can you have any clue? or Is there anyone who have experienced the similar
this?

Thanks always.

--~--~-~--~~~---~--~~
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: Working '/comments/flag/[comment.id here]/' examples?

2007-06-29 Thread Jeremy Dunck

On 6/29/07, JHeasly <[EMAIL PROTECTED]> wrote:
...
> 'UserFlagManager' object has no attribute 'objects'

Very odd.  UserFlag has an objects attribute which is an of
UserFlagManager.  Looking at the svn source, I don't see how UserFlag
in views.userflags.flag() could refer to a UseFlagManager object
rather than the UserFlag model.  :-/

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Upload image or select from existing

2007-06-29 Thread [EMAIL PROTECTED]

Hello,

I have a model with ImageField, i want to let users to upload their
own images or select existing from a list (images are used for article
icon). How can i do that (esecially in admin if this is possible)?

Sorry if i missed similar topic, but i spent whole night googling
around.


--~--~-~--~~~---~--~~
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: prettier html

2007-06-29 Thread Michael Trier

Make sure you have an __init__.py in that directory.

Michael

On 6/29/07, Carl Karsten <[EMAIL PROTECTED]> wrote:
>
> Carl Karsten wrote:
> > Christian Joergensen wrote:
> >> Carl Karsten wrote:
> >>> nicely formated template code generates lots of CRs in the resulting 
> >>> html.  I am
> >>> trying to figure out how to make the html a bit easier to read.
> >>>
> >>> for instance, how can I make this:
> >>>
> >>>  >>> {% ifequal day.day day.today %} class="today"{% endifequal %}>
> >>>
> >>> Not put the CR inside the  ?
> >>>
> >>> I realize i may be asking for magic, but I am thinking maybe something 
> >>> like skip
> >>> the CR for lines ending with %}
> >> I used something like this once. However, you should think twice before
> >> adding it on a busy site.
> >
> > This is just for development.  Once it goes into production I don't care 
> > what
> > the html looks like as much.
> >
> >> from BeautifulSoup import BeautifulSoup
> >>
> >> class BeautifulSoupPrettifyMiddleware(object):
> >>
> >> def process_response(self, request, response):
> >>
> >> if 'text/html' in response['Content-Type']:
> >>
> >> soup = BeautifulSoup(response.content)
> >> response.content = soup.prettify()
> >>
> >> return response
> >>
> >
> > This will help. Where do I put that code?
>
> http://www.djangoproject.com/documentation/middleware/
>
> Now to figure out
> MIDDLEWARE_CLASSES = ( ...
>  'gtd.adjenda.middleware.bsp.BeautifulSoupPrettifyMiddleware',
>
> ImproperlyConfigured: Error importing middleware gtd.adjenda.middleware.bsp: 
> "No
> module named adjenda.middleware.bsp"
>
> ImproperlyConfigured: Error importing middleware middleware.bsp: "No module
> named middleware.bsp"
>
>
> Carl K
>
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Working '/comments/flag/[comment.id here]/' examples?

2007-06-29 Thread JHeasly

Hello,

I've been poking around the SVN Comments and
django.contrib.comments.views.userflags.

I've got the URL "/comments/flag/[comment.id here]/" working the
"first" time, i.e. like it's used on an ljworld.com story page, where
it returns an "are you sure?" page and a "Yes, go ahead" form button
that POSTs flagging the comment. In my example, when I click to POST I
get:

'UserFlagManager' object has no attribute 'objects'

The "/comments/flag/[comment.id here]/" POST action URL dispatches to
django.contrib.comments.models.UserFlag, which imports
UserFlagManager, which then throws the error. After that, I'm
scratching my head.

I'm stumped. Any suggestions as to where to look for working Comment
(not FreeComment) models?

Regards,
John


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



Re: Announcing the birth of Fluther.com

2007-06-29 Thread David M. Besonen

the interface looks good and appears to function well.


On Wed, June 27, 2007 4:03 pm, Andrew wrote:

> with some new twists like real-time discussion

what exactly does "real-time" mean?


i read the privacy statement.  how do you plan on using the
data you gather?


peace,
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: Announcing the birth of Fluther.com

2007-06-29 Thread leifbyron

Thanks for the info, Andrew. Best of luck, and please keep us updated!


--~--~-~--~~~---~--~~
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: Variables available to all templates

2007-06-29 Thread Nathaniel Whiteinge

A `related thing`__ came up on the Django Dev list this week.

I'm not that old-school. :-) I use that `{% if user.is_authenticated
%}` all over my site and it's a pain to import and call all the stuff
you need for render_to_response over and over. So this is what I
changed all my views to this week::

from django.views.generic.simple import direct_to_template

def my_view(self):
return direct_to_template(request, 'my_template.html', {
'extra-context': 'goes here',
})

.. __: 
http://groups.google.com/group/django-developers/browse_thread/thread/e0a59d1eaa84c7b4/#

- whiteinge



On Jun 29, 12:13 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
> On 6/29/07, Kirk Strauser <[EMAIL PROTECTED]> wrote:
> ...
>
> > return render_to_response('index.html', 
> > context_instance=RequestContext(request))
> ...
>
> > My only concern is that it would seem that I'll need to manually build and
> > pass in a RequestContext for every single view, since I want to have a login
> > or logout link at the top of each one.  Is that correct?
>
> render_to_response(template_name, context_instance=None, **kwargs) is
> a shortcut over this:
>
> t = get_template(template_name)
> c = context_instance or Context()
> c.update(kwargs)
> return HttpResponse(t.render(c))
>
> So passing in context_instance is still shorter.
>
> If you still don't like it, you could use
> django.views.generic.direct_to_template as the last line instead of
> render_to_response.
>
> I guess I'm old school-- I still generally use the longer form.  :)


--~--~-~--~~~---~--~~
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: Flickr / Django

2007-06-29 Thread [EMAIL PROTECTED]

Here's a model and syncronization script I wrote:
http://www.djangosnippets.org/snippets/299/

BW

On May 25, 3:14 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Hi everyone,
>
> I'm trying to write a view that displays a selection from someFlickr
> groups on a page.
>
> I'm unsure where to begin...
>
> I've read this:
>
> http://code.djangoproject.com/wiki/FlickrIntegration
>
> But unsure whether to use FlickrClient or FlickrApi
>
> http://beej.us/flickr/flickrapi/
>
> http://micampe.it/projects/flickrclient
>
> Any help in pointing me in the right direction would be greatly
> appreciated! Thanks!!!


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



Re: prettier html

2007-06-29 Thread Carl Karsten

Carl Karsten wrote:
> Christian Joergensen wrote:
>> Carl Karsten wrote:
>>> nicely formated template code generates lots of CRs in the resulting html.  
>>> I am 
>>> trying to figure out how to make the html a bit easier to read.
>>>
>>> for instance, how can I make this:
>>>
>>> >> {% ifequal day.day day.today %} class="today"{% endifequal %}>
>>>
>>> Not put the CR inside the  ?
>>>
>>> I realize i may be asking for magic, but I am thinking maybe something like 
>>> skip 
>>> the CR for lines ending with %}
>> I used something like this once. However, you should think twice before
>> adding it on a busy site.
> 
> This is just for development.  Once it goes into production I don't care what 
> the html looks like as much.
> 
>> from BeautifulSoup import BeautifulSoup
>>
>> class BeautifulSoupPrettifyMiddleware(object):
>>
>> def process_response(self, request, response):
>>
>> if 'text/html' in response['Content-Type']:
>>
>> soup = BeautifulSoup(response.content)
>> response.content = soup.prettify()
>>
>> return response
>>
> 
> This will help. Where do I put that code?

http://www.djangoproject.com/documentation/middleware/

Now to figure out
MIDDLEWARE_CLASSES = ( ...
 'gtd.adjenda.middleware.bsp.BeautifulSoupPrettifyMiddleware',

ImproperlyConfigured: Error importing middleware gtd.adjenda.middleware.bsp: 
"No 
module named adjenda.middleware.bsp"

ImproperlyConfigured: Error importing middleware middleware.bsp: "No module 
named middleware.bsp"


Carl K

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



extends admin/change_list.html bug?

2007-06-29 Thread Vincent Nijs

Hi,

I created a page that

{% extends "admin/change_list.html" %}

Everything is working fine except, for some reason, the page doesn't show
the links in {% block userlinks %} when I use apache but it *does* show them
when I use the development server. The code is exactly the same on both
setups.

These are the 'documentation, change password, logout' links you see on any
standard admin page, and I *do* see them on admin pages on my apache setup.

The apache setup does find the admin css stuff fine so I don't think that
the apache configuration could be the problem. Also, I can customize
admin/base.html just fine.

Any ideas what could be going on? I am using svn 5559.

Thanks,

Vincent





On 6/29/07 1:56 PM, "Matthew Nuzum" <[EMAIL PROTECTED]> wrote:

> 
> Just wondering if there's any additional information I can give that
> might help get some suggestions on this topic. I'd really love to get
> some advice.
> 
> On Jun 28, 4:30 pm, Matthew  Nuzum <[EMAIL PROTECTED]> wrote:
>> So here it is:http://webapps.ubuntu.com/course_locator/
>> 
>> Click on Canada, and see what would ideally be a cross tab.
>> 
>> The problem is, I'd like to have the event dates for training events
>> for the same course in the same town on the same row (notice that
>> several rows there differ only in the fact that the training date is
>> in August instead of July). I know how to do this in SQL just fine,
>> but as I've found, the SQL way is not always the ideal way in Django.
>> 
>> I'm happy to share my model and view code, but just imagine a non-
>> normalized, ultra-simple model, and that's what I've done. (two
>> models, Partners and Events)
>> 
>> The end goal is to display all events in the next three months for a
>> given country.
>> 
>> Can anyone share some suggestions on how to get a cross tab the Django
>> way?
> 
> 
> > 

-- 




--~--~-~--~~~---~--~~
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: crosstabs

2007-06-29 Thread Matthew Nuzum

Just wondering if there's any additional information I can give that
might help get some suggestions on this topic. I'd really love to get
some advice.

On Jun 28, 4:30 pm, Matthew  Nuzum <[EMAIL PROTECTED]> wrote:
> So here it is:http://webapps.ubuntu.com/course_locator/
>
> Click on Canada, and see what would ideally be a cross tab.
>
> The problem is, I'd like to have the event dates for training events
> for the same course in the same town on the same row (notice that
> several rows there differ only in the fact that the training date is
> in August instead of July). I know how to do this in SQL just fine,
> but as I've found, the SQL way is not always the ideal way in Django.
>
> I'm happy to share my model and view code, but just imagine a non-
> normalized, ultra-simple model, and that's what I've done. (two
> models, Partners and Events)
>
> The end goal is to display all events in the next three months for a
> given country.
>
> Can anyone share some suggestions on how to get a cross tab the Django
> way?


--~--~-~--~~~---~--~~
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: prettier html

2007-06-29 Thread Carl Karsten

Christian Joergensen wrote:
> Carl Karsten wrote:
>> nicely formated template code generates lots of CRs in the resulting html.  
>> I am 
>> trying to figure out how to make the html a bit easier to read.
>>
>> for instance, how can I make this:
>>
>> > {% ifequal day.day day.today %} class="today"{% endifequal %}>
>>
>> Not put the CR inside the  ?
>>
>> I realize i may be asking for magic, but I am thinking maybe something like 
>> skip 
>> the CR for lines ending with %}
> 
> I used something like this once. However, you should think twice before
> adding it on a busy site.

This is just for development.  Once it goes into production I don't care what 
the html looks like as much.

> 
> from BeautifulSoup import BeautifulSoup
> 
> class BeautifulSoupPrettifyMiddleware(object):
> 
> def process_response(self, request, response):
> 
> if 'text/html' in response['Content-Type']:
> 
> soup = BeautifulSoup(response.content)
> response.content = soup.prettify()
> 
> return response
> 

This will help. Where do I put that code?

Carl K

--~--~-~--~~~---~--~~
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: prettier html

2007-06-29 Thread Carl Karsten

Doug Van Horn wrote:
> On Jun 29, 12:20 pm, Carl Karsten <[EMAIL PROTECTED]> wrote:
>> for instance, how can I make this:
>>
>> > {% ifequal day.day day.today %} class="today"{% endifequal %}>
>>
>> Not put the CR inside the  ?
> 
> Is that line broken by a line break inserted by you?

yes.  to keep my if's things somewhat easy to read.

 >  I would think
> this would achieve your desired result (the following contains no line
> breaks by me):
> 
>  ifequal day.day day.today %} class="today"{% endifequal %}>

which leads to super long lines in the template, which makes reading the 
template code hard to read.

Carl K

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Top 300 Freeware Software

2007-06-29 Thread JAVED AS
*TOP 300 FREEWAR E SOFTWARES
Download Free Free Free
http://thinktarget.net/TOP_300_software.htm
*
*
*
-- 
www.thinktarget.net

-- 
www.thinktarget.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-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: prettier html

2007-06-29 Thread Doug Van Horn

On Jun 29, 12:20 pm, Carl Karsten <[EMAIL PROTECTED]> wrote:
> for instance, how can I make this:
>
>  {% ifequal day.day day.today %} class="today"{% endifequal %}>
>
> Not put the CR inside the  ?

Is that line broken by a line break inserted by you?  I would think
this would achieve your desired result (the following contains no line
breaks by me):




I might be missing something here...


--~--~-~--~~~---~--~~
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: Variables available to all templates

2007-06-29 Thread Jeremy Dunck

On 6/29/07, Kirk Strauser <[EMAIL PROTECTED]> wrote:
...
> return render_to_response('index.html', 
> context_instance=RequestContext(request))
...
>
> My only concern is that it would seem that I'll need to manually build and
> pass in a RequestContext for every single view, since I want to have a login
> or logout link at the top of each one.  Is that correct?

render_to_response(template_name, context_instance=None, **kwargs) is
a shortcut over this:

t = get_template(template_name)
c = context_instance or Context()
c.update(kwargs)
return HttpResponse(t.render(c))

So passing in context_instance is still shorter.

If you still don't like it, you could use
django.views.generic.direct_to_template as the last line instead of
render_to_response.

I guess I'm old school-- I still generally use the longer form.  :)

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



Re: Django Template

2007-06-29 Thread Doug Van Horn

On Jun 29, 12:59 pm, dystopia <[EMAIL PROTECTED]> wrote:
> [snip]... Would I
> then have have to implement the functionality of this in every view by
> calling an cartSummary method and pushing that out into the template?
> Or is it better to somehow compile all this functionality into a
> template tag itself - if that's possible?
>
> Any ideas appreciated,
>
> James

I've taken the latter approach in my projects.  Something like:

{% load cart_tags %}
{% get_cart as cart %}
{% for items in cart %}
...
{% endfor %}

Then, you might put that code somewhere higher up in the template
hierarchy:

{% block shopping_cart %}

{% endblock %}

or you might include it as a template:

{% include "shopping_cart.snippet..html" %}

Whatever you do, I would recommend taking the approach of loading the
shopping cart a tag.

That's my opinion, anyway.

doug.


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



Re: Django Template

2007-06-29 Thread Tim Chase

> What I can't quite grasp with django is, suppose I have a three column
> layout for a shopping site and I wanted to show  a summary of the
> carts contents on MOST of my pages in the third column ... Would I
> then have have to implement the functionality of this in every view by
> calling an cartSummary method and pushing that out into the template?
> Or is it better to somehow compile all this functionality into a
> template tag itself - if that's possible?

Sounds like the template tag is what you're looking for.  Basic
template tags are pretty easy and there are some nice helper
functions that facilitate the process.  They're detailed in the
documentation for template tags.  That way, your view only needs
the brains to pass in what's needed for the template tag's
context, and the template can choose to render the tag or skip
rendering the tag.

-tim



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Get Paid to Surf ADs... I am already Paid

2007-06-29 Thread coolguy17111987

[red]Get Paid to Surf ADs[/red]


Hi all

Now you can get paid to surf ads..All you need to do is register on
their site, surf ads for 30 seconds.
And you will be credited with the earning immediately. Ist'nt dat
amazing. Many of you must have already joined, for rest dont
wait...hurry up...
Sooner you join more you earn
Give it a try...No cheat in it...scrap me if you have any problem..



[b]Copy and paste following link in your address bar..[/b]



[blue]http://adbux.org/?r=madhur1987[/blue]




[blue]http://bux.to/?r=madhur1987[/blue]


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Get Paid to Surf ADs... I am already Paid

2007-06-29 Thread coolguy17111987

[red]Get Paid to Surf ADs[/red]


Hi all

Now you can get paid to surf ads..All you need to do is register on
their site, surf ads for 30 seconds.
And you will be credited with the earning immediately. Ist'nt dat
amazing. Many of you must have already joined, for rest dont
wait...hurry up...
Sooner you join more you earn
Give it a try...No cheat in it...scrap me if you have any problem..



[b]Copy and paste following link in your address bar..[/b]



[blue]http://adbux.org/?r=madhur1987[/blue]




[blue]http://bux.to/?r=madhur1987[/blue]


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



Django Template

2007-06-29 Thread dystopia

Hi,

MVC is still a bit alien to me but I'm slowly getting to grips with
it. I've previously used languages like PHP in conjunctions with
template engines such as Smarty.

What I can't quite grasp with django is, suppose I have a three column
layout for a shopping site and I wanted to show  a summary of the
carts contents on MOST of my pages in the third column ... Would I
then have have to implement the functionality of this in every view by
calling an cartSummary method and pushing that out into the template?
Or is it better to somehow compile all this functionality into a
template tag itself - if that's possible?

Any ideas appreciated,

James


--~--~-~--~~~---~--~~
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: prettier html

2007-06-29 Thread Christian Joergensen
Carl Karsten wrote:
> nicely formated template code generates lots of CRs in the resulting html.  I 
> am 
> trying to figure out how to make the html a bit easier to read.
> 
> for instance, how can I make this:
> 
>  {% ifequal day.day day.today %} class="today"{% endifequal %}>
> 
> Not put the CR inside the  ?
> 
> I realize i may be asking for magic, but I am thinking maybe something like 
> skip 
> the CR for lines ending with %}

I used something like this once. However, you should think twice before
adding it on a busy site.

from BeautifulSoup import BeautifulSoup

class BeautifulSoupPrettifyMiddleware(object):

def process_response(self, request, response):

if 'text/html' in response['Content-Type']:

soup = BeautifulSoup(response.content)
response.content = soup.prettify()

return response

-- 
Christian Joergensen | Linux, programming or web consultancy
http://www.razor.dk  | Visit us at: http://www.gmta.info



signature.asc
Description: OpenPGP digital signature


caching between successive calls to model.objects.all()?

2007-06-29 Thread [EMAIL PROTECTED]

$ ./oui3/manage.py shell
Python 2.4.3 (#1, Jun 13 2006, 16:41:45)
[GCC 4.0.2 20051125 (Red Hat 4.0.2-8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from oui3.mon.models import User
>>> User.objects.all()
[, , ]

(then, in another shell:)

mysql> update user set username='test-wsy' where username='test-wsx';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

(back in the first shell:)

>>> User.objects.all()
[, , ]

and yes, mysql auto-commit is on.
i'm using the multi-db branch.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



prettier html

2007-06-29 Thread Carl Karsten

nicely formated template code generates lots of CRs in the resulting html.  I 
am 
trying to figure out how to make the html a bit easier to read.

for instance, how can I make this:



Not put the CR inside the  ?

I realize i may be asking for magic, but I am thinking maybe something like 
skip 
the CR for lines ending with %}

Carl K

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



Using a closure as a callback.

2007-06-29 Thread Doug Van Horn

I have a design approach I've been kicking around and thought the
group might have some opinions on the subject.

Here's the scenario.  You're on a web page and you're filling in data
for a new Widget to add to your inventory.  In the middle of the form
you see that you need to create a new Type for this Widget.  You click
on the 'Add Type' link/button and one of the following happens,
depending on the design of the application:

1.  An AJAXy div pops up, you fill in the Type information, click
save, and the new Type is selected on your form.
2.  You leave your Create Widget page, go to the Create Type page,
enter the data, click save, and you are returned to the Create Widget
page with new Type selected on your form.

The first scenario is straight-forward, whiz-bangy, and doesn't work
without javascript.  It's definitely an option, but not what I want to
discuss.

The second scenario is what I'm curious about.  The problem to solve
in that scenario is where does the Create Widget form data get stored
while you're off creating a Type?  You can put it in the session, or
you can put it in private data on the Create Type form.  Once the Type
is created or canceled, you need to redirect back to the Create Widget
form with the form data, with the data possibly modified to indicate
the new Type is selected.

The solution I tried with this was to create a closure at the jumping
off point, that is when the user decides they need to go off and
create a new Type.  The closure contains the form data and, when
executed, returns a response rendering the Create Widget page.

This allows me to write my Create Type view with very little knowledge
about how it was called.  In it, after a post or cancel, I check to
see if there is a closure (callback) available (red flag here,
discussed below), and execute it with the current request and the
selected type, if available.

I like the way this works, but there's certainly nothing novel about
the approach.  Paul Graham describes this approach in how they did
things at ViaWeb way back in the day, which was my inspiration for
trying this.

The aforementioned red flag (as pointed out to me by an expert Python
user I'm working with) is that the closure/callback is not
serializable, and thus the approach falls apart when you start load
balancing your application (I store the closures in a stack for each
session key as a 'global' variable).

I really like the intent of the approach, in that a view doesn't have
to know how it's being used, it can simply forward off to whatever
might be in the stack, or take it's own action if nothing is there.
But how do you get around the serialization problem?  Or can you?  Or
do you end up hacking it up so much that there's a better way to do
it, like just storing the form data and a function name in a 'stack'
on the user session?

Long winded, dry, and quite possibly moot and uninteresting.  But hey,
I thought I'd throw it out there...  If you have any thoughts on the
subject or are willing to share how you approached this (common?)
problem I'd be happy to read them!

doug.


--~--~-~--~~~---~--~~
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: Variables available to all templates

2007-06-29 Thread Kirk Strauser

On Friday 29 June 2007, Derek Hoy wrote:
> How are you producing your index page?  If you look in the docs,
> you'll see the warning about needing a RequestContext- if that's not
> being used in the view that is loading the index.html into a response
> then the template won't have any user info even if you are logged in..

Ahh, gotcha.  I changed my index view to:

def index(request):
return render_to_response('index.html', 
context_instance=RequestContext(request))

My only concern is that it would seem that I'll need to manually build and
pass in a RequestContext for every single view, since I want to have a login
or logout link at the top of each one.  Is that correct?
-- 
Kirk Strauser

--~--~-~--~~~---~--~~
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: Variables available to all templates

2007-06-29 Thread Derek Hoy

How are you producing your index page?  If you look in the docs,
you'll see the warning about needing a RequestContext- if that's not
being used in the view that is loading the index.html into a response
then the template won't have any user info even if you are logged in..

Hope that makes some sense.

Dersk

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Internationalization of templates

2007-06-29 Thread Peter Melvyn
Hi,

I'm beginner in Django and I have a question about internationalization
support.
If my understanding of i18n is correct, there are 3 basic approaches:
1. for  views  _() function
2.  for templates {% trans ... %} block
3. for static files URL containing language code

Templates containing more static texts I'd like organize in separated
folders e.g.
app/templates/de/tpt1.html
  en/tpt1.html
and pass their names e.g. to render_to_response() function. But I'm not
sure if I can do that, because  TEMPLATE_DIRS
contains absolute pathes to folders, where Django will
look for templates files
by name. Is it possible to pass something like 'de/tpt1.html'  as
'template_name' argument?

Thanks, Peter

--~--~-~--~~~---~--~~
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: Variables available to all templates

2007-06-29 Thread Kirk Strauser

On Friday 29 June 2007, Jeremy Dunck wrote:

> What's your MIDDLEWARE_CLASSES setting look like?

I have:

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

-- 
Kirk Strauser

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Filter a single trans tag

2007-06-29 Thread KiD

Hi everybody,

I'm searching for a short way of applying a filter to a translated
text. I've found some "complex" ways, but I think that probably
there's one shorter.

What i want can be done (for example) by:
{% filter title %}{% trans 'my text' %}{% endfilter %}
{% blocktrans with 'my text'|title as titled %}{{ titled }}{%
endblocktrans %}

But I'm looking for a shorter way, someting like:
{% trans 'my text'|title %}
{% _('mytext')|title %}

that of course doesn't work.

Thanks!
  Marc


--~--~-~--~~~---~--~~
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: Variables available to all templates

2007-06-29 Thread Jeremy Dunck

On 6/29/07, Kirk Strauser <[EMAIL PROTECTED]> wrote:
> I hate it when you feel *so close* to finding the answer but can't make that
> final little leap.  :-)

Hmm.

What's your MIDDLEWARE_CLASSES setting look like?

--~--~-~--~~~---~--~~
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: application autentication

2007-06-29 Thread Werner

On 29 Jun., 09:29, Enquest <[EMAIL PROTECTED]> wrote:
> If I where to write a small application with Django that needs
> authentication on the user level (only edit what you or a group can
> edit)... Can I then use the authention model for this?

Yes, this may help you too ->
http://code.google.com/p/django-registration/

> And will the authentication lib change before we hit 1.0 ... My main
> concern would be that something on the database level would change.

As far i remember from a blog entry, there should be only slight
changes, but who knows?


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Generating Xml in Django

2007-06-29 Thread sago

If you're using Django to generate XML that isn't RSS, Sitemaps or an
external SOAP library, my Xml generation module at

http://djangonflex.wordpress.com/2007/06/29/xml-generation-module/

might be useful. I'm using Django to talk to Flex, so need to generate
custom XML dialects all the time.

You could use templates, of course, but they make more sense for
presentation markup, rather than data markup.

There's a user guide in the file, and samples on the blog.

Let me know any suggestions / bugs.

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-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: Variables available to all templates

2007-06-29 Thread Kirk Strauser

On Friday 29 June 2007, Jeremy Dunck wrote:

> Yep, that doesn't make sense.  Something else is going on.
>
> Is it possible that the view servicing /accounts/login is calling
> auth.login?

From urls.py (copied and pasted from 
http://www.djangoproject.com/documentation/authentication/):

urlpatterns = patterns(
[...],
(r'^accounts/login/$', 'django.contrib.auth.views.login'),
)

> Or perhaps caching somewhere?

No, there's no caching involved.  It's a bare-bones Apache+mod_python setup.

> Or perhaps a different project entirely which has a different template
> inheritance chain?

This is my first Django project.

I hate it when you feel *so close* to finding the answer but can't make that 
final little leap.  :-)
-- 
Kirk Strauser

--~--~-~--~~~---~--~~
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 django a good solution for non-CMS web-apps?

2007-06-29 Thread Nic James Ferrier

walterbyrd <[EMAIL PROTECTED]> writes:

> I have been reading that django is good for CMS type sites, but not
> especially good for other types of web applications. For example:
> financial applications. I have read that TurboGears is better for
> those other apps.

That seems like nonsense.

I am building 3 apps on django. None of them is a CMS.

I hate frameworks. But as frameworks go, django is a good one.

-- 
Nic Ferrier
http://www.tapsellferrier.co.uk   

--~--~-~--~~~---~--~~
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 django a good solution for non-CMS web-apps?

2007-06-29 Thread KpoH

No doubt. You can do with django whatever you want. not only CMS system.
You even can do not use entire Django, but only part of it (ORM for
example).
In my company we write VoIP software using Django for instance.
and it's very nice ;)
thx for all django developers.

walterbyrd write:
> I have been reading that django is good for CMS type sites, but not
> especially good for other types of web applications. For example:
> financial applications. I have read that TurboGears is better for
> those other apps.
>
> I am not sure why this would be true. Except, maybe, because TG has
> some sort of built-in ajax stuff.
>
> Let's suppose I wanted to build a web-based CRM: would django be the
> best tool to use?
>   

-- 
Artiom Diomin, Development Dep, "Comunicatii Libere" S.R.L.
http://www.asterisksupport.ru
http://www.asterisk-support.com


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



Re: Variables available to all templates

2007-06-29 Thread Jeremy Dunck

On 6/29/07, Kirk Strauser <[EMAIL PROTECTED]> wrote:
...
> ...which yields the text "Welcome, kirk. Thanks for logging in."  I'm
> finding this somewhat confusing in that page_template knows my name if
> I'm viewing the login page but not the main index.html.

Yep, that doesn't make sense.  Something else is going on.

Is it possible that the view servicing /accounts/login is calling auth.login?

Or perhaps caching somewhere?

Or perhaps a different project entirely which has a different template
inheritance chain?

--~--~-~--~~~---~--~~
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

2007-06-29 Thread Jeremy Dunck

On 6/29/07, Sebastian <[EMAIL PROTECTED]> wrote:
> Im still not sure, however, that the definition
> of how it gets rendered
> in hml should be anywhere but the template.

Ah, so if I read that right, you'd be in favor of an optional mapping
from field to widget supplied by the template.

Right now a template is a tree of nodes which return byte strings.
Templates don't know anything about widgets.

Maybe a subclass of Template could provide that mapping and
get_template and friends could take an optional parameter for which
Template class to use.

Or would you need mappings based on something other than template type?

If I'm on the wrong track, please outline what you think is a sensible API.

--~--~-~--~~~---~--~~
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: Variables available to all templates

2007-06-29 Thread Kirk Strauser

Derek Hoy wrote:
> Take a look at this:
> http://www.djangoproject.com/documentation/authentication/#authentication-data-in-templates
>
> You can use this to put something in a base template that all your
> site templates can be based on.
>
> Derek

Well, here's my sitewide template that everything else extends:

---



http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
  
{% block title %}Title goes here{% endblock %}
  
  
{% if user.is_authenticated %}
Welcome, {{ user.username }}. Thanks for logging in.
{% else %}
Welcome, new user. Please http://www.example.com/
accounts/login/">log in.
{% endif %}

{% block content %}The author didn't have much to say.{% endblock
%}
  


---

Whenever I visit that page, I get the "Welcome, new user. Please log
in." message.  But if I click that link, I get this page template:

---

{% extends "page_template.html" %}

{% block content %}

{% if form.has_errors %}
Your username and password didn't match. Please try again.
{% endif %}



Username:{{ form.username }}
Password:{{ form.password }}



http://www.example.com/"; />


{% endblock %}

---

...which yields the text "Welcome, kirk. Thanks for logging in."  I'm
finding this somewhat confusing in that page_template knows my name if
I'm viewing the login page but not the main index.html.

BTW, this is using Django 0.96 on FreeBSD 6-STABLE.
--
Kirk Strauser


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Is django a good solution for non-CMS web-apps?

2007-06-29 Thread walterbyrd

I have been reading that django is good for CMS type sites, but not
especially good for other types of web applications. For example:
financial applications. I have read that TurboGears is better for
those other apps.

I am not sure why this would be true. Except, maybe, because TG has
some sort of built-in ajax stuff.

Let's suppose I wanted to build a web-based CRM: would django be the
best tool to use?


--~--~-~--~~~---~--~~
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: nested function

2007-06-29 Thread Jeremy Dunck

On 6/29/07, dailer <[EMAIL PROTECTED]> wrote:
...
> found my answer on comp.lang.python (these nested functions are a bit
> crazy)...

For this example:

def foo(msg1):
   def bar(msg2):
   print msg1, msg2
   return bar

if it helps, you can consider the parent declaration (foo) to be an
object (instance) without an explicit class declaration.

Also, naming generally helps.


def make_prefix(prefix):
   def finish_message(rest_of_message):
   print prefix, rest_of_message
   return finish_message

finish_laughing = make_prefix('haha')

Clearer?

--~--~-~--~~~---~--~~
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

2007-06-29 Thread Sebastian

Yes, Sorry I meant view not middleware.
I suppose the question is ultimatly an question of taste.

I do completly agree that form processing is complex, and that error
checking should
be done in the view. Im still not sure, however, that the definition
of how it gets rendered
in hml should be anywhere but the template. Thanks for all your help
though, it always helps
to get other peoples' perspecive.

Kind regards,
Sebastian

On Jun 29, 2:01 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
> On 6/29/07, Sebastian <[EMAIL PROTECTED]> wrote:
>
> > From my point of view, however, the problem remains
> > that the the widget definition
> > is still in the middleware.
>
> I think you mean view?
>
> > it seems to be the most logical place to do it.
>
> Not to me-- form processing is fairly complex, considering that you
> might wish to do extra work for validation errors or use custom
> fields.


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



Re: django authorization of apache

2007-06-29 Thread Robin Becker

Steven Armstrong wrote:
>
> You could then pass the groups, or whatever else you need, to the 
> handler using PythonOption directives.
> 
> e.g.
> 
> AuthType basic
> AuthName "djauth test"
> Require valid-user
> SetEnv DJANGO_SETTINGS_MODULE djauth.settings
> PythonOption DjangoGroups XXX group2 group3
> PythonAuthenHandler path.to.my.auth.handler
..

well I hacked contrib/auth/handlers/modpython.py and now have group checking 
with this code

# check the password and any permission given
if user.check_password(req.get_basic_auth_pw()):
 G = [] #find required groups
 S = filter(None,map(str.split,map(str.strip,req.requires(
 map(G.extend,[filter(None,s[1:])
 for s in S if s[0].lower()=='group'])
 for g in user.groups.all():
 if g.name in G:
 G.remove(g.name)
 if G: #fail if some required groups remain
 return apache.HTTP_UNAUTHORIZED

 if permission_name:
 if user.has_perm(permission_name):
 return apache.OK
 else:
 return apache.HTTP_UNAUTHORIZED
 else:
 return apache.OK
else:
 return apache.HTTP_UNAUTHORIZED


-- 
Robin Becker

--~--~-~--~~~---~--~~
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: nested function

2007-06-29 Thread dailer


On Jun 27, 8:52 pm, dailer <[EMAIL PROTECTED]> wrote:
> I created a validator for use in a validator_list in the admin
> interface like so...
>
> def startDate_EndDate_CrossValidation(modelName):
> def result(field_data, all_data):
>   
>
>  being new to python, I stole this from an example somewhere. I have
> these 3 attributes, but how do I call this? I tried following the
> django code, but it's a bit over my head at this point.

found my answer on comp.lang.python (these nested functions are a bit
crazy)...

http://groups.google.com/group/comp.lang.python/browse_thread/thread/edcd4a30b02e45d5/c2b2f243654e8cbc?lnk=gst&q=nested+functions&rnum=6#c2b2f243654e8cbc


def foo(msg1):
def bar(msg2):
print msg1, msg2
return bar

hmm = foo('haha')
hmm('gotcha')

# prints
haha gotcha


--~--~-~--~~~---~--~~
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: nested function

2007-06-29 Thread dailer


On Jun 27, 8:52 pm, dailer <[EMAIL PROTECTED]> wrote:
> I created a validator for use in a validator_list in the admin
> interface like so...
>
> def startDate_EndDate_CrossValidation(modelName):
> def result(field_data, all_data):
>   
>
>  being new to python, I stole this from an example somewhere. I have
> these 3 attributes, but how do I call this? I tried following the
> django code, but it's a bit over my head at this point.

found my answer on comp.lang.python (these nested functions are a bit
crazy)...

http://groups.google.com/group/comp.lang.python/browse_thread/thread/edcd4a30b02e45d5/c2b2f243654e8cbc?lnk=gst&q=nested+functions&rnum=6#c2b2f243654e8cbc


def foo(msg1):
def bar(msg2):
print msg1, msg2
return bar

hmm = foo('haha')
hmm('gotcha')

# prints
haha gotcha


--~--~-~--~~~---~--~~
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

2007-06-29 Thread Jeremy Dunck

On 6/29/07, Sebastian <[EMAIL PROTECTED]> wrote:
> From my point of view, however, the problem remains
> that the the widget definition
> is still in the middleware.

I think you mean view?

> it seems to be the most logical place to do it.

Not to me-- form processing is fairly complex, considering that you
might wish to do extra work for validation errors or use custom
fields.

--~--~-~--~~~---~--~~
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

2007-06-29 Thread Sebastian


> > Does anyone have an alternative method for dynamically specifying the
> > widget of a Form.Field? I do realize this could be done in a similar
> > fashion to the CSS, but I believe specifying a Django object as a
> > parameter to a template filter would then violate my front-end.
>
> I use newforms.form_for_model(...) to get my form classes; using them,
> you can just override the widget used at any time before instantiating
> the form itself:
>
> MyFormClass.base_fields['password'].widget = widgets.PasswordInput()
>
> It looks like you can do the same for the form itself, just substitute
> your form's name for MyFormClass

Thank you very much for the prompt reply. This is a great way of
changing widgets. From my point of view, however, the problem remains
that the the widget definition
is still in the middleware. Id like to define the Field widget in my
templates without using a django
object (ie. widgets.PasswordInput() ).  Im not sure if this even
possible, but it seems to be the most logical place to do it.

Kind regards,
Sebastian


--~--~-~--~~~---~--~~
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

2007-06-29 Thread Michael Sylvan



On Jun 29, 4:16 pm, Sebastian <[EMAIL PROTECTED]> wrote:
> Hello Django users,
>

>  password = forms.CharField(label ='Password',
>required = True,
>max_length =20,
>widget =widgets.PasswordInput())
>
> Does anyone have an alternative method for dynamically specifying the
> widget of a Form.Field? I do realize this could be done in a similar
> fashion to the CSS, but I believe specifying a Django object as a
> parameter to a template filter would then violate my front-end.
>
I use newforms.form_for_model(...) to get my form classes; using them,
you can just override the widget used at any time before instantiating
the form itself:

MyFormClass.base_fields['password'].widget = widgets.PasswordInput()

It looks like you can do the same for the form itself, just substitute
your form's name for MyFormClass.

HTH,

--
M. Sylvan


--~--~-~--~~~---~--~~
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: Developing a flexible CMS

2007-06-29 Thread anderson . santos . br

Hello everyone, I am talking to a friend to find a good solution for
this question and finally write our own CMS. I am really thinking
about how to create a flexible CMS and don't break django or don't
rework a lot of stuff.
So, what I do believe is that we have to focus on a Management System
then Content, and a flexible system should be able to go as far as we
want.
So, I like the idea of a page, but I do believe that a "portlet" is
more useful then a page content. So, with this in mind, we have to
think about a subapplication to be shown on a page, and not a bit of a
rock to put on the screen. But, of course, the simplest portlet will
be just a "content-link", but if I want something more complex, I can
do it and without the necessity of to write a new template tag,
because, if I am not a programmer I will get stucked and Django
solution won't be my solution.

A CMS is to make my website easier to grow, and not to create
barriers.

And about managing multiple objects of a model, we MUST remember that
THERE IS Django's  Manager and that's what we have to work on. So, I
think that our answer for this question resides on there. Django is
flexible, powerful, but "young" and don't have "much" automated
because WE don't know the perfect solution yet. But I don't believe it
will be far from the actual implementation.

Not rework, but improve Django, that's the way for a Real django
powered CMS that I would like to see.





On 27 jun, 01:03, sime <[EMAIL PROTECTED]> wrote:
> Hi Kyle, I've run into the same problems before. I think you'll find
> Django admin is great for simple operations involving single records
> and the most basic relations. But for anything beyond that, you'll
> probably need to roll your own admin page.
>
> On Jun 25, 1:15 am, Kyle Fox <[EMAIL PROTECTED]> wrote:
>
> > I hope I can explain this well, because I've been wracking my poor
> > little brain trying to figure out how to do this :)
>
> > I'm trying to create a flexible CMS.  I want it to be easy for users
> > to create a Page, and attach all kinds of content ("components") to
> > that page.  These components would all be Model classes.  Here are two
> > simple examples of the components I had in mind:
>
> > class TextSnippet(models.Model):
> > body = models.TextField()
>
> > class Photo(models.Model):
> > image = models.ImageField(upload_to="photos")
>
> > The idea is that a user add an arbitrary number of these components to
> > a Page model.  A Page model is nothing more than a container to hold
> > components, and a URL associated with the Page, something like:
>
> > class Page(models.Model):
> > url = models.CharField( maxlength=100, unique=True,
> > validator_list=[validators.isAlphaNumericURL])
>
> > The problem is that I can't figure out a good way to associate
> > instances of TextSnippet and Photo with a page.  It's obviously a many-
> > to-many between the components and pages (a component like a photo can
> > be on many pages, and a page can have many components), but I also
> > need to store more information about that particular page-component
> > relationship, for example a IntegerField that specifies the
> > component's position on that page.  Here's what I've come up with so
> > far:
>
> > class PageComponent(models.Model):
> > page = models.ForeignKey(Page, related_name="components",
> > edit_inline=models.TABULAR)
> > content_type = models.ForeignKey(ContentType)
> > object_id = models.IntegerField(core=True)
> > position = models.IntegerField(default=0, blank=True)
>
> > It "works" not too bad.  Conceptually (from the shell), I think it
> > does what I want.  However, I'm having a HECK of a time getting the
> > Page form in the admin to work in an intuitive way.  When adding
> > components to a page, the user sees a drop-down list of content_types,
> > and has to enter an object_id.  It works for me because I know what to
> > put for the object_id, but a regular user wouldn't
>
> > I think this would require me to write a custom form class for adding
> > and editing a page, but with these relationships I really don't even
> > know where to begin :S
>
> > If anyone can provide advice (or just flat out tell me if I'm thinking
> > about this wrong), it would be much appreciated!
>
> > Thanks,
> > Kyle


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



Re: Django, shared hosting memory limits and memory optimization

2007-06-29 Thread Remi

> > > BTW, if you run 'ldd' on the mod_python.so file from the Apache
> > > modules directory, does it use Python as a shared library or is there
> > > no reference to libpython2.?.so at all, meaning it is embedded with in
> > > mod_python.so? What is the actual size of your mod_python.so file?
>
> > mod_python.so is about 4MB. It doesn't show libpython2.x.so as one of
> > the shared libraries.
>
> Which shows that the Python installation on the box is really crappy.
> One of the problems with using RedHat derived distributions.
>
> That the mod_python.so is so large means that there is no shared
> library built and provided with the Python installation, or at least
> not with the version that mod_python was compiled against.
> Alternatively, there is a shared library, but it is only in /usr/lib
> and not along side the libpython2.?.a file in /usr/lib/python2.?/
> config directory.
>
> In other words, when mod_python was built, all it found in the /usr/
> lib/python.2?/config directory was the static library archive. As a
> consequence, 'libtool' when it creates the mod_python.so file has no
> choice but to extract all the object files from the static Python
> library and embed them into mod_python.so itself. Thus, instead of
> mod_python.so being less than 0.5MB through being able to link
> dynamically to the Python library it is much larger.
>
> Worse is that the size of mod_python.so indicates that debug may have
> been compiled into the Python library. For an optimised build of the
> Python library it is normally only about 1MB, not over 3MB as in this
> case.
>
> Even more worse than that, is what now happens when that mod_python.so
> is loaded by Apache. Now the way I understand it, normally a
> dynamically loaded module should really be shared and thus memory cost
> only applies once across all processes that load it, however, if the
> object files in that static Python library are not truly position
> independent, when mod_python.so gets loaded, the dynamic linker will
> have to perform address relocations to fixup references to function
> and data from the Python library objects. As a consequence, rather
> than being shared memory, the mod_python.so becomes private memory to
> the parent Apache process. When Apache forks off the child processes,
> they in turn will each end up with their own private copy of up to 4MB
> of memory that mod_python.so consumes when it could all have been
> shared. So, even on a fresh restart, the Apache processes are going to
> be much larger than they need to be because of the way that Python was
> built in the first place.
>
> Now whether this is going to happen like this I am not 100% sure as it
> can depend on the operating system and perhaps the age of the
> operating system version as well and how they handle loading of
> dynamically loadable modules. I am led to believe that this can occur
> on Solaris, to what degree it applies on different Linux versions I am
> not as sure.
>
> Either way, that debug seems to be built into your Python library is
> not good. IfWebfactionused a better build of Python with
> optimisation and a shared library they could quite easily cut down on
> memory use allowing your applications to have more space within their
> set limit.
>
> What is even more annoying is that various people run around
> continually saying how crap mod_python is because of how much memory
> it uses, when in practice a lot of it has to do with poorly built
> Python versions as I show above. :-(
>
> > > Base Django setup can take up 5-7MB without even your own stuff so it
> > > can jump up quite a bit. Is that 35MB in total across all processes or
> > > per process?
>
> > About 4MB for the parent process, and 13MB for the two child
> > processes.
>
> > > What version of mod_python are you using?
>
> > 3.2.8.
>
> Which has various memory leaks. Even 3.2.10 has memory leaks. I highly
> recommend upgrading to mod_python 3.3.1 if you can do it as it
> eliminates a lot of memory leaks. If you also do a rebuild of Python
> with optimisation and a shared library you should hopefully see less
> memory being used then at startup.

Just a quick update to mention that we've taken these comments into
account and we've optimized our Django setup at WebFaction:

- Django apps now comes with mod_python-3.3.1 by default

- mod_python is now compiled with a shared libpython.so (the size of
mod_python.so went from 3MB down to 300KB).

- you can now choose between Python-2.4 or Python-2.5 when creating a
Django app.


Remi
--
WebFaction - Hosting for an agile web
http://www.webfaction.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
-~--~~

New Forms

2007-06-29 Thread Sebastian

Hello Django users,

I have  a quick question about new Forms in Django 0.96. I am finding
that the line between my front-end and the middleware is starting to
blur due to the new forms library. I have managed to add  css to form
field widgets dynamically through the use of template filters which,
in my optinion ,does not violate the model-view-controller
architecture. However, things become a bit more difficult when I want
a form.CharField object to be rendered dynamically as a  element. It seems that the only provided place to
accomplish this is in the Field's declaration itself:

 password = forms.CharField(label ='Password',
   required = True,
   max_length =20,
   widget =widgets.PasswordInput())

Does anyone have an alternative method for dynamically specifying the
widget of a Form.Field? I do realize this could be done in a similar
fashion to the CSS, but I believe specifying a Django object as a
parameter to a template filter would then violate my front-end.

Kind regards,


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



Re: Using more than one database in the project

2007-06-29 Thread AnaReis

Hi,
Do you already have an ETA for that? If there is anything I can do to
help, even if just testing, I'd be glad to help, since I really need
this module for my project.
Ana

On Jun 28, 10:21 am, "Ben Ford" <[EMAIL PROTECTED]> wrote:
> Hi
> There is a branch that supports multiple databases and I'm working on
> getting the merges I've made from trunk checked in at the moment... That's
> probably your best bet, watch this space!
> Ben
>
> On 28/06/07, AnaReis <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > Hi!
> > As I said in previous posts I'm a newbie in these django stuff.
> > I'm creating a project that consists in a web based GUI for managing
> > some databases. This project has several modules. The user is
> > presented with a start page where it is possible to chose which
> > database to manage.
> > I have now finished working on one of the databases module and
> > everything is running smoothly.
> > I will now have to start working with another database but I have no
> > idea how to do this. The problem is, the server runs with a certain
> > settings.py file, in this settings file I have my database
> > configuration information. How can I use another database if the
> > settings file only has information about one database?
> > Another question I have is, the user will have to login before
> > entering the system. When using sessions with Django, there is a table
> > "django_session" that is created on the database that you are using.
> > My problem is, if the user has to login and after loggin the user can
> > access any of the databases, where should I store this table? It
> > doesn't make sense to make the user login again each time there is a
> > need to go manage a different database.
> > I'm kind of lost and a bit stuck here because I have no idea how to
> > deal with these two problems.
> > I read several other posts about this matter but none of them seemed
> > to help me.
>
> --
> Regards,
> Ben Ford
> [EMAIL PROTECTED]
> +628111880346


--~--~-~--~~~---~--~~
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: One-to-one relationship (model inheritance) or generic relations?

2007-06-29 Thread Jamie Pittock

Russ,

Really useful response, thanks.

I had thought about your third option but as I figured there'd be a
lot of empty fields I didn't give it much consideration.  I might
actually go down that route until I have a better understanding of
generic relations.

Thanks again.
j.

On Jun 29, 2:20 am, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On 6/28/07, Jamie Pittock <[EMAIL PROTECTED]> wrote:
>
>
>
> > I don't want to code myself into a corner, so when I start looking at
> > features such as allowing users to search all venues would I be best
> > with one parent model or will I be ok keeping them separate?   The
> > different types of venues have quite a number of different attributes
> > btw which is why they are different models rather than simply
> > categoried.
>
> Model inheritance sounds good on paper, but in practice, it gets
> somewhat inconvenient - lots of table joins to get at basic
> attributes, etc. If you have very few common attributes anyway,
> generic relations are probably worth investigation.
>
> However, as always, YMMV. My only reservation in recommending generic
> relations is that they aren't fully integrated with admin yet (though
> there is a patch floating around to integrate them with
> newforms-admin), and they're not fully documented. However, if you're
> willing to put up with those limitations, it sounds like they could be
> a good match for your needs.
>
> A third approach that you haven't mentioned is to have a single
> 'object' table that is sparse; i.e., instead of
>
> class Bar(Model):
>name = CharField()
>number_of_bartenders = IntegerField()
>
> class Club(Model):
>name = CharField()
>music_style = CharField()
>
> you have a single model that has all the fields:
>
> class Venue(Model):
>name = CharField()
>venuetype = CharField(choices=(('b','bar'),('c','club'))
>number_of_bartenders = IntegerField(null=True)
>music_style = CharField(null=True)
>
> This way you spend a little more time in data validation (making sure
> that you have all the columns that you need for any given row), and
> you waste a little space in the database, but lookups will be a little
> faster (as no joins are required).
>
> 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-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
-~--~~~~--~~--~--~---



application autentication

2007-06-29 Thread Enquest

If I where to write a small application with Django that needs
authentication on the user level (only edit what you or a group can
edit)... Can I then use the authention model for this?

And will the authentication lib change before we hit 1.0 ... My main
concern would be that something on the database level would change. 

thanxs


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



searching problem

2007-06-29 Thread brian muhumuza
Hi,
I'm trying to write a search to search through my models but i have a
feeling i'm doing it the wrong way.
The search string is almost always many words long. So i split the search
string into individual words.

I need to search and find records that contain all the words searched.
I don't know how to auto generate Q objects, so i tried to auto generate the
SQL and do a search like:

results = Profile.objects.extra (where=[generate_code(**params)] )

the code i generate with the generate_code() method has percent (%) signs (
i.e. WHERE details LIKE '%string%' ) but django thinks i'm trying to pass
other parameters.

I have a feeling I'm doing this the wrong way? has any one done something
like this before

-- 

Happy day

-
Brian

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---