Re: MEDIA and STATIC in a nutshell?

2011-05-13 Thread Shawn Milochik

Did you read the docs?
http://docs.djangoproject.com/en/1.3/ref/contrib/staticfiles/

To use the staticfiles app you need to not only put the right things in 
settings.py, but also run manage.py collectstatic to gather up all your 
static content, then rsync/copy/whatever that content to the proper 
location on your server so that the stuff you put in settings.py is valid.


Same thing for media, to some extent (no 'collectstatic' analog). 
Django's not going to serve your media or your static content in 
production. That's going to be up to your Web server 
(Apache/nginx/lighttpd/whatever), and setting that up properly is your 
job. It's way outside of the scope of Django to do this for 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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: all data of all manyToMany relations lost!

2011-05-13 Thread ?manu*
Maybe I found the offending command!! Here is what I wrote:


# T is some model in my model.py
opts = T._meta
fields = opts.fields
fields.extend(opts.many_to_many)
...

This is awful! I'm erroneously modifying the fields value of my
model!

E.

On 13 Mag, 23:45, "?manu*"  wrote:
> Dear experts,
>
> today I was inspecting the ManyToMany relations in the _meta subclass
> of a Model class of my database. At some time I realized that all data
> associated to such relations was lost in the database! The
> corresponding tables are empty. Other fields and relations are ok.
>
> I suspect I have issued some command (working from the shell issued
> with manage.py) which erased the field form the data model and
> consequently all the corresponding data has been deleted. Can you
> imagine what kind of action may have I done?
>
> I suspect there is no way to recover the lost data, apart from backup
> isn't it? (the database engine is mysql).
>
> Today I'm very sad...
>
> Thank you in advance for any suggestion.
>
> E.

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



MEDIA and STATIC in a nutshell?

2011-05-13 Thread Eiji Kobayashi
Hi Everyone,

This may seem like a very stupid question, but what exactly is the
difference between MEDIA and STATIC? I read through the Django doc and it
seems like STATIC is for css,js,img... etc., while MEDIA is for user
uploaded files?

But I'm confused because things do not work exactly like the documentation
says, so I hope someone who's defined and used MEDIA and STATIC (esp. in a
production env.) to enlighten me a little bit.

- serving STATIC -

# settings.py
STATIC_ROOT = '/Users/eiji/Sites/assets/static/'
STATIC_URL = '/static/'

TEMPLATE_CONTEXT_PROCESSORS = (
...
"django.core.context_processors.static",
...
)

Then in one of my templates, I have the following:


Even though there is a 'css' subdirectory and a 'reset.css' file, this
doesn't work. It's only when I add the following into the settings.py file
that it works:

STATICFILES_DIRS = (
('css', '/Users/eiji/Sites/assets/static/css'),
('img', '/Users/eiji/Sites/assets/static/img'),
('js', '/Users/eiji/Sites/assets/static/js'),
)

But at least this now works.

I would now like to play around with the MEDIA definitions so I can make
references like:

MEDIA_URL/members/eiji/videos/xyz.mov
MEDIA_URL/members/eiji/music/abc.mp3
and so on...

I tried setting:

MEDIA_ROOT = '/Users/eiji/Sites/assets/media/'
MEDIA_URL = '/media/'

and of course, it doesn't work. The templates files translate both
MEDIA_ROOT and MEDIA_URL variables as null.

So, my questions are:

1. Why don't the STATIC variables work without me having to have to
define STATICFILES_DIRS?
2. Why can't I get the MEDIA variables to work. What else must I define to
get this to work?

Thank you!

Eiji

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



Re: How to choose a license for an app or a project?

2011-05-13 Thread Lior Sion
I just remembered once seeing a license generator at Binpress, maybe
that can be the quick easy solution:

http://www.binpress.com/license/generator

On May 13, 8:06 pm, Boštjan Mejak  wrote:
> This is getting way out of hand. I was hoping for a simple yes/no answer.
> And what I got? A bunch of yada yada. Can't you people just express yourself
> by saying yes or no? Is it *that* hard? Okay now... I made a Django
> application called MyWiki (yes, it's a little simple wiki application). I
> don't want to disclose my source code. Now, what license would you choose?
> Is MIT license okay? Also, where should I put this license? In every module
> I have? In a file called license.txt and put it into the root dir? Please
> tell me. Simple English only. I am not so sharp so please keep that in mind
> when answering. 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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Template inheritance, how to render dynamic content in base templates

2011-05-13 Thread robinne
Ok, thanks everyone for the replies. I will take a look at these
suggestions.

On May 13, 6:06 am, Michal Petrucha  wrote:
> On Thu, May 12, 2011 at 08:15:59PM -0700, robinne wrote:
> > How can I render dynamic content in a base template if I only call a
> > view on my child template?
>
> > What I am trying to do is setup a base template that will include
> > "Profile" information for the user who is logged in, for example:
> > "Welcome John", instead of "login here", on every page. But if I call
> > my child page "/Home" (for example) and it extends "base.html", how do
> > I render the dynamic content within base.html? Thanks.
>
> You can use either custom template tags as suggested by others. The
> alternative is to create custom context processors that will add
> dynamic data you want to display into the context. Then you can use it
> even in your base template. However, you'll have to make sure each
> view uses a RequestContext when rendering templates in order for the
> context processors to be applied.
>
> As for the specific problem you're solving, RequestContext already
> contains user data which means you don't need anything extra. Just
> check in your base template if a user is logged in and show his
> username if yes or a login link otherwise.
>
> Michal
>
>  signature.asc
> < 1KViewDownload

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



Re: Why is request.session.flush() deleting my objects from DB?

2011-05-13 Thread Shawn Milochik
Given that logging a user out calls flush(), I don't believe that's 
what's deleting your data. Otherwise everyone using contrib.auth would 
be complaining.


What data is being deleted?


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



Re: How to choose a license for an app or a project?

2011-05-13 Thread Kenneth Gonsalves
On Fri, 2011-05-13 at 19:06 +0200, Boštjan Mejak wrote:
> This is getting way out of hand. I was hoping for a simple yes/no
> answer.
> And what I got? A bunch of yada yada. Can't you people just express
> yourself
> by saying yes or no? 

because it is not a simple question to answer yes or no.
> Is it *that* hard? Okay now... I made a Django
> application called MyWiki (yes, it's a little simple wiki
> application). I
> don't want to disclose my source code.

do not disclose it

>  Now, what license would you choose?
> Is MIT license okay? Also, where should I put this license? In every
> module
> I have? In a file called license.txt and put it into the root dir?
> Please
> tell me. Simple English only. I am not so sharp so please keep that in
> mind
> when answering. Thank you. 

MIT  license is NOT ok. Use a proprietary license (and please do not ask
what that is on this list)
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to choose a license for an app or a project?

2011-05-13 Thread Kenneth Gonsalves
On Fri, 2011-05-13 at 12:23 +, Bjarni Rúnar Einarsson wrote:
> Other random points: Generally speaking, I prefer the more recent,
> modern
> licenses (GPLv3 instead of GPLv2, Apache instead of BSD) because they
> do a
> better job covering issues like patents.  Some would argue that
> putting
> things in the public domain is "dangerous" because it doesn't
> explicitly
> disclaim liability. 

django itself uses the BSD license as do the majority of developers of
third party apps - django is doing well.
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Why is request.session.flush() deleting my objects from DB?

2011-05-13 Thread ekms
Hello, I have  a form where I want that every time that a user want to
send it, he has to login.

So, before the view that render the form, I made another view where I
do request.session.flush() and after this, I redirect to the form (the
view of the form has @login_required).
User completes the form and send it, and it's stored in DB.

The problem is that when the user starts the process again, when
request.session.flush() is executed, the objects created in the
previous form and saved to the DB (I see it in pgAdmin) dissapear.
But this don't happens in all models saved in the form view, only
happens in the models that have a FK to User model.

What is happening here? If request.session.flush() isn't the correct
way to delete the session of a user, how I do that? (I store things in
session, this is the reason why I want to clean it before the user
enter new data trought the 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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Change select to a form in a ForeignKey relationship

2011-05-13 Thread Ernesto Guevara
Very good, I edited here.

Thank You!

2011/5/13 Shawn Milochik 

> On 05/13/2011 04:22 PM, Guevara wrote:
>
>> Thank you shaw!
>>
>>  You're welcome. Note that there's no reason to add 'commit = True' when
> saving the address -- that's the default.
>
>
> Shawn
>
> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



UTF-8 and files automatically created

2011-05-13 Thread Michael
Hello everybody,

I am a beginner with Django and I was wondering something about UTF-8.
As a matter of fact, the files created automatically by Django when
you create your site and apps are not encoded in UTF-8. So some
characteres like the end of line are specific to the OS you have been
creating them.

Since I created them on Windows, I was wondering what will happen when
I will deploy my django site on a Linux server since the end of line
character is different ?
Wouldn't have been interesting to create all the files in a UTF format
so that the end of line is the same whatever the OS is ?

That was just a think.

Thank you
Bye.
Michael

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



Re: Model query whit n OR

2011-05-13 Thread Fabian Ezequiel Gallina
2011/5/13 Martin Quinta :
> i need a serch in db  users
> (users have  city, age,sex.. etc)
>
> but i need serch users from many citys.
>
> somthing like this...
>  from django.db.models import Q
> (http://docs.djangoproject.com/en/dev/topics/db/queries/#complex-
> lookups-with-q-objects)
> users.objects.get(Q(city='') | Q(city=''), age_gt = 25,
> age_lt= 35, sex='M')
>
> but in need somthing like this to...
> users.objects.get(Q(city=xxx))
>
> or meaby this...
> user.objects.get( age=24)
>
> and much more examples..
>
> obyusly whit generic method
>
> i can make a generic method like this: (only work with AND)
> dic={age_gt:14,age_lt:23,sex:f}
> user.objects.get(**dic)
> ##the dictionary get from form wiht checkboxs
>
> but i cant use this method with OR
>
> i can make somthing like this...
> list_city=[xxx,yyy,zzz]
> dic = {age:23,sex:M.}
> user.objects.get( *[Q(city='x') for x in list_city], **dic )
> but make somthing like this
> user(Q(city=xxx),Q(city=))
> and need somthing like this
> users(Q(city=xxx) | Q(city=))
>
> any solution???
> or other method??
> meaby put a sql direct?
> user.objects.get(explicit_sql='city=1 OR city=2  OR city=3...' ,
> **other paramethers)
>

Use the builtin operator module and the builtin reduce like this:

import operator

qlist = []

[qlist.append(Q(city=x)) for x in list_city]

User.objects.filter(reduce(operator._or, qlist))


Regards,
-- 
Fabián E. Gallina
http://www.anue.biz

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



Model query whit n OR

2011-05-13 Thread Martin Quinta
i need a serch in db  users
(users have  city, age,sex.. etc)

but i need serch users from many citys.

somthing like this...
 from django.db.models import Q
(http://docs.djangoproject.com/en/dev/topics/db/queries/#complex-
lookups-with-q-objects)
users.objects.get(Q(city='') | Q(city=''), age_gt = 25,
age_lt= 35, sex='M')

but in need somthing like this to...
users.objects.get(Q(city=xxx))

or meaby this...
user.objects.get( age=24)

and much more examples..

obyusly whit generic method

i can make a generic method like this: (only work with AND)
dic={age_gt:14,age_lt:23,sex:f}
user.objects.get(**dic)
##the dictionary get from form wiht checkboxs

but i cant use this method with OR

i can make somthing like this...
list_city=[xxx,yyy,zzz]
dic = {age:23,sex:M.}
user.objects.get( *[Q(city='x') for x in list_city], **dic )
but make somthing like this
user(Q(city=xxx),Q(city=))
and need somthing like this
users(Q(city=xxx) | Q(city=))

any solution???
or other method??
meaby put a sql direct?
user.objects.get(explicit_sql='city=1 OR city=2  OR city=3...' ,
**other paramethers)

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



all data of all manyToMany relations lost!

2011-05-13 Thread ?manu*
Dear experts,

today I was inspecting the ManyToMany relations in the _meta subclass
of a Model class of my database. At some time I realized that all data
associated to such relations was lost in the database! The
corresponding tables are empty. Other fields and relations are ok.

I suspect I have issued some command (working from the shell issued
with manage.py) which erased the field form the data model and
consequently all the corresponding data has been deleted. Can you
imagine what kind of action may have I done?

I suspect there is no way to recover the lost data, apart from backup
isn't it? (the database engine is mysql).

Today I'm very sad...

Thank you in advance for any suggestion.

E.

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



Re: Cache entire page *except* one block?

2011-05-13 Thread Nan

Ah, that helps a lot!  Thanks, Jacob!


On May 13, 5:22 pm, Jacob Kaplan-Moss  wrote:
> On Fri, May 13, 2011 at 3:01 PM, Nan  wrote:
> > I'm working on a site where about 95% of the pages are "static" and
> > change no more than once a week, and should therefore be cached;
> > however, there are a couple blocks in the base template (login forms,
> > blocks that load randomized content, etc) that shouldn't be cached.
> > Is there any way to enable cache on everything else but disable it on
> > those blocks?  I feel like it's extremely inefficient to have to hit
> > the database for page data on every view of a static page because of
> > that.
>
> > I suppose that the static page query results could be cached, but a)
> > they'd still have to be re-rendered, and b) that would mean updating
> > every one of about 30 views, and any views built in the future, which
> > doesn't feel very DRY or maintainable.  Am I missing something, or
> > misunderstanding something fundamental about how Django's cache
> > framework works?
>
> The term you're looking for is "two-phase rendering": you basically
> want to render the template once, cache that, and then later render
> just a bit of it again.
>
> Adrian wrote about the technique some time ago; 
> seehttp://www.holovaty.com/writing/django-two-phased-rendering/. There
> are some tips there for building something by hand, or you could
> django-phased, which seems to work 
> out-of-the-box:https://github.com/codysoyland/django-phased.
>
> The technique I usually use is to use Varnish's ESI features
> (http://varnish.projects.linpro.no/wiki/ESIfeatures) and push the
> caching out to the edge. There's a writeup of a technique similar to
> mine athttp://yml-blog.blogspot.com/2010/01/esi-using-varnish-and-django.html,
> and again there's an app that appears to provide the Django-y 
> bits:https://bitbucket.org/mlhamel/django-esi/src.
>
> Good luck!
>
> Jacob

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



Re: Change select to a form in a ForeignKey relationship

2011-05-13 Thread Shawn Milochik

On 05/13/2011 04:22 PM, Guevara wrote:

Thank you shaw!

You're welcome. Note that there's no reason to add 'commit = True' when 
saving the address -- that's the default.


Shawn

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



Re: Cache entire page *except* one block?

2011-05-13 Thread Jacob Kaplan-Moss
On Fri, May 13, 2011 at 3:01 PM, Nan  wrote:
> I'm working on a site where about 95% of the pages are "static" and
> change no more than once a week, and should therefore be cached;
> however, there are a couple blocks in the base template (login forms,
> blocks that load randomized content, etc) that shouldn't be cached.
> Is there any way to enable cache on everything else but disable it on
> those blocks?  I feel like it's extremely inefficient to have to hit
> the database for page data on every view of a static page because of
> that.
>
> I suppose that the static page query results could be cached, but a)
> they'd still have to be re-rendered, and b) that would mean updating
> every one of about 30 views, and any views built in the future, which
> doesn't feel very DRY or maintainable.  Am I missing something, or
> misunderstanding something fundamental about how Django's cache
> framework works?

The term you're looking for is "two-phase rendering": you basically
want to render the template once, cache that, and then later render
just a bit of it again.

Adrian wrote about the technique some time ago; see
http://www.holovaty.com/writing/django-two-phased-rendering/. There
are some tips there for building something by hand, or you could
django-phased, which seems to work out-of-the-box:
https://github.com/codysoyland/django-phased.

The technique I usually use is to use Varnish's ESI features
(http://varnish.projects.linpro.no/wiki/ESIfeatures) and push the
caching out to the edge. There's a writeup of a technique similar to
mine at http://yml-blog.blogspot.com/2010/01/esi-using-varnish-and-django.html,
and again there's an app that appears to provide the Django-y bits:
https://bitbucket.org/mlhamel/django-esi/src.

Good luck!

Jacob

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



Re: Looking for recommendations to replace vBulletin with a django based forum

2011-05-13 Thread Cal Leeming [Simplicity Media Ltd]
Have you considered maybe writing one from scratch? It'd be a good way to
try out new 1.3 features, and expand ones knowledge about Django :)

Cal

On Fri, May 13, 2011 at 4:43 PM, MikeKJ  wrote:

>
> None of those but have used
> http://code.google.com/p/django-forum/
> which as it says is basic but useable or look at this link
> http://www.djangopackages.com/grids/g/forums/
>
>
>
>
> Eric Chamberlain wrote:
> >
> > Hello,
> >
> > We are thinking about replacing our low-usage vBulletin forum with a
> > django integrated forum.
> >
> > Has anyone used djangobb, pybb, or askbot?
> >
> > --
> > Eric Chamberlain, Founder
> > RF.com - http://RF.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
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.
> >
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/Looking-for-recommendations-to-replace-vBulletin-with-a-django-based-forum-tp31582270p31612588.html
> Sent from the django-users mailing list archive at Nabble.com.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: How to choose a license for an app or a project?

2011-05-13 Thread Jacob Kaplan-Moss
On Fri, May 13, 2011 at 12:35 PM, Boštjan Mejak  wrote:
> Where to put my license? In a file or in all the modules? I'll use MIT
> license. Do I need to disclose the source code?

I'm sorry, but I have a policy of not answering questions that are
asked rudely, and you're being incredibly rude. If you stop trying to
hijack this thread, start a new one, and most importantly *ask
politely* I will try to help you out when I find some free time to do
so.

Jacob

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



Re: Change select to a form in a ForeignKey relationship

2011-05-13 Thread Guevara
Thank you shaw!

It works!

if form.is_valid() and formE.is_valid():
address = formE.save(commit=True)
employee = form.save(commit=False)
employee.address = address
employee.save()

## redirect to html list

Thanks!



On 13 maio, 16:17, Shawn Milochik  wrote:
> To do that you need to add a Meta to your ModelForm and exclude the
> address. Then add another ModelForm for Address and put both on the page
> at the same time.
>
> Then, after the POST, you'll need to first save the address and then add
> it to the cleaned_data of the employee form (or its self.instance)
> before saving.
>
> Not to confuse you, but you can also save the employee first if you use
> "commit = False" in the save(), then save and add the address, then save
> the employee again normally.
>
> Shawn

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



Cache entire page *except* one block?

2011-05-13 Thread Nan
Hi folks --

I'm working on a site where about 95% of the pages are "static" and
change no more than once a week, and should therefore be cached;
however, there are a couple blocks in the base template (login forms,
blocks that load randomized content, etc) that shouldn't be cached.
Is there any way to enable cache on everything else but disable it on
those blocks?  I feel like it's extremely inefficient to have to hit
the database for page data on every view of a static page because of
that.

I suppose that the static page query results could be cached, but a)
they'd still have to be re-rendered, and b) that would mean updating
every one of about 30 views, and any views built in the future, which
doesn't feel very DRY or maintainable.  Am I missing something, or
misunderstanding something fundamental about how Django's cache
framework works?

Thanks!
-Nan

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



Re: Looking for recommendations to replace vBulletin with a django based forum

2011-05-13 Thread roberto
I've been collaborating a little bit with askbot and I think it is
worthy to try.
The people who lead the project is very smart and gentle.

Roberto

On May 9, 11:27 pm, Eric Chamberlain  wrote:
> Hello,
>
> We are thinking about replacing our low-usage vBulletin forum with a django 
> integrated forum.  
>
> Has anyone used djangobb, pybb, or askbot?
>
> --
> Eric Chamberlain, Founder
> RF.com -http://RF.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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: connection lost with concurrent transactions

2011-05-13 Thread Shawn Milochik
Are you using RabbitMQ as a backend? We're using both Celery and 
django-celery successfully with Django + Postgres and I've never seen 
the issue you describe. We do all our Celery stuff asynchronously, since 
the main point (for us) is to have the user's page load time as short as 
possible.


Shawn


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



Re: Change select to a form in a ForeignKey relationship

2011-05-13 Thread Shawn Milochik
To do that you need to add a Meta to your ModelForm and exclude the 
address. Then add another ModelForm for Address and put both on the page 
at the same time.


Then, after the POST, you'll need to first save the address and then add 
it to the cleaned_data of the employee form (or its self.instance) 
before saving.


Not to confuse you, but you can also save the employee first if you use 
"commit = False" in the save(), then save and add the address, then save 
the employee again normally.


Shawn


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



connection lost with concurrent transactions

2011-05-13 Thread otto.vazquez
Hi all,

We are using django (1.3) with django-celery (2.2.4), database in
postgres (9.0.1) with psycopg2 (2.2.2) connector for a large project
(also large company).

Executing celery tasks one by one works fine. When requested, django
inserts a new row in db (django starts a transaction) and two task and
are invoked and both tasks write in the same row but in different
fields. With CELERY_ALWAYS_EAGER set, the tasks execute sequentially.

The problem comes when switching celery from synchronous to
asynchronous. Executing the same code, the celery daemon raises this
exception:

[2011-05-13 15:37:51,981: WARNING/PoolWorker-1] /prj/env/lib/python2.6/
site-packages/celery/worker/job.py:114: UserWarning: Exception outside
body: : no connection to the server
[2011-05-13 15:37:51,982: ERROR/MainProcess] Task
cds.tasks.resize[2f198cdd-a1d5-4e61-b4cd-a69a8e6586f4] raised
exception: OperationalError('no connection to the server\n',)
Traceback (most recent call last):
  File "/prj/env/lib/python2.6/site-packages/celery/worker/job.py",
line 108, in execute_safe
return self.execute(*args, **kwargs)
  File "/prj/env/lib/python2.6/site-packages/celery/worker/job.py",
line 126, in execute
return super(WorkerTaskTrace, self).execute()
  File "/prj/env/lib/python2.6/site-packages/celery/execute/trace.py",
line 76, in execute
retval = self._trace()
  File "/prj/env/lib/python2.6/site-packages/celery/execute/trace.py",
line 92, in _trace
return handler(trace.retval, trace.exc_type, trace.tb,
trace.strtb)
  File "/prj/env/lib/python2.6/site-packages/celery/worker/job.py",
line 147, in handle_failure
exc = self.task.backend.mark_as_failure(self.task_id, exc, strtb)
  File "/prj/env/lib/python2.6/site-packages/celery/backends/base.py",
line 45, in mark_as_failure
traceback=traceback)
  File "/prj/env/lib/python2.6/site-packages/celery/backends/base.py",
line 157, in store_result
return self._store_result(task_id, result, status, traceback,
**kwargs)
  File "/prj/env/lib/python2.6/site-packages/djcelery/backends/
database.py", line 20, in _store_result
traceback=traceback)
  File "/prj/env/lib/python2.6/site-packages/djcelery/managers.py",
line 46, in _inner
transaction.rollback_unless_managed()
  File "/prj/env/lib/python2.6/site-packages/django/db/
transaction.py", line 133, in rollback_unless_managed
connection.rollback_unless_managed()
  File "/prj/env/lib/python2.6/site-packages/django/db/backends/
__init__.py", line 193, in rollback_unless_managed
self._rollback()
  File "/prj/env/lib/python2.6/site-packages/django/db/backends/
__init__.py", line 50, in _rollback
return self.connection.rollback()
OperationalError: no connection to the server

For testing and isolate the problem, we tried with MySQL (5.1.49) and
mysql-django (1.2.3). Just changed db connector and port, and worked
like charm (no fails over ~400 tasks).
We also have tried modifying celery parameters (CELERY_DB_REUSE_MAX,
CELERY_TASK_PUBLISH_RETRY mainly) with some code tweaks.
After a couple of hours, we found the best fix-approach, wich has
minimized the number of exception, but still fails.
http://thebuild.com/blog/2010/10/25/django-and-postgresql-idle-in-transaction-connections/

Even with the auto commit enabled. Anyway, we don't want to change
django code.

We believe it's a connector problem, just google a little and you will
find lots a posts with same/similar problem.
Some other useful info/samples:
http://stackoverflow.com/questions/1303654/threaded-django-task-doesnt-automatically-handle-transactions-or-db-connections
http://groups.google.com/group/django-developers/browse_frm/thread/5249b9ba993431ca/4d1b9d65329c8b75
http://code.djangoproject.com/ticket/9964

Can you give any light on this? If we don't find any solution, we'll
move to mysql, which by now seems to be the best (extreme as well)
option.

Otto Vazquez

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



Change select to a form in a ForeignKey relationship

2011-05-13 Thread Guevara
Hello!
I need to change the Select (combobox) generated by the ForeignKey
relation:

I have this class:

class Employee(Person):
address = models.ForeignKey(Address)

Django automatically generates the combobox, but I wanted to be a form
to enter the address of the Employee.

The address is "endereco" in the image:
http://postimage.org/image/zino9gxw/

Does anyone know how can I change this?
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Re : get_absolute_url method breaks under 1.3 but works with 1.2.5

2011-05-13 Thread creecode
Hello wxHacker,

Ummm... I've already defined the method and it worked under 1.2.5 and broke 
in 1.3.  Am I misunderstanding your point?

Perhaps my attachment < 
https://groups.google.com/group/django-users/attach/73bbe17d0b6bae40/absolute_url_test.zip?part=4=0
 
> didn't show at all end points?  I could also try to post the actual 
relevant file contents to a message.  Although that doesn't seem optimal.  I 
provided the test case project/app as an attachment to make it easier for 
folks who are inclined to do some testing.

Toodle-loo.
creecode

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



Using generic_inlineformset_factory to inline a form for categories?

2011-05-13 Thread Stodge
I have the following models:

class Category(models.Model):
type = models.CharField(max_length=128)

class CategoryTerm(models.Model):
term = models.CharField(max_length=128)
type = models.ForeignKey(Category, related_name='terms')

class CategoryMap(models.Model):
term = models.ForeignKey(CategoryTerm, db_index=True)
type = models.ForeignKey(Category, db_index=True)

content_type = models.ForeignKey(ContentType,
verbose_name='content type', db_index=True)
object_id = models.PositiveIntegerField(db_index=True)
content_object = generic.GenericForeignKey('content_type',
'object_id')

I have another class called StaticPage, so I can do:

form = CreatePageForm()

Then I do:

CategoryMapFormSet = generic_inlineformset_factory(CategoryMap,
extra=1, can_delete=False)
cat_formset = CategoryMapFormSet(instance=StaticPage())
gfs = generic_inlineformset_factory(CategoryMap)
print gfs.form().as_p()

u'Term: \n-
\nEngland\nNews
\nLoblaws\n\nType: \n-\nCountry\nTopic\nStore\n'

This means that a user can select a term for a category it doesn't
belong to.

So how does one use generic_inlineformset_factory properly?

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



Re: Re : get_absolute_url method breaks under 1.3 but works with 1.2.5

2011-05-13 Thread creecode
Hello Dominique,

On Friday, May 13, 2011 10:09:19 AM UTC-7, Dominique Guardiola Falco wrote:

None of my business, but you could also look why your code is calling this 
> method when it shouldn't be called
> Or add a blank get_absolute_url methods to the models which doesn't have 
> one
>

The code is there to be called for this one model.  It works with 1.2.5 but 
breaks with 1.3.  I had already considered improving my code to be more 
robust for use with 1.3.

My main point here though is that something that worked under 1.2.5 is now 
broken in 1.3.  A call to a method when rendering a template that previously 
failed silently, now fails noisily.  I'm attempting to ascertain whether 
failing silently is the desired behavior but is now broken under 1.3.  If 
this is the case then I'd want to report this as a bug.  I'm totally able to 
accept that my coding is the problem and was able to do something in 1.2.5 
and now 1.3 has improved error detection or some such.  I also don't want to 
just change my code without investigation as to why things changed.

My understanding is that in some circumstances failing silently when rending 
template stuff is the prefered behavior.  Is this one of them?  I don't 
know, hence my question to the community.

Toodle-loo..
creecode

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



Re: How to choose a license for an app or a project?

2011-05-13 Thread Boštjan Mejak
Where to put my license? In a file or in all the modules? I'll use MIT
license. Do I need to disclose the source code?

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



Re: Re : get_absolute_url method breaks under 1.3 but works with 1.2.5 and many major and minor versions prior

2011-05-13 Thread Boštjan Mejak
Define get_absolute_url in models.py that is a file in your application's
directory.


from django.db import models

class MyModeName(models.Model):
# Add field names here like --> name = models.CharField(max_length=20,
primary_key=True)

def __unicode__(self):   # Well, you don't need to define
this actually, but they say it's just in case
return self.name_of_a_field# So in our case since we gave the
model a "name" field, then givereturn self.namehere (because that's
a field of the model that is the primary key)

@models.permalink
def get_absolute_url(self):
return
('project_name.application_name.views.function_name_in_the_views.py_file', [
self.pk])# [self.pk] must be written as it is here -- it just gets the
primary key, so like that "name" thing from the model MyModeName; leave this
self.pk as is

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



Re: How to choose a license for an app or a project?

2011-05-13 Thread Javier Guerra Giraldez
On Fri, May 13, 2011 at 12:13 PM, Thomas Weholt  wrote:
> And the point you're making about the non-legal isssues are just as
> important for me as I want to "use" the community to make my own
> software better. Hmmm ... as one of those copylefters it's somewhat of
> a bitter pill to swallow not to use the GPL. Still - I'm a
> django/python-user and if I want to succeed and increase my userbase I
> might have to put the thinking and philosophy that got me into linux
> and open source initially aside and use a license most compatible with
> the framework and community I want to contribute to.

I went through a similar process with the Lua community:

first i released several code snippets in GPL, but soon saw that most
old-timers used MIT.  The reason is that Lua is heavily used in the
game industry, so very few people could use GPL'ed code.

since i hadn't invested too much time (yet) i switched licensed, with
the reservation that i'd use GPL if i started any 'big' project.

but with time, and knowing a little more about the people there, i
found that some of them worked with big companies, and even them tried
to always contribute back to any OSS project they were using.  of
course, the community is very small, so the 'honor system' works very
well.

in the end, i found myself using MIT for everything Lua-related that
doesn't start as a paid work.  On other spaces (mostly C and C++), i
still use GPL; but my presence there is far smaller.

-- 
Javier

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



Re: How to choose a license for an app or a project?

2011-05-13 Thread Thomas Weholt
On Fri, May 13, 2011 at 6:55 PM, Jacob Kaplan-Moss  wrote:
> On Fri, May 13, 2011 at 11:30 AM, Thomas Weholt  
> wrote:
>> Hmmm ... maybe, but because of the reusable app focus in django I
>> think some sort of guideline regarding choice of license could be
>> important.
>
> The problem is that license choice is one of those "holy wars" that
> geeks get into -- vi/emacs, mac/windows/linux, etc. etc. etc. Only
> it's worse because you've got a bunch of laypeople trying to interpret
> law, and we developers tend to fail rather spectacularly when trying
> to interpret the law.
>
> So any "official" advice anyone gave would just be a flashpoint for
> flamewars, and I don't think anyone's brave enough to wade into this
> particular problem. I'm certainly not.
>
> I would like to make a few important points, though:
>
> First, if you have a license you want (or need) to use: use it. Don't
> let anyone tell you otherwise. It's *YOUR* software, and *YOU* get to
> choose how to license it. I'd hope that you're making an educated
> choice, but even if you're picking by throwing darts that's still your
> prerogative.
>
> That said, you do need to understand that licenses are more than just
> legal terms of use. They're also important community signifiers. What
> do I mean by "signifier"? Well, imagine you're in a meeting and
> someone you don't know walks in wearing a suit. You'll have an
> immediate first impression ("ah, here's a business guy") that'd differ
> from seeing someone walk in wearing sandals and at-shirt ("hey, who's
> the new developer?")
>
> Well, licenses do that, too. A permissive, BSD-ish license sends a
> message that's quite a bit different from the one sent by a
> strong-copyleft GPL-ish license. It's hard to articulate just what
> these messages are -- I have strong feelings on the matter so I can't
> really talk dispassionately.
>
> But I can point out that one of the most important aspects of this
> message is one of membership and involvement. Again, think about the
> meeting example: if you were going to attend a meeting with a bunch of
> developers would you wear a suit? Maybe you would, but you'd probably
> know they'd instantly peg you as an outsider. This could be useful --
> if you're trying to buy a startup, you probably *want* to look
> important and successful. But either way you probably know your
> clothes send signifiers about how you see yourself in relation to the
> community.
>
> Again, licenses to that, too. In the Python and Django world,
> permissive licenses are the norm. Python's licensed under a permissive
> license (it's a weird one for historical purposes, but it's most like
> the Apache license I think). Django's licensed under one of the most
> permissive licenses available (the BSD license). Many Python projects,
> and most Django apps, are BSD or MIT licensed. This means that putting
> a GPL-licensed Django app is going to immediately stick out as
> something a bit different.
>
> I'm *NOT* saying that you should be choosing a license just to "fit
> in"! Again, it's *YOUR* choice. The point I'm making is that the
> social messages your license sends can be just as important as the
> legal rights those license grant. In many cases, the social factors
> can be more important than the legal ones.
>
> Good luck, I hope I've not confused things even more for you!
>
> Jacob

No, you're not confusing me at all - you're making things very clear
and this is exactly what I wanted; to shed some light on what
difference choosing one license over another can make to your project.
And the point you're making about the non-legal isssues are just as
important for me as I want to "use" the community to make my own
software better. Hmmm ... as one of those copylefters it's somewhat of
a bitter pill to swallow not to use the GPL. Still - I'm a
django/python-user and if I want to succeed and increase my userbase I
might have to put the thinking and philosophy that got me into linux
and open source initially aside and use a license most compatible with
the framework and community I want to contribute to.

Thanks Jacob, this was very enlightening.

Thomas

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



Re: How to choose a license for an app or a project?

2011-05-13 Thread Jacob Kaplan-Moss
On Fri, May 13, 2011 at 12:06 PM, Boštjan Mejak  wrote:
> This is getting way out of hand. I was hoping for a simple yes/no answer.
> And what I got? A bunch of yada yada.

This tone is uncalled for and borderline unacceptable here. You have
no right to demand anything from the people taking their free time to
help you here.

If you're unhappy with the free help you're getting I encourage you to
retain a lawyer. That's the only way you'll get definitive answers on
legal concerns.

Jacob

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



Re : get_absolute_url method breaks under 1.3 but works with 1.2.5 and many major and minor versions prior

2011-05-13 Thread Dominique Guardiola Falco
None of my business, but you could also look why your code is calling this 
method when it shouldn't be called
Or add a blank get_absolute_url methods to the models which doesn't have one

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



Re: How to choose a license for an app or a project?

2011-05-13 Thread Boštjan Mejak
This is getting way out of hand. I was hoping for a simple yes/no answer.
And what I got? A bunch of yada yada. Can't you people just express yourself
by saying yes or no? Is it *that* hard? Okay now... I made a Django
application called MyWiki (yes, it's a little simple wiki application). I
don't want to disclose my source code. Now, what license would you choose?
Is MIT license okay? Also, where should I put this license? In every module
I have? In a file called license.txt and put it into the root dir? Please
tell me. Simple English only. I am not so sharp so please keep that in mind
when answering. 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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to choose a license for an app or a project?

2011-05-13 Thread Jacob Kaplan-Moss
On Fri, May 13, 2011 at 11:30 AM, Thomas Weholt  wrote:
> Hmmm ... maybe, but because of the reusable app focus in django I
> think some sort of guideline regarding choice of license could be
> important.

The problem is that license choice is one of those "holy wars" that
geeks get into -- vi/emacs, mac/windows/linux, etc. etc. etc. Only
it's worse because you've got a bunch of laypeople trying to interpret
law, and we developers tend to fail rather spectacularly when trying
to interpret the law.

So any "official" advice anyone gave would just be a flashpoint for
flamewars, and I don't think anyone's brave enough to wade into this
particular problem. I'm certainly not.

I would like to make a few important points, though:

First, if you have a license you want (or need) to use: use it. Don't
let anyone tell you otherwise. It's *YOUR* software, and *YOU* get to
choose how to license it. I'd hope that you're making an educated
choice, but even if you're picking by throwing darts that's still your
prerogative.

That said, you do need to understand that licenses are more than just
legal terms of use. They're also important community signifiers. What
do I mean by "signifier"? Well, imagine you're in a meeting and
someone you don't know walks in wearing a suit. You'll have an
immediate first impression ("ah, here's a business guy") that'd differ
from seeing someone walk in wearing sandals and at-shirt ("hey, who's
the new developer?")

Well, licenses do that, too. A permissive, BSD-ish license sends a
message that's quite a bit different from the one sent by a
strong-copyleft GPL-ish license. It's hard to articulate just what
these messages are -- I have strong feelings on the matter so I can't
really talk dispassionately.

But I can point out that one of the most important aspects of this
message is one of membership and involvement. Again, think about the
meeting example: if you were going to attend a meeting with a bunch of
developers would you wear a suit? Maybe you would, but you'd probably
know they'd instantly peg you as an outsider. This could be useful --
if you're trying to buy a startup, you probably *want* to look
important and successful. But either way you probably know your
clothes send signifiers about how you see yourself in relation to the
community.

Again, licenses to that, too. In the Python and Django world,
permissive licenses are the norm. Python's licensed under a permissive
license (it's a weird one for historical purposes, but it's most like
the Apache license I think). Django's licensed under one of the most
permissive licenses available (the BSD license). Many Python projects,
and most Django apps, are BSD or MIT licensed. This means that putting
a GPL-licensed Django app is going to immediately stick out as
something a bit different.

I'm *NOT* saying that you should be choosing a license just to "fit
in"! Again, it's *YOUR* choice. The point I'm making is that the
social messages your license sends can be just as important as the
legal rights those license grant. In many cases, the social factors
can be more important than the legal ones.

Good luck, I hope I've not confused things even more for you!

Jacob

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



Re: How to choose a license for an app or a project?

2011-05-13 Thread Javier Guerra Giraldez
On Fri, May 13, 2011 at 11:45 AM, Thomas Weholt  wrote:
> even sell it as
> part of a larger piece of software

i don't think GPL allows it.

-- 
Javier

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



Re: How to choose a license for an app or a project?

2011-05-13 Thread Thomas Weholt
> Look at it this way:
>
> If you want to force contribution back to your project, then AGPL or GPL3.
> This limits participation of people who want to use your code in their
> products or SAAS services because it forces them to release their
> customizations for free.

Well, I think that's my main motivation for releasing my code as GPL;
people are free to use it, modify it, redistribute it, even sell it as
part of a larger piece of software, but the only thing I want in
return is that their modifications of "my" code are made public for me
to use as well so I can benefit from bug fixes, added features etc. So
I still believe GPL is the right license for me to use.

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to choose a license for an app or a project?

2011-05-13 Thread Thomas Weholt
On Fri, May 13, 2011 at 4:15 PM, Tom Evans  wrote:
> On Fri, May 13, 2011 at 3:05 PM, Boštjan Mejak  
> wrote:
>> For example, the CCleaner GUI application provides only the setup (so the
>> binaries) of the application. They don't give the source code of it. If I
>> wanted the same thing with my app, is the MIT license the right choice for
>> me?
>>
>
> If you use the MIT license, anyone receiving the license can do
> whatever they want with the code, including distribute the code, or
> binaries derived from the code without the accompanying code.
>
> This is OT from django now..

Hmmm ... maybe, but because of the reusable app focus in django I
think some sort of guideline regarding choice of license could be
important. This is important to all communities, and in that sense not
strictly django related, but I think the number of answers in this
thread show that it's something several django users care about - at
least to some degree.

Thomas

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



Re: Looking for recommendations to replace vBulletin with a django based forum

2011-05-13 Thread MikeKJ

None of those but have used  
http://code.google.com/p/django-forum/
which as it says is basic but useable or look at this link
http://www.djangopackages.com/grids/g/forums/




Eric Chamberlain wrote:
> 
> Hello,
> 
> We are thinking about replacing our low-usage vBulletin forum with a
> django integrated forum.  
> 
> Has anyone used djangobb, pybb, or askbot?
> 
> --
> Eric Chamberlain, Founder
> RF.com - http://RF.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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Looking-for-recommendations-to-replace-vBulletin-with-a-django-based-forum-tp31582270p31612588.html
Sent from the django-users mailing list archive at Nabble.com.

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



Re: How to choose a license for an app or a project?

2011-05-13 Thread Mike Seidle
On Friday, May 13, 2011 07:34:35 am Thomas Weholt wrote:
> I've released three django-related packages the last few months, all
> under the GPL license. Recently somebody asked me about my license
> choice; "Why not BSD, the same as django?". My reason for choosing GPL
> is based on the fact that I'm a strong supporter of free software as
> defined by FSF and GPL is the de facto standard license for that. But
> the question got me thinking and I wonder what kind of problems I
> might run into using the GPL, and not the BSD license.

The big problem with the GPL is that it requires source code disclosure, so 
people who want to include your code in a commercial product feel like they 
are giving away the farm instead of selling some eggs.  

Look at it this way: 

If you want to force contribution back to your project, then AGPL or GPL3. 
This limits participation of people who want to use your code in their 
products or SAAS services because it forces them to release their 
customizations for free.

If you want to allow SAAS, but ensure that people can get access to code, use 
GPL2 or if appropriate LGPL.

If you don't care and just want to share and share alike, look at BSD or many 
other more permissive open source licenses.

If you want businesses to pay you, but individuals to be able to use your 
software, Creative Commons has a few good, tested licenses.

If you want to get paid every time someone installs your software, use a 
commercial license.


> 
> Do people really care? Should I care? I think so. What do you people
> think; How to choose a license and why?

-- 
Mike Seidle

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



Re: Use of FileField fields causes memory consumption to grow without releasing it

2011-05-13 Thread Gustavo Narea
I've filled a bug report:
http://code.djangoproject.com/ticket/16022

On 13/05/11 10:57, Gustavo Narea wrote:
> Hello,
>
> I've noticed that when you iterate over a query set and use a
> FileField instance from each model instance, the memory used by the
> process increases every time the loop finishes. This happens on the
> Web and command-line interfaces.
>
> Say you have the following model:
> """
> class Bug(Model):
> patch = FileField(upload_to="whatever")
> """
>
> The following loop will make the process use a lot more memory every
> time it's run:
> """
> for bug in Bug.objects.all()[:1000]:
> print "- %s" % bug.patch.name
> """
>
> But the following loop won't cause memory to grow at all:
> """
> for bug in Bug.objects.all()[:1000]:
> print "- %s" % bug.__dict__['patch']
> """
>
> The mere act of using "bug.patch" causes the problem, regardless of
> what member of "patch" you use (e.g., "name", "url"). The same happens
> with ImageField and presumably any other subclass of FileField.
>
> According to the "strace" utility, the process doesn't even try to
> access the file in any way. In fact, if I remove the files from the
> file system, the problem is still present. I've also checked the
> Postgres statement logs and the only query issued looks absolutely
> fine.
>
> I'm using Python 2.5, Django 1.1.4 and Ubuntu (it also happens on
> Debian boxes). I got DEBUG set to False.
>
> I'll continue to look at this to see what's exactly going on here, but
> I'm posting here to see if someone could shed some lights. I'll post
> my findings.
>
> Cheers.
>
>  - Gustavo Narea.


-- 
Gustavo Narea.
Software Developer.
2degrees, Ltd. .

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



legacy code with javascript help please

2011-05-13 Thread MikeKJ

This legacy code outputs an image with a set of thumbnails to change the main
image with, to start it is main image above thumbnails but when any
thumbnail that is not forloop.first is clicked it swaps upside down like
thumbnails with main image under and I cannot see how to maintain image
above and thumbnails below at all times

[code snippet]

{% if_greater product.image_set.count 1 %}


function change_main_photo(showthis) {
images = getElementsByTagAndClassName('div',
'large-images');
for (i=0;i

Re: How to choose a license for an app or a project?

2011-05-13 Thread Javier Guerra Giraldez
On Fri, May 13, 2011 at 9:47 AM, Boštjan Mejak  wrote:
> P.S.: What does OT stand for?

off-topic

-- 
Javier

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



Re: How to choose a license for an app or a project?

2011-05-13 Thread Boštjan Mejak
What I want to know is... Must I supply the source code of my application
along with the binaries if using the MIT license?

P.S.: What does OT stand for?

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



Re: New Django Profiling application

2011-05-13 Thread Brian Bouterse
I don't mean to suggest django-sentry provides the functionality discuss
earlier.  It doesn't.  I point to django-sentry to illustrate the quality of
projects done at Disqus.  I consider django-sentry a very high quality
Django application.

I was told by dcramer that they at Disqus have an app that does very similar
functionality to the functionality discussed.

Hope that clears up any confusion.

Brian

On Fri, May 13, 2011 at 10:20 AM, Xavier Ordoquy wrote:

> > On May 13, 9:34 pm, Brian Bouterse  wrote:
> >> Go for it!
> >>
> >> I know the disqus team (told by dcramer at djangocon 2010) has a great
> >> profiling app, you should talk with them about this.  The disqus folks
> said
> >> they were in the process of packaging it up to release similar to the
> high
> >> quality work they did on
> >> django-sentry.
> >>  You're idea sounds great and needed, I just want to encourage you to
> make
> >> sure you're adding to the community, not re-inventing existing
> solutions.
> >>
> >> Best,
> >> Brian
>
> I'm not sure django-sentry is a profiling application.
> It helps tracking issues but does not give anything like django debug
> toolbar does.
> This being said, David seems to push a lot of efforts on the latest.
>
> Regards,
> Xavier.
>
> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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



duplicate key value violates unique constraint "menus_cachekey_pkey"

2011-05-13 Thread wilbur
When loading a Django page, I get the error:

IntegrityError while rendering: duplicate key value violates unique
constraint "menus_cachekey_pkey"

I am using Django 1.2.4

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



Re: New Django Profiling application

2011-05-13 Thread Xavier Ordoquy
> On May 13, 9:34 pm, Brian Bouterse  wrote:
>> Go for it!
>> 
>> I know the disqus team (told by dcramer at djangocon 2010) has a great
>> profiling app, you should talk with them about this.  The disqus folks said
>> they were in the process of packaging it up to release similar to the high
>> quality work they did on
>> django-sentry.
>>  You're idea sounds great and needed, I just want to encourage you to make
>> sure you're adding to the community, not re-inventing existing solutions.
>> 
>> Best,
>> Brian

I'm not sure django-sentry is a profiling application.
It helps tracking issues but does not give anything like django debug toolbar 
does.
This being said, David seems to push a lot of efforts on the latest.

Regards,
Xavier.

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



Re: How to choose a license for an app or a project?

2011-05-13 Thread Tom Evans
On Fri, May 13, 2011 at 3:05 PM, Boštjan Mejak  wrote:
> For example, the CCleaner GUI application provides only the setup (so the
> binaries) of the application. They don't give the source code of it. If I
> wanted the same thing with my app, is the MIT license the right choice for
> me?
>

If you use the MIT license, anyone receiving the license can do
whatever they want with the code, including distribute the code, or
binaries derived from the code without the accompanying code.

This is OT from django now..

Cheers

Tom

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



Re: How to choose a license for an app or a project?

2011-05-13 Thread Boštjan Mejak
bobhaugen, your link https://github.com/pinax/pinax/blob/master/LICENSE is
an MIT license.

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



Re: New Django Profiling application

2011-05-13 Thread Adrien Lemaire
I'm currently using django-sentry in my project, but I didn't now they
were doing something similar. Will keep an eye on their work, thanks
for this advice Brian

On May 13, 9:34 pm, Brian Bouterse  wrote:
> Go for it!
>
> I know the disqus team (told by dcramer at djangocon 2010) has a great
> profiling app, you should talk with them about this.  The disqus folks said
> they were in the process of packaging it up to release similar to the high
> quality work they did on
> django-sentry.
>  You're idea sounds great and needed, I just want to encourage you to make
> sure you're adding to the community, not re-inventing existing solutions.
>
> Best,
> Brian
>
> On Thu, May 12, 2011 at 11:44 PM, Adrien LEMAIRE <
>
>
>
>
>
> adrien.lema...@aquasys.co.jp> wrote:
> > Hello dear django users,
>
> > I'm currently finishing my master in Computer Science, doing django
> > development in my internship. I chose Instrumentation as the main subject
> > for my dissertation, so I'm studying every aspect of instrumentation on web
> > development.
>
> > I'll start soon a new django application which I'll host on 
> > Github. This
> > app will allow a developer to get a quick and good idea on which push slowed
> > the project, and inside this profiling result, which view or sql request can
> > have caused this problem.
>
> > *Goals:*
>
> >    - Automatize profiling (sql + view execution time)
> >    - keep history of profiling results based on git push (commits can be
> >    broken and intensely used, when a git push should have all its tests
> >    passing: I think is a good value to keep in history).
> >    - render a graphviz image of the database
> >    - render a KCacheGrid readable image for each profile
> >    - Integrate a new page in the django admin to display all these
> >    stuff nicely
> >    - Fabric script which will replace a "git push" by verifying the tests,
> >    then performing all the previous tasks and updating the git repository
> >    before pushing.
>
> > *Dependencies :*
>
> >    - django-extensions
> >    - fabric
> >    - django-coverage ?
>
> > *Name :*
>
> > I'm thinking about a good name for this app. None of the following are in
> > the pip repositories: django-profiler, django-profiling,
> > django-auto-profiling, django-profile-history, django-admin-profiler.
> > What are your suggestions ?
>
> > If you have questions or advises about this project, I'd love to read
> > them.
> > Also, I'd like to know how many of you guys would be interested by this
> > app.
>
> > Thank you very much
> > Best regards
>
> > *PS : *My company Aquasys  is seeking an
> > experienced Django developer. The project will use Agile development
> > methodologies, incorporate a REST architecture, and include the following
> > technologies: Django, jQuery, HTML5, Google APIs. Please contact 
> > george.mengelberg
> > at aquasys.co.jp if you're interested.
>
> > --
> > Adrien Lemaire
> > *Software Engineer*, Aquasys
> > adrien.lema...@aquasys.co.jp
> > office: +81.098.989.1118
> >www.aquasys.co.jp
>
> >  --
> > 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+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> --
> Brian Bouterse
> ITng Services

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



Re: How to choose a license for an app or a project?

2011-05-13 Thread Boštjan Mejak
For example, the CCleaner GUI application
provides only the setup (so the
binaries) of the application. They don't
give the source code of it. If I wanted the same thing with my app, is the
MIT license the right choice for me?

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



Re: How to choose a license for an app or a project?

2011-05-13 Thread bobhaugen
Another angle on licenses is software community practice.

If you want to develop an app to be widely adopted within a particular
software community, you will want to use a license that is the same as
or compatible with the community licensing practices.

For example, I wanted to develop an app that could be used by the
Pinax community, so I used the same license as Pinax:
https://github.com/pinax/pinax/blob/master/LICENSE

In a different community (e.g. Linux), I would have picked a different
license.

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



Re: How to choose a license for an app or a project?

2011-05-13 Thread Tom Evans
On Fri, May 13, 2011 at 2:30 PM, Boštjan Mejak  wrote:
> So if I want to create a software for which I don't want to give the source
> code to the world, I use the MIT license and I am fine? Also, which
> particular BSD license is similar to the MIT license in the means of not
> needing to give the source code?
>

I think you've got the wrong end of the stick. If you don't want to
allow people to have the source code, don't release the source code at
all.

BSD/MIT/Apache are all permissive software licenses, if you release
your code under one of those licenses, people can use it for whatever
they want.

GPL/LGPL are restrictive software licenses, they require users of the
code to contribute changes/release source code for code linked to the
licensed code, or any changes to the licensed code, *if* the code is
distributed to other parties.

AGPL is a more restrictive version of GPL that requires changes/source
to be released even if the code is not distributed to other parties,
but is just used on a website that produces content for other parties.

Cheers

Tom

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



Re: How to choose a license for an app or a project?

2011-05-13 Thread Stuart MacKay

Boštjan,

Details of the BSD (2 and 3 clause versions) can be found at, 
http://www.opensource.org/licenses/bsd-license. I use the 3-clause 
version for my Open Source projects which allows anybody to redistribute 
the code in binary form only.


However if you really want to keep the source private then you should 
use a commercial, proprietary license. If you used the BSD license then 
there is no reason I cannot decompile your binary to generate useful 
source code which I could then distribute freely.


Regards,

Stuart

So if I want to create a software for which I don't want to give the 
source code to the world, I use the MIT license and I am fine? Also, 
which particular BSD license is similar to the MIT license in the 
means of not needing to give the source code? --
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


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



Re: Use Ajax to retrieve data from db based on data from input box and adding it to a table.

2011-05-13 Thread AJ
No problem. I am a beginner myself in Django. Just learning by asking and
answering seems a very nice way. Enjoy hacking! :)

On Fri, May 13, 2011 at 8:39 AM, GKR  wrote:

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



-- 
AJ

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



Re: How to choose a license for an app or a project?

2011-05-13 Thread Boštjan Mejak
So if I want to create a software for which I don't want to give the source
code to the world, I use the MIT license and I am fine? Also, which
particular BSD license is similar to the MIT license in the means of not
needing to give the source code?

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



Re: How to choose a license for an app or a project?

2011-05-13 Thread Tom Evans
On Fri, May 13, 2011 at 1:30 PM, Brian Bouterse  wrote:
> Very few licenses guard against this
> licensing gotcha:   If the source is on the internet, I can download,
> modify, and mash up your code to create some type of service based website.
>  Since I never actually distribute the code to the customer, I just sell a
> service online all of the attribution, and the what is open stays open
> arguments go out the window.  Here I can take something open, modify it in
> an awesome way, and since I never distribute it I never have to share my
> derivative changes thereby preventing the GPL project from benefitting from
> my extensions.  That is a pretty easy way to sidestep any of these licenses.
> Brian
>

The AGPL specifically guards against this - it is the purpose of the
license. It, like GPL, also taints the code that it is used with,
specifically when used as a component in a website.

The net effect of this is that a company like the one I work for would
never use any AGPL code, where as we will happily use
MIT/BSD/Apache/GPL/LGPL code, and in most cases contribute any changes
back. This means we will always look for MIT/BSD/Apache licensed
libraries in preference, GPL/LGPL if must, and write our own if it is
AGPL licensed.

Most companies that develop software, like us, are willing to
contribute code back, since code that we contribute back no longer has
to be maintained by us. Only code that directly pertains to our core
business, or would allow our competitors an advantage, is kept back.

Bostjan: The MIT license is largely equivalent to the BSD license,
which is not outdated and is used by many important projects still
(not least all the BSD variants!)

Cheers

Tom

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



Re: Template inheritance, how to render dynamic content in base templates

2011-05-13 Thread Michal Petrucha
On Thu, May 12, 2011 at 08:15:59PM -0700, robinne wrote:
> How can I render dynamic content in a base template if I only call a
> view on my child template?
> 
> What I am trying to do is setup a base template that will include
> "Profile" information for the user who is logged in, for example:
> "Welcome John", instead of "login here", on every page. But if I call
> my child page "/Home" (for example) and it extends "base.html", how do
> I render the dynamic content within base.html? Thanks.

You can use either custom template tags as suggested by others. The
alternative is to create custom context processors that will add
dynamic data you want to display into the context. Then you can use it
even in your base template. However, you'll have to make sure each
view uses a RequestContext when rendering templates in order for the
context processors to be applied.

As for the specific problem you're solving, RequestContext already
contains user data which means you don't need anything extra. Just
check in your base template if a user is logged in and show his
username if yes or a login link otherwise.

Michal


signature.asc
Description: Digital signature


Re: Template inheritance, how to render dynamic content in base templates

2011-05-13 Thread Gabe
I suggest reading about inclusion tags:
http://docs.djangoproject.com/en/1.3/howto/custom-template-tags/

worked for me

Gabe

On 13 Maj, 07:51, Mateusz Marzantowicz 
wrote:
> On Fri, May 13, 2011 at 5:15 AM, robinne wrote:
>
> How can I render dynamic content in a base template if I only call a> view on 
> my child template?
>
> > What I am trying to do is setup a base template that will include
> > "Profile" information for the user who is logged in, for example:
> > "Welcome John", instead of "login here", on every page. But if I call
> > my child page "/Home" (for example) and it extends "base.html", how do
> > I render the dynamic content within base.html? Thanks.
>
> I think you should consider using template tags mechanism. Either it is
> already built into your auth/login application (there are some tags
> included) or you might write your own custom tags. Please refer to
> documentation 
> at:http://docs.djangoproject.com/en/1.3/howto/custom-template-tags/.

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



Re: How to choose a license for an app or a project?

2011-05-13 Thread Boštjan Mejak
By using an MIT license, is your software's source code protected by means
of not needing for you to provide it to the whole world?

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



Built-in login form via inclusion tag

2011-05-13 Thread Gabe
Hi,

what I am trying to do is to put a login box which will use
django.contrib.auth.views.login. According to documentation I`ve
crated inclusion tag which works, but it only views form sumbit button
not a whole form. This form is from tutorialand looks like this:




{% load url from future %}

{% block content %}

{% if form.errors %}
Niepoprawny login lub nazwa użytkownika.
{% endif %}


{% csrf_token %}


{{ form.username.label_tag }}
{{ form.username }}


{{ form.password.label_tag }}
{{ form.password }}







{% endblock %}


It seems like it don`t know enything about form variable. How can I
give it to it via inclusion tag?

best regards
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to choose a license for an app or a project?

2011-05-13 Thread Stuart MacKay

Boštjan,

Choice of license can be a very subjective thing as each fulfills 
slightly different criteria. Take a look at this page on 
stackoverflow.com, 
http://stackoverflow.com/questions/458479/where-can-i-find-an-authoritative-overview-of-open-source-licences#458710 
It gives a good selections of links that describe the different types of 
Open Source licences available.


Regards,

Stuart MacKay
Lisbon, Portugal

What do you guys think about the MIT license? In what particular case 
would I be needing an MIT license? --
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


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



runfcgi prefork constantly restarts children

2011-05-13 Thread Alexander Schepanovski
I use django in fcgi prefork mode and as you can see here:

[ruauto@newton ~]$ ps axwu | grep runfcgi | grep -v grep | sort -rk10
ruauto  72264  2,2  0,5 82352 38320  ??  L18:03 5:24,46
python /home/ruauto.ru/project/manage.py runfcgi workdir=/home/
ruauto.ru/project pidfile=/tmp/ruauto.pid socket=/
ruauto  56816 28,7  1,0 148268 81352  ??  R20:09 4:28,49
python /home/ruauto.ru/project/manage.py runfcgi workdir=/home/
ruauto.ru/project pidfile=/tmp/ruauto.pid socket=/
ruauto  57088 29,2  1,0 148268 81380  ??  S20:09 4:12,82
python /home/ruauto.ru/project/manage.py runfcgi workdir=/home/
ruauto.ru/project pidfile=/tmp/ruauto.pid socket=/
ruauto  65958  5,3  0,6 121020 47332  ??  LL   20:21 0:00,46
python /home/ruauto.ru/project/manage.py runfcgi workdir=/home/
ruauto.ru/project pidfile=/tmp/ruauto.pid socket=/
ruauto  65954  4,3  0,5 116924 43428  ??  S20:21 0:00,40
python /home/ruauto.ru/project/manage.py runfcgi workdir=/home/
ruauto.ru/project pidfile=/tmp/ruauto.pid socket=/
ruauto  65957  4,2  0,5 115900 42836  ??  LL   20:21 0:00,35
python /home/ruauto.ru/project/manage.py runfcgi workdir=/home/
ruauto.ru/project pidfile=/tmp/ruauto.pid socket=/
ruauto  65961  4,4  0,5 115900 42800  ??  LL   20:21 0:00,33
python /home/ruauto.ru/project/manage.py runfcgi workdir=/home/
ruauto.ru/project pidfile=/tmp/ruauto.pid socket=/
ruauto  65965  0,0  0,5 82352 38328  ??  LL   20:21 0:00,20
python /home/ruauto.ru/project/manage.py runfcgi workdir=/home/
ruauto.ru/project pidfile=/tmp/ruauto.pid socket=/
ruauto  65964  0,0  0,5 82352 38324  ??  RL   20:21 0:00,20
python /home/ruauto.ru/project/manage.py runfcgi workdir=/home/
ruauto.ru/project pidfile=/tmp/ruauto.pid socket=/
ruauto  65969  0,0  0,5 82352 38324  ??  LL   20:21 0:00,13
python /home/ruauto.ru/project/manage.py runfcgi workdir=/home/
ruauto.ru/project pidfile=/tmp/ruauto.pid socket=/
ruauto  65967  0,0  0,5 85060 39468  ??  LL   20:21 0:00,10
python /home/ruauto.ru/project/manage.py runfcgi workdir=/home/
ruauto.ru/project pidfile=/tmp/ruauto.pid socket=/
ruauto  65968  0,0  0,5 85060 39228  ??  LL   20:21 0:00,08
python /home/ruauto.ru/project/manage.py runfcgi workdir=/home/
ruauto.ru/project pidfile=/tmp/ruauto.pid socket=/
ruauto  65971  0,0  0,5 82352 38332  ??  LL   20:21 0:00,01
python /home/ruauto.ru/project/manage.py runfcgi workdir=/home/
ruauto.ru/project pidfile=/tmp/ruauto.pid socket=/
ruauto  65970  0,0  0,5 82352 38320  ??  LL   20:21 0:00,01
python /home/ruauto.ru/project/manage.py runfcgi workdir=/home/
ruauto.ru/project pidfile=/tmp/ruauto.pid socket=/
ruauto  65973  0,0  0,5 82352 38332  ??  LL   20:21 0:00,00
python /home/ruauto.ru/project/manage.py runfcgi workdir=/home/
ruauto.ru/project pidfile=/tmp/ruauto.pid socket=/
[ruauto@newton ~]$ date
пятница, 13 мая 2011 г. 20:21:33 (KRAST)
[ruauto@newton ~]$

All workers but two are new (start time == current time). And they are
always new. I assume runfcgi master restarts children regularly for an
unknown reason. There is nothing about it in error log.

Does anyone know why this is happening and how to fix it?

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



Re: Use Ajax to retrieve data from db based on data from input box and adding it to a table.

2011-05-13 Thread GKR
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to choose a license for an app or a project?

2011-05-13 Thread Boštjan Mejak
What do you guys think about the MIT license? In what particular case would
I be needing an MIT license?

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



Re: Use Ajax to retrieve data from db based on data from input box and adding it to a table.

2011-05-13 Thread AJ
You could do that directly but here's how I do it in development:

You will have a site_media directory in Django. I usually serve the
sitemedia from that directory which includes images, JS, CSS etc. You
specify site_media in your settings.py.

#the absolute path to this file, i.e. 'here'
here = lambda *x: os.path.join(os.path.abspath(os.path.dirname(__file__)),
*x)

MEDIA_ROOT = here('site_media')

 You could also use the django static files for this, which is new in the
recent version.

And then in your urls.py, (which I usually do):

#the absolute path to this file, i.e. 'here'
here = lambda *x: os.path.join(os.path.abspath(os.path.dirname(__file__)),
*x)

(r'^site_media/(?P.*)$', 'django.views.static.serve',
{'document_root': here('site_media') }),
(r'^images/(?P.*)$', 'django.views.static.serve',
{'document_root': here("site_media/img") }),
(r'^images/(?P.*)$', 'django.views.static.serve',
{'document_root': here("site_media/css") }),
(r'^images/(?P.*)$', 'django.views.static.serve',
{'document_root': here("site_media/js/") }),

But you'd still have to add the JS to your base or some template:



Read more about static files:
http://docs.djangoproject.com/en/1.3/howto/static-files/



On Fri, May 13, 2011 at 8:27 AM, GKR  wrote:

> Thanks for ur idea
>
> so shall i put the scripts directly on the template file to work out or is
> there any better alternate..
>
>
>  --
> 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+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
AJ

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



Re: New Django Profiling application

2011-05-13 Thread Brian Bouterse
Go for it!

I know the disqus team (told by dcramer at djangocon 2010) has a great
profiling app, you should talk with them about this.  The disqus folks said
they were in the process of packaging it up to release similar to the high
quality work they did on
django-sentry.
 You're idea sounds great and needed, I just want to encourage you to make
sure you're adding to the community, not re-inventing existing solutions.

Best,
Brian

On Thu, May 12, 2011 at 11:44 PM, Adrien LEMAIRE <
adrien.lema...@aquasys.co.jp> wrote:

> Hello dear django users,
>
> I'm currently finishing my master in Computer Science, doing django
> development in my internship. I chose Instrumentation as the main subject
> for my dissertation, so I'm studying every aspect of instrumentation on web
> development.
>
> I'll start soon a new django application which I'll host on 
> Github. This
> app will allow a developer to get a quick and good idea on which push slowed
> the project, and inside this profiling result, which view or sql request can
> have caused this problem.
>
> *Goals:*
>
>- Automatize profiling (sql + view execution time)
>- keep history of profiling results based on git push (commits can be
>broken and intensely used, when a git push should have all its tests
>passing: I think is a good value to keep in history).
>- render a graphviz image of the database
>- render a KCacheGrid readable image for each profile
>- Integrate a new page in the django admin to display all these
>stuff nicely
>- Fabric script which will replace a "git push" by verifying the tests,
>then performing all the previous tasks and updating the git repository
>before pushing.
>
>
> *Dependencies :*
>
>- django-extensions
>- fabric
>- django-coverage ?
>
>
> *Name :*
>
> I'm thinking about a good name for this app. None of the following are in
> the pip repositories: django-profiler, django-profiling,
> django-auto-profiling, django-profile-history, django-admin-profiler.
> What are your suggestions ?
>
>
>
>
> If you have questions or advises about this project, I'd love to read
> them.
> Also, I'd like to know how many of you guys would be interested by this
> app.
>
>
> Thank you very much
> Best regards
>
>
> *PS : *My company Aquasys  is seeking an
> experienced Django developer. The project will use Agile development
> methodologies, incorporate a REST architecture, and include the following
> technologies: Django, jQuery, HTML5, Google APIs. Please contact 
> george.mengelberg
> at aquasys.co.jp if you're interested.
>
> --
> Adrien Lemaire
> *Software Engineer*, Aquasys
> adrien.lema...@aquasys.co.jp
> office: +81.098.989.1118
> www.aquasys.co.jp
>
>
>  --
> 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+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Brian Bouterse
ITng Services

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



Re: How to choose a license for an app or a project?

2011-05-13 Thread Brian Bouterse
There is no "best choice" in licensing, just right for the right situation.
 I like the simplicity of the apache 2.0
licensewhich is
mainly BSD in spirit plus attribution.

While GPL is more pure "open source" ideologically.  Businesses tend to back
away from using GPL based software because they can't repackage it and
distribute it without the source, which is a non-starter for most
businesses.  For my own projects, I would rather be less ideological so that
businesses are more interested in using it rather than grinding
a philosophical ax at the expense of my own software project's usage.

Another perspective is that in some situations it might not matter one
little bit what license you choose.  Very few licenses guard against this
licensing gotcha:   If the source is on the internet, I can download,
modify, and mash up your code to create some type of service based website.
 Since I never actually distribute the code to the customer, I just sell a
service online all of the attribution, and the what is open stays open
arguments go out the window.  Here I can take something open, modify it in
an awesome way, and since I never distribute it I never have to share my
derivative changes thereby preventing the GPL project from benefitting from
my extensions.  That is a pretty easy way to sidestep any of these licenses.

Brian



On Fri, May 13, 2011 at 7:58 AM, Alistair Grant wrote:

>  It will partly depend on who you would like to be able to use your code.
>
> The corporate mandate at my previous employer, a very large software
> company, was "No GPL".  LGPL was tolerated, but not encouraged.  The reason
> for the mandate was that GPL required the user to also make their code
> available, which is not what this software company wanted.  This was a few
> years ago, so the situation may have changed, but I'd expect it hasn't.
>
> Cheers,
> Alistair
>
>
> On 13/05/11 13:34, Thomas Weholt wrote:
>
> I've released three django-related packages the last few months, all
> under the GPL license. Recently somebody asked me about my license
> choice; "Why not BSD, the same as django?". My reason for choosing GPL
> is based on the fact that I'm a strong supporter of free software as
> defined by FSF and GPL is the de facto standard license for that. But
> the question got me thinking and I wonder what kind of problems I
> might run into using the GPL, and not the BSD license.
>
> Do people really care? Should I care? I think so. What do you people
> think; How to choose a license and why?
>
>
>   --
> 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+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Brian Bouterse
ITng Services

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



Re: How to choose a license for an app or a project?

2011-05-13 Thread Bjarni Rúnar Einarsson
Here are some of my rules of thumb:

   1) If it is trivial, put it in the public domain (config files, etc.).

   2) If you are trying to create a standard of some sort, use the Apache 2
license.

   3) If you are trying to contribute to an existing community, use whatever
license they use.

   4) If you are trying to push software freedom, use the AGPLv3.

   5) If you want to release code, but have some protection against
competition, use AGPLv3.

   6) If you want to play nice with the Free Software community, but want to
make money off traditional licensing, use AGPLv3 or GPLv3 and ask
contributors assign copyright to you so you can sell alternate licenses.

As an example, I am using the AGPLv3 for my current project (
http://pagekite.net/) at the moment for reasons 4) (and a bit of 5 and 6),
but am strongly considering a switch to a BSD style license at some point
for reason 2).

Other random points: Generally speaking, I prefer the more recent, modern
licenses (GPLv3 instead of GPLv2, Apache instead of BSD) because they do a
better job covering issues like patents.  Some would argue that putting
things in the public domain is "dangerous" because it doesn't explicitly
disclaim liability.


On Fri, May 13, 2011 at 11:52 AM, Tom Evans wrote:

> On Fri, May 13, 2011 at 12:34 PM, Thomas Weholt 
> wrote:
> > I've released three django-related packages the last few months, all
> > under the GPL license. Recently somebody asked me about my license
> > choice; "Why not BSD, the same as django?". My reason for choosing GPL
> > is based on the fact that I'm a strong supporter of free software as
> > defined by FSF and GPL is the de facto standard license for that. But
> > the question got me thinking and I wonder what kind of problems I
> > might run into using the GPL, and not the BSD license.
> >
> > Do people really care? Should I care? I think so. What do you people
> > think; How to choose a license and why?
> >
>
> BSD license allows the most re-use of your work. If you want your code
> to be used by as many people as possible, use the BSD license.
>
> GPL license is almost as permissive as a BSD license for web server
> deployed packages, since a user is never distributing the library,
> only utilizing it to generate content.
>
> There is the Affero GPL, which disallows this behaviour. If you use
> this license, then anyone using your library must make their code AGPL
> as well. This would lead lots of potential users to not use your work.
>
> The choices are up to you
>
> Cheers
>
> Tom
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Bjarni R. Einarsson
The Beanstalks Project ehf.

Making personal web-pages fly: http://pagekite.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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Use Ajax to retrieve data from db based on data from input box and adding it to a table.

2011-05-13 Thread GKR
Thanks for ur idea

so shall i put the scripts directly on the template file to work out or is 
there any better alternate..

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



Re: Use Ajax to retrieve data from db based on data from input box and adding it to a table.

2011-05-13 Thread AJ
>From what you've tried to explain, I can see that you would really want to
use AJAX, that means, for that page you have to write a JavaScript handler
(function that handles the event of adding a new record by pressing Add or
Enter). The JS will take care of the page not being submitted/refreshed.

Since the page is not being refreshed/submitted, you can use the same JS
method to post or make an AJAX call to the backend, which will be handled by
Django.

On the Django side of the things, you will have proper url to handle this
request in URLS.py and also a view in views.py.

the View method will check for the POST request and depending upon if it is
an AJAX request it will send proper JSON tuple to your page, where again you
will use JavaScript to parse it and append in the already existing table.

I could see this so far.

On Fri, May 13, 2011 at 7:08 AM, GKR  wrote:

> which is the best way to implement the following::
>
> i will be having a text box and a Add  button
>
> Along with a table below it containing headers Serial No, roll no,Name,
> Age, Address, Phone no
>
> my logic is to take the roll no as input from the text box and when i press
> enter either on the text field or click the add button it should search
> through the database
> and add the details to the table without refreshing the whole page. and the
> clear the textfield and focus on it.
>  It will give proper error msg if the roll no is not found
>
> please help how and which is the best way to implement this...
>
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
AJ

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



Re: How to choose a license for an app or a project?

2011-05-13 Thread Alistair Grant

It will partly depend on who you would like to be able to use your code.

The corporate mandate at my previous employer, a very large software 
company, was "No GPL".  LGPL was tolerated, but not encouraged.  The 
reason for the mandate was that GPL required the user to also make their 
code available, which is not what this software company wanted.  This 
was a few years ago, so the situation may have changed, but I'd expect 
it hasn't.


Cheers,
Alistair


On 13/05/11 13:34, Thomas Weholt wrote:

I've released three django-related packages the last few months, all
under the GPL license. Recently somebody asked me about my license
choice; "Why not BSD, the same as django?". My reason for choosing GPL
is based on the fact that I'm a strong supporter of free software as
defined by FSF and GPL is the de facto standard license for that. But
the question got me thinking and I wonder what kind of problems I
might run into using the GPL, and not the BSD license.

Do people really care? Should I care? I think so. What do you people
think; How to choose a license and why?



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



Re: Use Ajax to retrieve data from db based on data from input box and adding it to a table.

2011-05-13 Thread AJ
>From what you've tried to explain, I can see that you would really want to
use AJAX, that means, for that page you have to write a JavaScript handler
(function that handles the event of adding a new record by pressing Add or
Enter). The JS will take care of the page not being submitted/refreshed.

Since the page is not being refreshed/submitted, you can use the same JS
method to post or make an AJAX call to the backend, which will be handled by
Django.

On the Django side of the things, you will have proper url to handle this
request in URLS.py and also a view in views.py.

the View method will check for the POST request and depending upon if it is
an AJAX request it will send proper JSON tuple to your page, where again you
will use JavaScript to parse it and append in the already existing table.

I could see this so far.


On Fri, May 13, 2011 at 8:13 AM, GKR  wrote:

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

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



Re: Use of FileField fields causes memory consumption to grow without releasing it

2011-05-13 Thread Gustavo Narea
OK, I've found that if I use .iterator() on the query set, the amount of
memory used doesn't grow. So I suppose FileField is somehow (indirectly)
referencing something in the retrieved data.

BTW, we've created a fresh Django project with "django-admin
startproject" and the problem is present. It looks like a bug in Django.


On 13/05/11 10:57, Gustavo Narea wrote:
> Hello,
>
> I've noticed that when you iterate over a query set and use a
> FileField instance from each model instance, the memory used by the
> process increases every time the loop finishes. This happens on the
> Web and command-line interfaces.
>
> Say you have the following model:
> """
> class Bug(Model):
> patch = FileField(upload_to="whatever")
> """
>
> The following loop will make the process use a lot more memory every
> time it's run:
> """
> for bug in Bug.objects.all()[:1000]:
> print "- %s" % bug.patch.name
> """
>
> But the following loop won't cause memory to grow at all:
> """
> for bug in Bug.objects.all()[:1000]:
> print "- %s" % bug.__dict__['patch']
> """
>
> The mere act of using "bug.patch" causes the problem, regardless of
> what member of "patch" you use (e.g., "name", "url"). The same happens
> with ImageField and presumably any other subclass of FileField.
>
> According to the "strace" utility, the process doesn't even try to
> access the file in any way. In fact, if I remove the files from the
> file system, the problem is still present. I've also checked the
> Postgres statement logs and the only query issued looks absolutely
> fine.
>
> I'm using Python 2.5, Django 1.1.4 and Ubuntu (it also happens on
> Debian boxes). I got DEBUG set to False.
>
> I'll continue to look at this to see what's exactly going on here, but
> I'm posting here to see if someone could shed some lights. I'll post
> my findings.
>
> Cheers.
>
>  - Gustavo Narea.


-- 
Gustavo Narea.
Software Developer.
2degrees, Ltd. .

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



Re: Use Ajax to retrieve data from db based on data from input box and adding it to a table.

2011-05-13 Thread GKR
please help

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



Re: How to choose a license for an app or a project?

2011-05-13 Thread Tom Evans
On Fri, May 13, 2011 at 12:34 PM, Thomas Weholt  wrote:
> I've released three django-related packages the last few months, all
> under the GPL license. Recently somebody asked me about my license
> choice; "Why not BSD, the same as django?". My reason for choosing GPL
> is based on the fact that I'm a strong supporter of free software as
> defined by FSF and GPL is the de facto standard license for that. But
> the question got me thinking and I wonder what kind of problems I
> might run into using the GPL, and not the BSD license.
>
> Do people really care? Should I care? I think so. What do you people
> think; How to choose a license and why?
>

BSD license allows the most re-use of your work. If you want your code
to be used by as many people as possible, use the BSD license.

GPL license is almost as permissive as a BSD license for web server
deployed packages, since a user is never distributing the library,
only utilizing it to generate content.

There is the Affero GPL, which disallows this behaviour. If you use
this license, then anyone using your library must make their code AGPL
as well. This would lead lots of potential users to not use your work.

The choices are up to you

Cheers

Tom

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



Re: How to choose a license for an app or a project?

2011-05-13 Thread Boštjan Mejak
Well, the best choice is GPL v3. And the fact that you use GPL license, you
must provide the source code of your application as well. That I know is
true for GPL. Why would you use BSD license I don't know. You could also use
the MIT license. By having this MIT license, you don't supply the source
code. It's what you want really.

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



How to choose a license for an app or a project?

2011-05-13 Thread Thomas Weholt
I've released three django-related packages the last few months, all
under the GPL license. Recently somebody asked me about my license
choice; "Why not BSD, the same as django?". My reason for choosing GPL
is based on the fact that I'm a strong supporter of free software as
defined by FSF and GPL is the de facto standard license for that. But
the question got me thinking and I wonder what kind of problems I
might run into using the GPL, and not the BSD license.

Do people really care? Should I care? I think so. What do you people
think; How to choose a license and why?

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Use Ajax to retrieve data from db based on data from input box and adding it to a table.

2011-05-13 Thread GKR
which is the best way to implement the following::

i will be having a text box and a Add  button

Along with a table below it containing headers Serial No, roll no,Name, Age, 
Address, Phone no

my logic is to take the roll no as input from the text box and when i press 
enter either on the text field or click the add button it should search 
through the database
and add the details to the table without refreshing the whole page. and the 
clear the textfield and focus on it.
 It will give proper error msg if the roll no is not found

please help how and which is the best way to implement this... 

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



Re: Template inheritance, how to render dynamic content in base templates

2011-05-13 Thread Mateusz Marzantowicz
On Fri, May 13, 2011 at 5:15 AM, robinne wrote:

How can I render dynamic content in a base template if I only call a
> view on my child template?
>
> What I am trying to do is setup a base template that will include
> "Profile" information for the user who is logged in, for example:
> "Welcome John", instead of "login here", on every page. But if I call
> my child page "/Home" (for example) and it extends "base.html", how do
> I render the dynamic content within base.html? Thanks.
>
>
I think you should consider using template tags mechanism. Either it is
already built into your auth/login application (there are some tags
included) or you might write your own custom tags. Please refer to
documentation at:
http://docs.djangoproject.com/en/1.3/howto/custom-template-tags/ .

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



New Django Profiling application

2011-05-13 Thread Adrien LEMAIRE
Hello dear django users,

I'm currently finishing my master in Computer Science, doing django
development in my internship. I chose Instrumentation as the main subject
for my dissertation, so I'm studying every aspect of instrumentation on web
development.

I'll start soon a new django application which I'll host on
Github. This
app will allow a developer to get a quick and good idea on which push slowed
the project, and inside this profiling result, which view or sql request can
have caused this problem.

*Goals:*

   - Automatize profiling (sql + view execution time)
   - keep history of profiling results based on git push (commits can be
   broken and intensely used, when a git push should have all its tests
   passing: I think is a good value to keep in history).
   - render a graphviz image of the database
   - render a KCacheGrid readable image for each profile
   - Integrate a new page in the django admin to display all these
   stuff nicely
   - Fabric script which will replace a "git push" by verifying the tests,
   then performing all the previous tasks and updating the git repository
   before pushing.


*Dependencies :*

   - django-extensions
   - fabric
   - django-coverage ?


*Name :*

I'm thinking about a good name for this app. None of the following are in
the pip repositories: django-profiler, django-profiling,
django-auto-profiling, django-profile-history, django-admin-profiler.
What are your suggestions ?




If you have questions or advises about this project, I'd love to read them.
Also, I'd like to know how many of you guys would be interested by this app.


Thank you very much
Best regards


*PS : *My company Aquasys  is seeking an
experienced Django developer. The project will use Agile development
methodologies, incorporate a REST architecture, and include the following
technologies: Django, jQuery, HTML5, Google APIs. Please contact
george.mengelberg
at aquasys.co.jp if you're interested.

-- 
Adrien Lemaire
*Software Engineer*, Aquasys
adrien.lema...@aquasys.co.jp
office: +81.098.989.1118
www.aquasys.co.jp

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



Use of FileField fields causes memory consumption to grow without releasing it

2011-05-13 Thread Gustavo Narea
Hello,

I've noticed that when you iterate over a query set and use a
FileField instance from each model instance, the memory used by the
process increases every time the loop finishes. This happens on the
Web and command-line interfaces.

Say you have the following model:
"""
class Bug(Model):
patch = FileField(upload_to="whatever")
"""

The following loop will make the process use a lot more memory every
time it's run:
"""
for bug in Bug.objects.all()[:1000]:
print "- %s" % bug.patch.name
"""

But the following loop won't cause memory to grow at all:
"""
for bug in Bug.objects.all()[:1000]:
print "- %s" % bug.__dict__['patch']
"""

The mere act of using "bug.patch" causes the problem, regardless of
what member of "patch" you use (e.g., "name", "url"). The same happens
with ImageField and presumably any other subclass of FileField.

According to the "strace" utility, the process doesn't even try to
access the file in any way. In fact, if I remove the files from the
file system, the problem is still present. I've also checked the
Postgres statement logs and the only query issued looks absolutely
fine.

I'm using Python 2.5, Django 1.1.4 and Ubuntu (it also happens on
Debian boxes). I got DEBUG set to False.

I'll continue to look at this to see what's exactly going on here, but
I'm posting here to see if someone could shed some lights. I'll post
my findings.

Cheers.

 - Gustavo Narea.

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



Re: Django Admin site and password field

2011-05-13 Thread Gabe
Thanks for all suggestion. Subject to close (if it was forum ;))

On 12 Maj, 23:00, Michal Petrucha  wrote:
> On Thu, May 12, 2011 at 09:51:24AM -0700, Gabe wrote:
> > First of all thx for all replies.
>
> > For now I don`t use auth.User model I would like to create my own. So
> > I have written model class Users:
>
> > [...]
>
> > Then I have registered it in admin panel by editing admin.py among
> > with another models:
>
> > from django.contrib import admin
> > from dgcmsUser.models import Users
> > from dgcmsUser.models import Priviledges
> > from dgcmsUser.models import UsersProfiles
>
> > admin.site.register(Users)
> > admin.site.register(UsersProfiles)
> > admin.site.register(Priviledges)
>
> > Then when I add user using autogenerated admin panel the password
> > field is  not  which I
> > would like it to be.
>
> You have to create a custom ModelForm for your Users model. This form
> will only have to override the widget of the password field. Then
> you'll have to create a custom ModelAdmin specifying your ModelForm
> instead of the default one.
>
> It may look something like this (note that I'm typing off the top of
> my head):
>
> class UserForm(forms.ModelForm):
>     class Meta:
>         widgets = {
>             'password': PasswordInput,
>         }
>
> class UserAdmin(admin.ModelAdmin):
>     form = UserForm
>
> admin.site.register(User, UserAdmin)
>
> OT: Note that each time someone saves a plaintext password in a
> database, a kitten dies. Please, think of the kittens. (-; (Also
> applies to base64-encoded passwords and such. Yeah, you wouldn't
> believe it but the academic information system our university forces
> us to use does exactly that. Probably because of unicode encoding
> issues.)
>
> Michal
>
>  signature.asc
> < 1KWyświetlPobierz

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



Re: Overriding templates for the inclusion_tag

2011-05-13 Thread Daniel Roseman
On Friday, May 13, 2011 1:01:26 AM UTC+1, Stodge wrote:
>
> Is there any interest in changing the inclusion template functionality 
> to let the function return the template name in the dictionary to the 
> inclusion_tag  decorator? This would let the developer override the 
> template filename: 
>
> {{{ 
> @register.inclusion_tag('block/render_region.html') 
> def render_region(slug): 
>
> # Some random code that does nothing. 
> if len(slug) == 0: 
> return {'template': 'block/empty_region.html'} 
>
> return {'region': region, 'blocks': blocks} 
> }}} 
>

You'd have to raise it on the developers list, preferably along with a 
ticket in the tracker.

However, I suspect your proposed syntax would not be accepted, as it would 
break any code that used a variable called 'template' in the context.
--
DR.

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



Re: Template inheritance, how to render dynamic content in base templates

2011-05-13 Thread Daniel Roseman
On Friday, May 13, 2011 4:15:59 AM UTC+1, robinne wrote:
>
> How can I render dynamic content in a base template if I only call a 
> view on my child template? 
>
> What I am trying to do is setup a base template that will include 
> "Profile" information for the user who is logged in, for example: 
> "Welcome John", instead of "login here", on every page. But if I call 
> my child page "/Home" (for example) and it extends "base.html", how do 
> I render the dynamic content within base.html? Thanks.


The base template is rendered along with the child template, as long as the 
child uses the {% extends %} tag.
--
DR.

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