GeoDjango Distances

2007-11-21 Thread Dan

Hi

I started using the Geodjango branch, it seems to be working really
well so far, I have a few questions that I could not find the answers
to:

1 - Is there anyway in Geodjango to calculate distances between two
points?

2 - When using 'dwithin' like below, what is the unit used in
distance?

object.filter(point__dwithin=(point,distance))

Cheers

-Dan





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



Re: Django Web Hosting Service

2007-11-21 Thread Hugh Bien
Another +1 for webfaction.  The cheapest plan supports Django, 7.50/mo for
two years in advance, but you can get a refund for your remaining time if
you're not satisfied.  Pretty sweet deal.

On 11/21/07, Daniel Roseman <[EMAIL PROTECTED]> wrote:
>
>
> On Nov 21, 1:57 pm, cwurld <[EMAIL PROTECTED]> wrote:
> > http://www.webfaction.com/
> >
> > They are amazing and reasonably priced. Their support is great. They
> > have exceeded my expectations many times.
> >
> > Chuck
>
> Second this recommendation. I am very happy with them, and they have
> responded to support calls nearly instantly.
> --
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: generic views and form templates

2007-11-21 Thread Martin

hi, michael

thanks for the help.. i've tried this but it still doesn't work. i'm
doing something wrong, but i don't know what. if i remove save(),
object still gets created, just without slug. my question here is:
does slug field needs to have blank=True? when that is set, object
gets created, without it i get an error about duplicate entry in my
db.

i'll play a little more, but i guess i'll have to use newforms ;)

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



Re: Request in a template

2007-11-21 Thread Martin

Got it, thanks.

I just had to insert this into my settings.py:

TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.request',
)

and the request object became available.


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



Re: Columns from one table in where

2007-11-21 Thread Alexander Nesterov

Uuups! Found solution by myself: >>> my =
ArchiveCalls.objects.extra(where=['connect_time != disconnect_time'])
Sorry )
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Request in a template

2007-11-21 Thread Alex Koshelev

You can use this context processor
http://www.djangoproject.com/documentation/templates_python/#django-core-context-processors-request
or pass request instance manually to template context in each view;)

On 22 нояб, 00:56, Martin <[EMAIL PROTECTED]> wrote:
> I have an parameter in my querystring which i would like to access in
> a template, fx:
>
> ---
> 
> ---
>
> is this possible?
>
> Thanks.
>
> Martin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Columns from one table in where

2007-11-21 Thread Alexander Nesterov

Hello.
I hope, somebody will help me with my newbie question or maybe give me
some advice.
I have such table in my django app:

CREATE TABLE `my_archivecalls` (
...
  `connect_time` datetime default NULL,
  `disconnect_time` datetime default NULL,
...
);

I need to perform following select query:
mysql> SELECT * FROM my_archivecalls WHERE connect_time !=
disconnect_time;
1 row in set (0.00 sec)

How should I perform it using db api in one query?
>>> list = ArchiveCalls.objects.exclude(connect_time__exact=disconnect_time)
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'disconnect_time' is not defined

>>> my = 
>>> ArchiveCalls.objects.exclude(connect_time__exact=archivecalls__disconnect_time)
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'archivecalls__disconnect_time' is not defined

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



Re: Request in a template

2007-11-21 Thread Will Larson


> I have an parameter in my querystring which i would like to access in
> a template, fx:
>
> ---
> 
> ---
>


http://www.b-list.org/weblog/2006/jun/14/django-tips-template-context- 
processors/

Shows you how to do just that.

But, I would recommend handling that a bit different. Specifically in  
your view mapping the url you want to return to to a variable in the  
template ("return_url", etc), so that in your template you'd have

 

In my mind this is meaningful because it preserves the distinction  
between the template deciding how to present information, and the  
views deciding what information to present. Also you would likely  
want to do some preprocessing on the url to make sure its a valid  
value (also, to prevent abject failure in a situation where there was  
no get request, or the get request did not have the url field. If  
only input was sanitary...), which you couldn't do in the template,  
but is quite doable in the views file.

This may seem like a needless distinction, and it is... as long as  
what you are doing isn't important or particularly large.

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



Re: How to create groups from code?

2007-11-21 Thread Russell Keith-Magee

On 11/21/07, Jose Jiménez <[EMAIL PROTECTED]> wrote:
>
> Thanks for your response Artiom, but i have a question about it.
>
> the documentation you link me says: "for each model in each specified
> app, this command looks for the file /sql/.sql"
> but i want initialize the auth_group table, so i haven't a model for
> that. i tried to put a groups.pyyaml.sql but it does not anything.

That section of the documention needs to be revised - loading initial
data from SQL is not the recommended technique any more.

Have a look at: the loaddata and dumpdata commands on manage.py

http://www.djangoproject.com/documentation/django-admin/#loaddata-fixture-fixture
http://www.djangoproject.com/documentation/django-admin/#dumpdata-appname-appname

This describes the way in which you can define a fixture - a
JSON/XML/YAML file that contains data you wish to load into the
database. This data can be used to populate your database, or as data
that is used during a test.

If you read the documentation on syncdb:

http://www.djangoproject.com/documentation/django-admin/#syncdb

you will see that as a special case, if you name your fixture
'initial_data', it will be loaded every time you sync your
application.

Yours,
Russ Magee %-)

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



Re: generic views and form templates

2007-11-21 Thread Michael

Hi Martin,

On Nov 22, 7:59 am, Martin <[EMAIL PROTECTED]> wrote:
> i wrote this at the end of my model (for which, slug must be created
> after user creates it):
>
> def save(self):
> if not self.id:
> self.slug = title.slugify()
> super(Komentar, self).save()
>

if you've imported slugify as follows:

from django.template.defaultfilters import slugify

then I think it should be:
   self.slug = slugify(self.title)

Also, due to a (n excellent) recent change, slugify actually returns
something that's not exactly a normal string (and will cause some
database backends to throw their hands up when your new item is
inserted [1]), so best to convert your slug to a normal unicode
string:
   self.slug = unicode(slugify(self.title))

Cheers,
Michael

[1] See 
http://groups.google.com/group/django-users/browse_thread/thread/b11f8fbcfb25aaa0/f1a3d791078e0385

> i've modified slug field for my model so it looks like this:
> slug= models.SlugField(blank=True) ... before
> models.SlugField(prepopulate_from='title')
>
> correct me if i'm wrong: when user creates an object, an object can't
> have slug.. so after first creation of object, i have to trigger
> save() method to save it.. and that's where i have prepopulate slug
> field. if slug field was required i would always get errors consurning
> slug. so, slug field should have blank=True, right?
> but anyway, the code doesn't work..
>
> any help is appreciated! thanks, martin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Request in a template

2007-11-21 Thread Martin

I have an parameter in my querystring which i would like to access in
a template, fx:

---

---

is this possible?

Thanks.

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



Re: starting point?

2007-11-21 Thread [EMAIL PROTECTED]

> dreamhost.com looks quite interesting though. how can they offer 500gb
> for that price? are they serious and reliable? do they allow
> subleasing of webspace?

I don't recommend Dreamhost as a host for Django applications. They
are 'serious' and their tech support is usually very helpful, but it
is an undesirable situation for a couple of reasons. First, they can
offer their amazing deals by overselling their resources. Second, it
is shared hosting so the reliability and performance of your machine
will depend on the other accounts hosted on the same machine, which
you cannot predict. In that same vein, you simple don't have much
control of your situation.

For example you might want to setup Memcached. Well... you can't. Or
you might want to use PostgreSQL instead of MySQL... and you can't.
And you might want to restart Apache... and... you can't. All these
things are relatively minor, but combined they make for a situation
that is probably untenable for an important project.

There is a newish offer by Dreamhost called DreamHost PS which allows
you to get guaranteed memory, etc, on the machines you are running on.
This is something of a step in the right direction, but you're still
going to be suffering from machines with unpredictable loads from
other individuals, and the people who I have known who use DreamHost
PS have not been resoundingly happy.

Personally I have had a very pleasant experience using Django on
Slicehost (http://www.slicehost.com). Essentially you get a virtual
machine to do whatever you want with, along with no overselling to get
performance and reliability more predictable. I wrote a howto on
getting started with Django on Slicehost (http://www.lethain.com/entry/
2007/jul/17/dreamier-dream-server-nginx/), if you go that route.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: generic views and form templates

2007-11-21 Thread Martin

btw, after this change, object gets created, but the slug field is
empty.. so i can't view the object, because of

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


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



Re: generic views and form templates

2007-11-21 Thread Martin


Thanks a lot, guys!

i'm pretty new to django and i really didn't want to use newforms in
my app. but RajeshD's idea is pretty cool. it just seems that i don't
know how to use slugify().. if you have just a little more time,
please help me for a minute:

i wrote this at the end of my model (for which, slug must be created
after user creates it):

def save(self):
if not self.id:
self.slug = title.slugify()
super(Komentar, self).save()

i've modified slug field for my model so it looks like this:
slug= models.SlugField(blank=True) ... before
models.SlugField(prepopulate_from='title')

correct me if i'm wrong: when user creates an object, an object can't
have slug.. so after first creation of object, i have to trigger
save() method to save it.. and that's where i have prepopulate slug
field. if slug field was required i would always get errors consurning
slug. so, slug field should have blank=True, right?
but anyway, the code doesn't work..

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



Re: Class Attribute in New Forms Input Elements

2007-11-21 Thread Cristian

On Nov 21, 12:31 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:

> If you want custom behavior from the form, you should probably be
> writing a custom form class.
>

I don't think this is that custom of a behavior. The old forms had
this behavior by default and this customization doesn't affect
behavior or validation. It seems like a violation of DRY to create a
custom Form class that maps exactly to a Model class only to add
attributes to the html.

I think the old forms default of having class attributes for each
input type (e.g. class=vTextField for type=text) was very helpful for
CSS purposes to help differentiate input elements. Just my 2 cents.
Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Web Hosting Service

2007-11-21 Thread Daniel Roseman

On Nov 21, 1:57 pm, cwurld <[EMAIL PROTECTED]> wrote:
> http://www.webfaction.com/
>
> They are amazing and reasonably priced. Their support is great. They
> have exceeded my expectations many times.
>
> Chuck

Second this recommendation. I am very happy with them, and they have
responded to support calls nearly instantly.
--
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Class Attribute in New Forms Input Elements

2007-11-21 Thread Daniel Roseman

On Nov 21, 8:17 pm, Cristian <[EMAIL PROTECTED]> wrote:
> Thanks for the info. Unfortunately, I forgot to mention key point
> (absentminded me) that I'm using the form_for_model function to create
> many of these Form classes. Since I create many of these Form classes
> on the fly, is there another way of specifying input element
> attributes?
>
> Thanks

You want the formfield_callback parameter to form_for_model. This is
how I do it - admittedly a bit hackish, but works. You can also use it
for other attr parameters, such as field size.

def my_callback(field, **kwargs):
formfield = field.formfield(**kwargs)
t = type(formfield.widget)
formfield.widget = t(attrs={'class':'myclass'})

...

MyForm = forms.form_for_model(Model, formfield_callback=my_callback)

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



Re: Class Attribute in New Forms Input Elements

2007-11-21 Thread James Bennett

On 11/21/07, Cristian <[EMAIL PROTECTED]> wrote:
> Thanks for the info. Unfortunately, I forgot to mention key point
> (absentminded me) that I'm using the form_for_model function to create
> many of these Form classes. Since I create many of these Form classes
> on the fly, is there another way of specifying input element
> attributes?

If you want custom behavior from the form, you should probably be
writing a custom form class.

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

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



Re: Class Attribute in New Forms Input Elements

2007-11-21 Thread Cristian

Thanks for the info. Unfortunately, I forgot to mention key point
(absentminded me) that I'm using the form_for_model function to create
many of these Form classes. Since I create many of these Form classes
on the fly, is there another way of specifying input element
attributes?

Thanks

On Nov 20, 11:44 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On 11/21/07, Cristian <[EMAIL PROTECTED]> wrote:
>
> > I've been using the old forms for a while but I'm starting to move
> > over to the new forms module. One difference that's annoying me is the
> > lack of the class attribute in the input tags. I use the class tags in
> > my CSS to change colors and widths. Is there a way to add those back
> > in (without having to dig into the django code)?
>
> The 'attrs' argument to the Widget class used with each particular
> Field (the Widget is what actually renders the HTML) accepts a
> dictionary which will become HTML attribute names and values. For
> example:
>
> username = forms.CharField(widget=forms.TextInput(attrs={'class': 'myclass'}))
>
> will become:
>
> 
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: question about list_display

2007-11-21 Thread RajeshD

>
> It is about how to use color in list_display.
> When i use it, I didn't correctly get the colored field of
> first_name.
> Only get strings like '%s'  in this
> field.
> Is there anything I misunderstand to make it work correctly?

Your use of "allow_tags" looks good.

A recent release of Django introduced this bug (the auto-escape
update). See this ticket: http://code.djangoproject.com/ticket/5973

The quickest fix is to update to the latest Djagno SVN release as this
bug is already fixed.

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



Re: generic views and form templates

2007-11-21 Thread Michael

Hi Martin,

Looking at your url conf above, I'm thinking that you're not currently
using a form for your templates? I'd create a form (newform) for your
model and then use this to ensure that entry of the slug field is not
required [1] by the user when creating a post, and then update your
form's clean_slug() method [2] so that you can check if the slug is
empty, create it from the title if need be, and validate that it is
unique for that date. Hope that helps!

-Michael

[1] http://www.djangoproject.com/documentation/newforms/#required
[2] 
http://www.djangoproject.com/documentation/newforms/#custom-form-and-field-validation

On Nov 22, 5:51 am, Martin <[EMAIL PROTECTED]> wrote:
> ok, i'll rephrase this all..
>
> i'm using django.views.generic.create_update.create_object to create
> an object, which has a slug field. i wrote custom template for
> creating objects. everytime i want to create an object i get an error,
> that the object with this title (or slug) already exists in my db.
>
> could someone tell me where to look to fix this problem?
>
> thanks in advance, martin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: generic views and form templates

2007-11-21 Thread RajeshD

> that work ok, when a user want to create an entry it opens
> komentar_form.html and it's displayed right. but when user clicks
> submit, it always returns a error for slug field. since user doesn't
> write slug field (should be prepopulated, right?),

No. That only happens in the admin and even there if you use the
"prepopulate_from" option. In your own object creation form, slug
fields are not automatically populated by Django.

So, it may be that an empty slug field is getting stored in your DB
and when you try to store a second object (with yet another emtpy slug
field), your unique=True constraint on the slugfield is causing that
error.

One solution is to generate the slug field from another suitable field
of your model (say, title or name). You can do that auto slugification
in an overridden save() method on your model.

If you need slugification code, take a look at the slugify() method in
django.templates.defaultfilters. You can simply call it directly even
though it's primary use is as a template filter.



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



Re: Permissions and user.has_perm

2007-11-21 Thread RajeshD

> 
> >>> u.has_perm("person.add_person")
> False

What's your app_label (usually the lowercase name of the app whose
models.py contains your Person class")?

The has_perm method should be called with .add_person
and not with .add_person


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



Re: generic views and form templates

2007-11-21 Thread Martin

ok, i'll rephrase this all..

i'm using django.views.generic.create_update.create_object to create
an object, which has a slug field. i wrote custom template for
creating objects. everytime i want to create an object i get an error,
that the object with this title (or slug) already exists in my db.

could someone tell me where to look to fix this problem?

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



Re: Oracle Backend - syncdb

2007-11-21 Thread Ian

On Nov 21, 5:24 am, Brot <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I expand the models.py in the django internal apps like auth, session,
> contenttypes, 
> sites,..http://www.djangoproject.com/documentation/model-api/#db-tablespace
>
> This worked for me, but It's only a workaround.
> I created a ticket, because I think it would be great to have the
> possibility to define a default tablespace for tables and indexes in
> settings.pyhttp://code.djangoproject.com/ticket/6007
>
> Bernd

Bernd,

I agree that a default tablespace setting would be useful.  This has
come up before [1], and the workarounds that were suggested then were
to set a default tablespace for the Oracle user, or to massage the
output of "manage.py sqlall" by hand (which will probably be necessary
anyway in any Oracle production deployment).  You may find one of
those to be a cleaner solution than patching the provided apps.

Thanks for bringing this up again, by the way.  It will give me
something to work on at the upcoming sprint. :-)

Ian

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



Re: Python for Leopard Users. Built-in or compiled?

2007-11-21 Thread Jannis Leidel

On 21 Nov., 16:12, "Jon Atkinson" <[EMAIL PROTECTED]> wrote:
> Considering OSX now comes with svn binaries, and built-in sqlite3
> python support, it's possible to be developing Django applications
> very quickly with Leopard.

Not to forget the availability of the setuptools :)

I liked Christopher Lenz' summary about Python on Leopard:
http://www.cmlenz.net/blog/2007/10/python-on-leopa.html

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



Re: Django Web Hosting Service

2007-11-21 Thread Chris Hoeppner

I'm enrolled in the Media Temple Django Container Beta Testing programm,
and so far, it's an absolute killer.

They've been working close with the Django guys to make it somewhat the
"official" django hoster. The django site itself is hosted on a media
temple server.

Though they're still in Beta, and not publicly available, you could try
to ask them if you could get a container to try it. You'll need a grid
server account, though.

Good Luck.

~ Chris

El mi�, 21-11-2007 a las 05:57 -0800, cwurld escribi�:
> http://www.webfaction.com/
> 
> They are amazing and reasonably priced. Their support is great. They
> have exceeded my expectations many times.
> 
> Chuck
> 
> On Nov 21, 7:40 am, "Ronaldo Z. Afonso" <[EMAIL PROTECTED]>
> wrote:
> > Hi all,
> >
> > Can anybody recommend me  a Django Web Hosting Service?
> > Thanks.
> >
> > Ronaldo.
> > 


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



Re: ANN: Reusable apps for Django - django-reusableapps 0.1

2007-11-21 Thread Jannis Leidel

Am 21.11.2007 um 16:57 schrieb Florian Apolloner:

> Does this mean that I would need to run setup.py install after every
> checkout, otherwise setuptools couldn't track it or am I mistaken?

No, you don't need to install Django over and over again since it's  
much easier to use the "develop" command for tracking svn changes.  
"python setup.py develop" tells setuptools to create a link in the  
site-packages directory to the current directory with the Django  
checkout.

So the theoretical process for a fresh Django installation with  
setuptools would be:

$  svn co http://code.djangoproject.com/svn/django/trunk/ django_src
$ cd django_src
$ python setup.py develop
...
Creating /Library/Python/2.5/site-packages/Django.egg-link (link to .)
Adding Django 0.97.pre-r6704 to easy-install.pth file
Installed /Users/Jannis/Code/django_src
...

Updating Django is easy:

$ cd django_src
$ svn update
Udjango/contrib/admin/templatetags/admin_list.py
Udjango/template/defaultfilters.py
Utests/regressiontests/templates/filters.py
Updated to revision 6708.
$ sudo python setup.py develop
...
Creating /Library/Python/2.5/site-packages/Django.egg-link (link to .)
Removing Django 0.97.pre-r6704 from easy-install.pth file
Adding Django 0.97.pre-r6706 to easy-install.pth file
Installed /Users/Jannis/Code/django_src
...

Direct installation of the current developer snapshot could be easy  
as, btw:

easy_install Django==dev


Best,
Jannis


1: 
http://peak.telecommunity.com/DevCenter/setuptools#develop-deploy-the-project-source-in-development-mode

> Best, Florian
>
> On 21 Nov., 16:39, Jannis Leidel <[EMAIL PROTECTED]> wrote:
>> Am 21.11.2007 um 13:54 schrieb Florian Apolloner:
>>
>>> Nice idea, but most (afaik) people are tracking the django-svn tree,
>>> so we might need another way to check the version requirements? Or  
>>> is
>>> there another way to make django detectable by setuptools,  
>>> although it
>>> is a svn checkout?
>>
>> Good question! The easy answer is setuptools' feature to manage
>> "Continuous Releases" using subversion [1]. Setuptools would install
>> Django as a developement snapshot as long something like this is in
>> Django's setup.cfg:
>>
>>  [egg_info]
>>  tag_build = .pre
>>  tag_svn_revision = 1
>>
>> This tells setuptools to generate version numbers like 0.97.pre-r6706
>> which are then superseded by the 0.97 release, once it's released.  
>> You
>> can of couse use dev snapshots as a dependency of a specific Django
>> app by writing in the setup.py of the app:
>>
>> install_requires = ['Django >= 0.97.pre-r6706,==dev',]
>>
>> This tells setuptools to install Django either by using a subversion
>> checkout or the newest release if available (if necessary).
>>
>> Best,
>> Jannis
>>
>> 1:http://peak.telecommunity.com/DevCenter/setuptools#managing-continuou 
>> ...


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



Re: Include tag - encoding

2007-11-21 Thread cwurld

opps - my mistake. The include file was not unicode encoded in utf-8.
It actually was ascii with chars above above 127 making up the Spanish
chars. When I converted it to unicode utf-8 all worked as expected.

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



Re: starting point?

2007-11-21 Thread [EMAIL PROTECTED]

thanks! i will look into symfony.

i don't know yet what i will do. switching webhosters (and talking my
customers into it) isn't always that easy...

dreamhost.com looks quite interesting though. how can they offer 500gb
for that price? are they serious and reliable? do they allow
subleasing of webspace?


On Nov 21, 5:00 pm, Gabriel Farrell <[EMAIL PROTECTED]> wrote:
> If you are stuck with PHP I recommend Symfony (http://www.symfony-
> project.org/). It's the most Django-like PHP framework I've seen.
>
> On Nov 21, 10:24 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > ok! argh... i don't want to use php anymore... :p is there at least a
> > django like framework for php someone can recommend?
>
> > ...and i came across this now:http://code.djangoproject.com/ticket/2407
> > why did someone work on this if django + CGI is quite unusable anyway?
> > has anyone tried this and got some performance insights?
>
> > On Nov 21, 1:27 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
>
> > > On 11/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > > > but what is incredibly slow? :) a second until everything is started
> > > > up each time? my apps probably would be quite small and there wouldn't
> > > > be many apps.
>
> > > Thepointis it's not just your apps: Django itself has to be loaded
> > > fresh into memory, all the imports have to be dealt with, modules have
> > > to be initialized, the per-process application and model caches have
> > > to be populated... there's a *ton* of behind-the-scenes work involved
> > > in getting a server process up and running with Django, and under CGI
> > > you have to do that for every single request you serve.
>
> > > If CGI is your only option, you will not be able to achieve acceptable
> > > performance for a production site, and you should not be using Django,
> > > which is designed for environments where mechanisms exist to persist
> > > the code in memory over the life of a server process.
>
> > > --
> > > "Bureaucrat Conrad, you are technically correct -- the best kind of 
> > > correct."
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: starting point?

2007-11-21 Thread Gabriel Farrell

If you are stuck with PHP I recommend Symfony (http://www.symfony-
project.org/). It's the most Django-like PHP framework I've seen.

On Nov 21, 10:24 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> ok! argh... i don't want to use php anymore... :p is there at least a
> django like framework for php someone can recommend?
>
> ...and i came across this now:http://code.djangoproject.com/ticket/2407
> why did someone work on this if django + CGI is quite unusable anyway?
> has anyone tried this and got some performance insights?
>
> On Nov 21, 1:27 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
>
> > On 11/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > > but what is incredibly slow? :) a second until everything is started
> > > up each time? my apps probably would be quite small and there wouldn't
> > > be many apps.
>
> > Thepointis it's not just your apps: Django itself has to be loaded
> > fresh into memory, all the imports have to be dealt with, modules have
> > to be initialized, the per-process application and model caches have
> > to be populated... there's a *ton* of behind-the-scenes work involved
> > in getting a server process up and running with Django, and under CGI
> > you have to do that for every single request you serve.
>
> > If CGI is your only option, you will not be able to achieve acceptable
> > performance for a production site, and you should not be using Django,
> > which is designed for environments where mechanisms exist to persist
> > the code in memory over the life of a server process.
>
> > --
> > "Bureaucrat Conrad, you are technically correct -- the best kind of 
> > correct."
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ANN: Reusable apps for Django - django-reusableapps 0.1

2007-11-21 Thread Florian Apolloner

Does this mean that I would need to run setup.py install after every
checkout, otherwise setuptools couldn't track it or am I mistaken?

Best, Florian

On 21 Nov., 16:39, Jannis Leidel <[EMAIL PROTECTED]> wrote:
> Am 21.11.2007 um 13:54 schrieb Florian Apolloner:
>
> > Nice idea, but most (afaik) people are tracking the django-svn tree,
> > so we might need another way to check the version requirements? Or is
> > there another way to make django detectable by setuptools, although it
> > is a svn checkout?
>
> Good question! The easy answer is setuptools' feature to manage
> "Continuous Releases" using subversion [1]. Setuptools would install
> Django as a developement snapshot as long something like this is in
> Django's setup.cfg:
>
>   [egg_info]
>   tag_build = .pre
>   tag_svn_revision = 1
>
> This tells setuptools to generate version numbers like 0.97.pre-r6706
> which are then superseded by the 0.97 release, once it's released. You
> can of couse use dev snapshots as a dependency of a specific Django
> app by writing in the setup.py of the app:
>
>  install_requires = ['Django >= 0.97.pre-r6706,==dev',]
>
> This tells setuptools to install Django either by using a subversion
> checkout or the newest release if available (if necessary).
>
> Best,
> Jannis
>
> 1:http://peak.telecommunity.com/DevCenter/setuptools#managing-continuou...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ANN: Reusable apps for Django - django-reusableapps 0.1

2007-11-21 Thread Jannis Leidel

Am 21.11.2007 um 13:54 schrieb Florian Apolloner:

> Nice idea, but most (afaik) people are tracking the django-svn tree,
> so we might need another way to check the version requirements? Or is
> there another way to make django detectable by setuptools, although it
> is a svn checkout?

Good question! The easy answer is setuptools' feature to manage  
"Continuous Releases" using subversion [1]. Setuptools would install  
Django as a developement snapshot as long something like this is in  
Django's setup.cfg:

  [egg_info]
  tag_build = .pre
  tag_svn_revision = 1

This tells setuptools to generate version numbers like 0.97.pre-r6706  
which are then superseded by the 0.97 release, once it's released. You  
can of couse use dev snapshots as a dependency of a specific Django  
app by writing in the setup.py of the app:

 install_requires = ['Django >= 0.97.pre-r6706,==dev',]

This tells setuptools to install Django either by using a subversion  
checkout or the newest release if available (if necessary).

Best,
Jannis

1: 
http://peak.telecommunity.com/DevCenter/setuptools#managing-continuous-releases-using-subversion

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



Re: starting point?

2007-11-21 Thread [EMAIL PROTECTED]

ok! argh... i don't want to use php anymore... :p is there at least a
django like framework for php someone can recommend?

...and i came across this now: http://code.djangoproject.com/ticket/2407
why did someone work on this if django + CGI is quite unusable anyway?
has anyone tried this and got some performance insights?



On Nov 21, 1:27 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On 11/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > but what is incredibly slow? :) a second until everything is started
> > up each time? my apps probably would be quite small and there wouldn't
> > be many apps.
>
> Thepointis it's not just your apps: Django itself has to be loaded
> fresh into memory, all the imports have to be dealt with, modules have
> to be initialized, the per-process application and model caches have
> to be populated... there's a *ton* of behind-the-scenes work involved
> in getting a server process up and running with Django, and under CGI
> you have to do that for every single request you serve.
>
> If CGI is your only option, you will not be able to achieve acceptable
> performance for a production site, and you should not be using Django,
> which is designed for environments where mechanisms exist to persist
> the code in memory over the life of a server process.
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Python for Leopard Users. Built-in or compiled?

2007-11-21 Thread Jon Atkinson

I'm using the included Python.

In past versions of OSX, I used to download and compile from MacPorts,
but MacPorts has done very little to move towards Leopard at the
moment (publically, that is - I'm sure they're working very hard
behind the scenes), and a lot of common Python modules do not
currently compile via MacPorts/Leopard.

Considering OSX now comes with svn binaries, and built-in sqlite3
python support, it's possible to be developing Django applications
very quickly with Leopard.

--Jon

On 11/21/07, jeffself <[EMAIL PROTECTED]> wrote:
>
> Which version of Python are you using on Leopard for Django?  The
> included version or did you download and compile another copy?
> >
>

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



How to specify different css properties for different fields in admin

2007-11-21 Thread Antonis Christofides

If I specify the following in the CSS:

input[type='text'] { size: 60; }

then the html fields for CharField in the admin are larger than the
default.  However, I don't want this for all fields, but only for
specific fields.

On the other hand, specifying "fields" in "class Admin" allows me to
specify classes for fieldsets. However, I might well want one
CharField to be large, another one to be small, both in the same
fieldset.

What is the way to do this?


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



Re: Setting up your django project outside the document root

2007-11-21 Thread Ian Lawrence

It is symlinking to the media folders yes...the part above this is in
the tutorial is where python knows to look in your home/Web folder for
the code:


Add the django_projects folder to the PYTHONPATH so python knows to look here:

[EMAIL PROTECTED]:~/Web$ cd ..
[EMAIL PROTECTED]:~$ sudo gedit .bashrc

this opens .bashrc and at the end of the file add
this line:

export  PYTHONPATH=".:$HOME/Web/django_projects"

HTH
Ian

On Oct 27, 2007 3:20 PM, Adam D. <[EMAIL PROTECTED]> wrote:
> I see where you are doing the symlinking...
>
> [EMAIL PROTECTED]:~$ cd /var/www
> [EMAIL PROTECTED]:/var/www$  sudo ln -s  ~/Web/media media
> [EMAIL PROTECTED]:/var/www$  sudo ln -s  ~/Web/django_src/django/contrib/
> admin/media admin_media
>
> Isn't this just symlinking to the media folders?
>
> So if I do this symlink in my root (httpdocs) this will serve the
> python project (/home/python-project)
>
> Sorry, I'm still a bit confused... Trying to un-learn my PHP'ness
>
> Thanks for the help!
>
> On Oct 27, 2:33 pm, "Ian Lawrence" <[EMAIL PROTECTED]> wrote:
> > Ola
> > basically you sym link it...
> > I recently did exactly this and wrote up the procedure 
> > here:http://ianlawrence.info/random-stuff/set-up-django-apache-and-postgre...
> >
> > hope this helps
> > Ian
> >
> > On 10/27/07, Adam D. <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> >
> > > I am a newbie.
> >
> > > Everywhere I read about django, it suggests to put your django project
> > > outside of your servers document root.
> >
> > > My question is if my document root is '/var/www/vhosts/domain.com/
> > > doc_root' and I put my project outside of that root, at '/var/www/
> > > vhosts/domain.com/django_site' how do i link it to my 'doc_root', so
> > > when i go tohttp://www.domain.com, it serves my djano site?
> >
> > > Basic stuff... Just can't find a definitive answer anywhere...
> >
> > > Also, how would having the django code in your document_root, pose a
> > > security problem, if it is all server-side code? I come from a PHP
> > > background, so I am very used to just putting the entire site in the
> > > root.
> >
> > > Thanks,
> >
> > --http://ianlawrence.info
>
>



-- 
http://ianlawrence.info

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



Python for Leopard Users. Built-in or compiled?

2007-11-21 Thread jeffself

Which version of Python are you using on Leopard for Django?  The
included version or did you download and compile another copy?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Deploying django with mysql cluster?

2007-11-21 Thread James Bennett

On 11/21/07, Richard Coleman <[EMAIL PROTECTED]> wrote:
> Does anyone have experience with using django and mysql cluster?  Do we
> need to modify django to handle this?  Any words of wisdom?

I haven't actually done it myself, but as far as I know it's a matter of:

1. Don't use syncdb to create the tables; instead, use 'manage.py
sqlall' to pipe SQL into files, change the engine type to NDB, and
then run them against the cluster.
2. For the database settings in Django, fill in the SQL node of the cluster.

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

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



Deploying django with mysql cluster?

2007-11-21 Thread Richard Coleman

We have been developing our django app using standard mysql.  But we 
plan to eventually migrate to a mysql cluster (engine is NDB).

Does anyone have experience with using django and mysql cluster?  Do we 
need to modify django to handle this?  Any words of wisdom?

Thanks for the help.

Richard Coleman
[EMAIL PROTECTED]

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



Re: Django Web Hosting Service

2007-11-21 Thread cwurld

http://www.webfaction.com/

They are amazing and reasonably priced. Their support is great. They
have exceeded my expectations many times.

Chuck

On Nov 21, 7:40 am, "Ronaldo Z. Afonso" <[EMAIL PROTECTED]>
wrote:
> Hi all,
>
> Can anybody recommend me  a Django Web Hosting Service?
> Thanks.
>
> Ronaldo.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom ManyToManyField widget in admin

2007-11-21 Thread kamil

sorry
line "{{ group.grouper.name }}: [
shoud be:
"{{ group.grouper.name }}": [

On Nov 21, 11:49 am, kamil <[EMAIL PROTECTED]> wrote:
> Hi Julien
>
> in fact you don't even have to write view for it you can use generic
> view  as follows:
>
> put in your url.py:
> ---
>
> from yourproject.cities.models import City
>
> urlpatterns = patterns('',
> ..
> (r'^custom_widget.js',
> 'django.views.generic.list_detail.object_list', { 'queryset':
> City.objects.all(),  template_name='custom_widget.html' } ),
> 
> )
>
> --
> with this line you hook all together: model view template and url
> recommeded read about generic views :)
>
> good luck
>
> On Nov 21, 12:14 am, Julien <[EMAIL PROTECTED]> wrote:
>
> > Thanks again Kamil for your help!
>
> > Ok, now I'm trying to put everything together. Sorry I'm just starting
> > with Django and I am still a bit lost.
>
> > What I am not sure about is:
> > - where to put the view?
> > - how to hook the view to the model
> > - how to hook the template with the view.
>
> > Could you provide a full example, based on the summarization below?
>
> > Thanks a lot!
>
> > models.py:
> > ---
>
> > class Country(models.Model):
> > name = models.CharField(max_length=50)
> > def __unicode__(self):
> > return self.name
> > class Admin:
> > pass
>
> > class City(models.Model):
> > name = models.CharField(max_length=50)
> > country = models.ForeignKey(Country)
> > def __unicode__(self):
> > return self.name
> > class Admin:
> > pass
>
> > class Person(models.Model):
> > firstName = models.CharField(max_length=30)
> > lastName = models.CharField(max_length=30)
> > citiesLived = models.ManyToManyField(City, null=True, blank=True)
> > def __unicode__(self):
> > return self.firstName + " " + self.lastName
> > class Admin:
> > js = "http://mysite.com/custom_widget.js";
>
> > custom_widget.html (template)
> > --
>
> > var countries = {
> > {% regroup cities by country as grouped %}
> > {% for group in grouped %}
> > "{{ group.grouper.name }}: [
> > {% for city in group.list %}
> > '{{city.name}}' ,
> > {% endfor %}  ]
> > {% endfor %}
>
> > }
>
> > custom_widget.js
> > 
>
> > var countries = {'england': ['London','Manchester'], 'france':
> > ['Paris'] }
>
> > document.forms['your_form'].id_country.onchange = function()
> > { listCities(this.value) };
>
> > function listCities ( country ) {
> > document.forms['your_form'].id_city.options.length = 0
> > var l = countries[ country ].length;
> > for (var i = 0; l > i; i++) {
> > document.forms['your_form'].id_city.options[i] = new
> > Option( countries[ country ][i], countries[ country ][i]);
> > }
>
> > }
>
> > On Nov 21, 11:06 am, kamil <[EMAIL PROTECTED]> wrote:
>
> > > You would achieve it using "regroup" template tag
> > > First get cities in your view
> > > and create template with code:
>
> > > var countries = {
> > > {% regroup cities by country as grouped %}
> > > {% for group in grouped %}
> > > "{{ group.grouper.name }}: [
> > > {% for city in group.list %}
> > > '{{city.name}}' ,
> > > {% endfor %}  ]
> > > {% endfor %}
>
> > > }
>
> > > (If it dosnt work straigt away just look at  "regroup" template tag in
> > > the docs - idea is there)
>
> > > add url of this template to js list in model admin code and thats
> > > all :)
>
> > > On Nov 20, 11:54 am, Julien <[EMAIL PROTECTED]> wrote:
>
> > > > Hi,
>
> > > > When I look at the html source code generated for the regular
> > > > ManyToManyField's widget, it's an html form, not javascript...
> > > > Are you sure there is no other way?
>
> > > > Could you please give a full example?
>
> > > > I've spent quite sometime practicing with the tutorials but I'm a bit
> > > > lost on this one.
>
> > > > Thanks a lot!
>
> > > > On Nov 20, 9:04 pm, kamil <[EMAIL PROTECTED]> wrote:
>
> > > > > I dont think there is another way that making your hands dirty with
> > > > > javascript. ;)
> > > > > If you want to be fancy you can even make it ajax - getting the cities
> > > > > on demand
>
> > > > > On Nov 20, 9:35 am, kamil <[EMAIL PROTECTED]> wrote:
>
> > > > > > You can easily generate cities list to the javascript dynamically
> > > > > > writing the template for separate js file.
>
> > > > > > On Nov 20, 9:22 am, Julien <[EMAIL PROTECTED]> wrote:
>
> > > > > > > Hi Kamil,
>
> > > > > > > Thanks a lot for your suggestion!
>
> > > > > > > I have a few remarks though. The list of cities is dynamic, in the
> > > > > > > sense that you may add, remove cities from the database at any 
> > > > > > > ti

Django Web Hosting Service

2007-11-21 Thread Ronaldo Z. Afonso

Hi all,

Can anybody recommend me  a Django Web Hosting Service?
Thanks.

Ronaldo.

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



(WWW.CNCIRCLE.COM) cheape wholesale nike jodan, af1, airmax, shox ,dunk, sneaker shoes, Gucci, prada, lacoste, lv, bape outlet shoes, and hoodies , jean, jacket, MP3,MP4, WATCH,IPHONE

2007-11-21 Thread kook

(WWW.CNCIRCLE.COM) cheape wholesale nike jodan, af1, airmax,
shox ,dunk, sneaker shoes, Gucci, prada, lacoste, lv, bape outlet
shoes, and hoodies , jean, jacket, MP3,MP4, WATCH,IPHONE
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ANN: Reusable apps for Django - django-reusableapps 0.1

2007-11-21 Thread Florian Apolloner

> Versionized reusable apps are definitely a desirable feature! But I
> don't like the idea of just using different entrypoints for each
> Django release or other dependency. The setuptools _do_ have native
> support for complex dependencies [1] via the "install_requires"
> keyword. If Django would be distributed by using setuptools (to make
> Django detectable by the setuptools), you could declare the dependency
> in the setup.py file of the Django app:
>
> install_requires = ['Django>=0.96',]
>

Nice idea, but most (afaik) people are tracking the django-svn tree,
so we might need another way to check the version requirements? Or is
there another way to make django detectable by setuptools, although it
is a svn checkout?

Best,
Florian

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



Re: starting point?

2007-11-21 Thread James Bennett

On 11/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> but what is incredibly slow? :) a second until everything is started
> up each time? my apps probably would be quite small and there wouldn't
> be many apps.

The point is it's not just your apps: Django itself has to be loaded
fresh into memory, all the imports have to be dealt with, modules have
to be initialized, the per-process application and model caches have
to be populated... there's a *ton* of behind-the-scenes work involved
in getting a server process up and running with Django, and under CGI
you have to do that for every single request you serve.

If CGI is your only option, you will not be able to achieve acceptable
performance for a production site, and you should not be using Django,
which is designed for environments where mechanisms exist to persist
the code in memory over the life of a server process.


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

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



Re: Oracle Backend - syncdb

2007-11-21 Thread Brot

Hello,

I expand the models.py in the django internal apps like auth, session,
contenttypes, sites,..
http://www.djangoproject.com/documentation/model-api/#db-tablespace

This worked for me, but It's only a workaround.
I created a ticket, because I think it would be great to have the
possibility to define a default tablespace for tables and indexes in
settings.py
http://code.djangoproject.com/ticket/6007

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



Re: starting point?

2007-11-21 Thread [EMAIL PROTECTED]

ok, thanks!

but what is incredibly slow? :) a second until everything is started
up each time? my apps probably would be quite small and there wouldn't
be many apps.

in case i would like to experiment with it nevertheless, is there a
django CGI how-to somewhere?

On Nov 21, 10:23 am, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On 11/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > is it also possible to use django with normal cgi?
>
> > i think performance wouldn't be a big problem since i only do low
> > traffic sites.
>
> Django does not offer direct support for CGI. The performance problem
> is unrelated to traffic; it's the fact that CGI would need to load the
> entire framework and all your applications into memory on *every*
> request, which means that no matter what your level of traffic, the
> response time is going to be incredibly slow.
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Feeds

2007-11-21 Thread Miguel Galves
Eventually, I gave up using the django feed package, and ended up
writing my own. If someone is interested, please contact me.

On Nov 13, 2007 9:52 PM, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:

>
>
> On 14-Nov-07, at 4:39 AM, Miguel Galves wrote:
>
> > I dont understand your question. What do you mean by
> > "if you want a feed, you have to give one"...
>
> if you want a feed, you have to give an absolute url
>
> --
>
> regards
> kg
> http://lawgon.livejournal.com
> http://nrcfosshelpline.in/web/
>
>
>
> >
>


-- 
Miguel Galves - Engenheiro de Computação
Já leu meus blogs hoje?
Para geeks http://log4dev.com
Pra pessoas normais
http://miguelcomenta.wordpress.com

"Não sabendo que era impossível, ele foi lá e fez..."

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



Re: ANN: Reusable apps for Django - django-reusableapps 0.1

2007-11-21 Thread Jannis Leidel

> Versionized reusable apps are definitely a desirable feature! But I
> don't like the idea of just using different entrypoints for each
> Django release or other dependency. The setuptools _do_ have native
> support for complex dependencies [1] via the "install_requires"
> keyword.

Forgot the link :)

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



Re: ANN: Reusable apps for Django - django-reusableapps 0.1

2007-11-21 Thread Jannis Leidel

> I like the idea of 'django.apps', which is kinda more explicit than
> just 'apps'. ;-)

Yeah, though it may be confusing because there is no real
"django.apps" module :-/
What about "django.applications"? Any other objections?

> Following on this thought, maybe we can use version numbers (major,
> minor) to help users
> in identifying which Django version we're tracking.
> I.e:
> - django96.apps : Apps for Django-0.96 release
> - django97.apps : Apps for Django-0.97
> ...and so forth..
>
> The advantage of using version numbers is that it would be easy to
> build reusable apps
> for a specific django version, which could be more stable than trunk..

Versionized reusable apps are definitely a desirable feature! But I
don't like the idea of just using different entrypoints for each
Django release or other dependency. The setuptools _do_ have native
support for complex dependencies [1] via the "install_requires"
keyword. If Django would be distributed by using setuptools (to make
Django detectable by the setuptools), you could declare the dependency
in the setup.py file of the Django app:

install_requires = ['Django>=0.96',]

With that, the setup.py would check for the currently installed Django
version and update it, if necessary. I hope to convince some
developers to reintroduce setuptools to the Django code, since it
doesn't make sense to me to reinvent the wheel while designing a
"Django Apps API" (versioning, dependency tracking, packaging).

Best,
Jannis

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



Re: Custom ManyToManyField widget in admin

2007-11-21 Thread kamil

Hi Julien

in fact you don't even have to write view for it you can use generic
view  as follows:

put in your url.py:
---

from yourproject.cities.models import City

urlpatterns = patterns('',
..
(r'^custom_widget.js',
'django.views.generic.list_detail.object_list', { 'queryset':
City.objects.all(),  template_name='custom_widget.html' } ),

)

--
with this line you hook all together: model view template and url
recommeded read about generic views :)

good luck

On Nov 21, 12:14 am, Julien <[EMAIL PROTECTED]> wrote:
> Thanks again Kamil for your help!
>
> Ok, now I'm trying to put everything together. Sorry I'm just starting
> with Django and I am still a bit lost.
>
> What I am not sure about is:
> - where to put the view?
> - how to hook the view to the model
> - how to hook the template with the view.
>
> Could you provide a full example, based on the summarization below?
>
> Thanks a lot!
>
> models.py:
> ---
>
> class Country(models.Model):
> name = models.CharField(max_length=50)
> def __unicode__(self):
> return self.name
> class Admin:
> pass
>
> class City(models.Model):
> name = models.CharField(max_length=50)
> country = models.ForeignKey(Country)
> def __unicode__(self):
> return self.name
> class Admin:
> pass
>
> class Person(models.Model):
> firstName = models.CharField(max_length=30)
> lastName = models.CharField(max_length=30)
> citiesLived = models.ManyToManyField(City, null=True, blank=True)
> def __unicode__(self):
> return self.firstName + " " + self.lastName
> class Admin:
> js = "http://mysite.com/custom_widget.js";
>
> custom_widget.html (template)
> --
>
> var countries = {
> {% regroup cities by country as grouped %}
> {% for group in grouped %}
> "{{ group.grouper.name }}: [
> {% for city in group.list %}
> '{{city.name}}' ,
> {% endfor %}  ]
> {% endfor %}
>
> }
>
> custom_widget.js
> 
>
> var countries = {'england': ['London','Manchester'], 'france':
> ['Paris'] }
>
> document.forms['your_form'].id_country.onchange = function()
> { listCities(this.value) };
>
> function listCities ( country ) {
> document.forms['your_form'].id_city.options.length = 0
> var l = countries[ country ].length;
> for (var i = 0; l > i; i++) {
> document.forms['your_form'].id_city.options[i] = new
> Option( countries[ country ][i], countries[ country ][i]);
> }
>
> }
>
> On Nov 21, 11:06 am, kamil <[EMAIL PROTECTED]> wrote:
>
> > You would achieve it using "regroup" template tag
> > First get cities in your view
> > and create template with code:
>
> > var countries = {
> > {% regroup cities by country as grouped %}
> > {% for group in grouped %}
> > "{{ group.grouper.name }}: [
> > {% for city in group.list %}
> > '{{city.name}}' ,
> > {% endfor %}  ]
> > {% endfor %}
>
> > }
>
> > (If it dosnt work straigt away just look at  "regroup" template tag in
> > the docs - idea is there)
>
> > add url of this template to js list in model admin code and thats
> > all :)
>
> > On Nov 20, 11:54 am, Julien <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
>
> > > When I look at the html source code generated for the regular
> > > ManyToManyField's widget, it's an html form, not javascript...
> > > Are you sure there is no other way?
>
> > > Could you please give a full example?
>
> > > I've spent quite sometime practicing with the tutorials but I'm a bit
> > > lost on this one.
>
> > > Thanks a lot!
>
> > > On Nov 20, 9:04 pm, kamil <[EMAIL PROTECTED]> wrote:
>
> > > > I dont think there is another way that making your hands dirty with
> > > > javascript. ;)
> > > > If you want to be fancy you can even make it ajax - getting the cities
> > > > on demand
>
> > > > On Nov 20, 9:35 am, kamil <[EMAIL PROTECTED]> wrote:
>
> > > > > You can easily generate cities list to the javascript dynamically
> > > > > writing the template for separate js file.
>
> > > > > On Nov 20, 9:22 am, Julien <[EMAIL PROTECTED]> wrote:
>
> > > > > > Hi Kamil,
>
> > > > > > Thanks a lot for your suggestion!
>
> > > > > > I have a few remarks though. The list of cities is dynamic, in the
> > > > > > sense that you may add, remove cities from the database at any time
> > > > > > using the admin interface.
> > > > > > So how can we fetch dynamically the list of available cities to
> > > > > > display them in the select widget?
>
> > > > > > Also, isn't there a "recommended" way of doing? Hijacking with
> > > > > > javascript seems more like a trick. I may be wrong.
>
> > > > > > Thanks!  ;)
>
> > > > > > On Nov 20, 8:13 pm, kamil <[EMAIL PROTECT

Re: Oracle Backend - syncdb

2007-11-21 Thread Norbert

Maybe you can change the tablespace in the initial sql, see here
http://www.djangoproject.com/documentation/model-api/#database-backend-specific-sql-data

Norbert

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



generic views and form templates

2007-11-21 Thread Martin

hi,

i'm having a little trouble with templates for my app. here is the
problem: i have title, slug and body field for my model blog. i would
like other users to create blog entries, so i've used generic views
and put this in my urls.py:

(r'^edit/(?P\d+)/$',   update_object, dict(model=Komentar,
login_required=True, template_name="komentar/
komentar_edit_form.html")),
(r'^create/$',create_object, dict(model=Komentar,
login_required=True, post_save_redirect="/komentar/latest/")),

that work ok, when a user want to create an entry it opens
komentar_form.html and it's displayed right. but when user clicks
submit, it always returns a error for slug field. since user doesn't
write slug field (should be prepopulated, right?), i've put this in my
komentar_form.html:

{% if
form.slug.errors %}arghhh!?!{% endif %}

my question here is, is this html code right? how should slug fields
be presented in html templates? i could find this in django
documentation (about slug fields).

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



Permissions and user.has_perm

2007-11-21 Thread Jon Atkinson

Hello,

I am having some trouble with user permissions. I've read the
documentation, but the built-in Permission object isn't behaving as I
expect. Any help would be appreciated.

I have a simple project containing one app. That app has one model,
which is as follows. The model should be irrelevant, but it's here for
the sake of completeness:

class Person(models.Model):

first_name = models.CharField(blank=True, maxlength=100)
second_name = models.CharField(blank=True, maxlength=100)

class Admin:
pass

When I run ./manage.py syncdb, I get the following output (sections
removed where not relevant to my question):

hostname:permtest jonathan$ ./manage.py syncdb
Creating table auth_message
Creating table auth_group
Creating table auth_user
Creating table auth_permission
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table django_admin_log
Creating table foo_person

You just installed Django's auth system, which means you don't have
any superusers defined.
Would you like to create one now? (yes/no): yes
Username (Leave blank to use 'jonathan'): jonathan
Superuser created successfully.
Installing index for auth.Message model
Installing index for auth.Permission model
Loading 'initial_data' fixtures...
Installing index for admin.LogEntry model
No fixtures found.

I then have one superuser called 'jonathan', who has permission to do
anything. A shell session:

>>> from django.contrib.auth.models import User
>>> u = User.objects.get(id=1)
>>> u

>>> u.has_perm("person.add_person")
True

However, if I remove the 'superuser' status from that user, but assign
them all permissions (I simply click the 'choose all' button in
/admin/), the console session reports that this user has no
permissions, even though I can happily use /admin/ to, for example,
edit Person records:

>>> from django.contrib.auth.models import User
>>> u = User.objects.get(id=1)
>>> u

>>> u.has_perm("person.add_person")
False

However, if I inspect the user object, all the permissions seem to be in place:

>>> from django.contrib.auth.models import User
>>> u = User.objects.get(id=1)
>>> u

>>> permissions = u.user_permissions.all()
>>> len(permissons)
27
>>> permissions
[, ... (snipped)

All the permissions seem to be present for the user, but each time I
query a permission, regardless of what the user's capabilities are in
the admin console, False is always returned:

>>> u.has_perm("message.add_message")
False
>>> u.has_perm("session.add_session")
False
>>> u.has_perm("site.edit_session")
False

Am I simply interrogating a user object incorrectly, or have I
completely misunderstood how permissions work?

I'm expecting to be able to check if a user has permission to edit
data in a view just by doing something like

if u.has_perm("person.add_person"):
render_to_response("add_person.html")
else:
render_to_response("permission_denied.html")

FWIW, I'm using Django SVN on OSX, sqlite database.

Any help would be much appreciated, I spent the better part fo a day
trying to work this out :-)

--Jon

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



Re: How to create groups from code?

2007-11-21 Thread Jose Jiménez

Thanks for your response Artiom, but i have a question about it.

the documentation you link me says: "for each model in each specified
app, this command looks for the file /sql/.sql"
but i want initialize the auth_group table, so i haven't a model for
that. i tried to put a groups.pyyaml.sql but it does not anything.

Thanks.

On 20 nov, 18:55, Artiom Diomin <[EMAIL PROTECTED]> wrote:
> take a look 
> herehttp://www.djangoproject.com/documentation/model-api/#providing-initi...
>
> PS: note, you can different formats for inial data, I'm for example
> using pyyaml (it's database backend independent)
>
> Jose Jiménez пишет:
>
> > Hello everybody,
>
> > I'm starting a project in django. I need some custom permissions that
> > i created in the model with "class Meta". Now i need to create
> > some groups. I've seen that i can create groups from the
> > administration panel, but... i would like to create from source code,
> > so, if other person downloads the code and installs django, could make
> > a "syncdb" and automagically has the same groups.
>
> > I've been looking for in google but i haven't found anything. Is it
> > possible??
>
> > Sorry for my english, i hope you understand me.
>
> > Thanks.
>
> > ---
> > Jose Jiménez
> > [EMAIL PROTECTED]
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: choices option in input-field

2007-11-21 Thread Nader

I have read quickly the article "Variable Choice Lists'. I don't have
a lot experience with Django, however I would try to explain my case.
I have  a model in which one of the fields has to be 'SelectedField',
therefore I have to use a 'choices' options.

class Dataset(models.Model):
   .
   .
   choice = models.IntegerField(choices=LT)
   .

The choice field in this model has to get information from other model
in other application, but in the same project. What I have done is
this:

   from project.app.models import Model

   all_entries = Model.objects.all()
   ls = []
   LT = []
   for elm in all_entires:
   ls.append(int(elm.attr))

   for elm in ls:
  (f,s) =(i,elm)
  LT.append((f, '%s' % s))

So this manner I try to get information for this Field. I don't know
whether it is a correct manner.
Besides I would like to say that on 'pointy-stick.com' site are very
interesting articles about different subject.

Regards,
Nader





On Nov 20, 10:47 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Tue, 2007-11-20 at 00:19 -0800,Naderwrote:
> > Hallo,
>
> > I have a model in which I have to use a input-field withchoices
> > option.
>
> > ACCESS = (
> >  ('RO', 'readonly'),
> >  ('WO', 'writeonly'),
> >  ('RW', 'readwrite'),
> >  )
>
> > Class myClass (...)
> >..
> >...
> >active = models.IntegerField(choices=ACCESS, radio_admin=True)
> >...
>
> > The value for 'choices' is of tuple type, actually tuple of tuple. In
> > some case I have to use some dynamic information, it means that I
> > don't know in front how many element in tuple will be present. I can
> > define a empty tuple and then assign the elements to the tuple, but
> > tuple is a unmutuable type. I can't use also 'list' or dictionary.
> > Would you like to help me to solve this problem.
>
> If you mean that every single time you access the field thechoices
> might be different, then you don't want to be using 'choices' here. You
> want a many-to-many field instead. If you mean that you won't know the
> value ofchoicesuntil the *first* time you access the field, read this:
>
> http://www.pointy-stick.com/blog/2007/03/26/django-tips-variable-choi...
>
> Regards,
> Malcolm
>
> --
> He who laughs last thinks slowest.http://www.pointy-stick.com/blog/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: starting point?

2007-11-21 Thread James Bennett

On 11/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> is it also possible to use django with normal cgi?
>
> i think performance wouldn't be a big problem since i only do low
> traffic sites.

Django does not offer direct support for CGI. The performance problem
is unrelated to traffic; it's the fact that CGI would need to load the
entire framework and all your applications into memory on *every*
request, which means that no matter what your level of traffic, the
response time is going to be incredibly slow.

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

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



Re: starting point?

2007-11-21 Thread [EMAIL PROTECTED]

is it also possible to use django with normal cgi?

i think performance wouldn't be a big problem since i only do low
traffic sites.

On Nov 21, 5:17 am, gmacgregor <[EMAIL PROTECTED]> wrote:
> On Nov 20, 3:08 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > thanks! hopefully my webhoster allows all the needed .htaccess stuff.
> > but it sounds promising...
>
> > how can i figure out if my webhoster uses fastcgi? can this info be
> > printed with a simple script?
>
> Take a look at the documentation surrounding your plan details and if
> that fails then contact support... FYI, a list pf Django friendly web
> hosts can be found here:
>
> http://code.djangoproject.com/wiki/DjangoFriendlyWebHosts
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Understanding autoescape-aware filters

2007-11-21 Thread Ivan Sagalaev

Thanks for clarification! I have couple more things to iron out though...

Malcolm Tredinnick wrote:
> If we didn't have is_safe, every filter that did some kind of string
> manipulation such as input = intput + 'x' would need to end with lines
> like
> 
> if isinstance(orig_input, SafeData):
> result = mark_safe(result)
> return result
> 
> and they would have to remember to save the original input (or test its
> type very early).

Got it now. So if I understand correctly

- mark_safe means that filter takes full responsibility for its output
- .is_safe means that filter doesn't want to know details of its input 
and thus takes responsibility only for its own additions

> Finally, auto-escaping is only appropriate for HTML text.

Yes, I've completely forgot about emails etc... :-( This now makes sense 
why one might want to not escape and mark_safe output.

> However, some of your filters might still be
> useful in those sorts of sections. Imagine, for example, a filter that
> always replaced the word "and" by "&". It will need to behave
> differently in different auto-escaping contexts (use "&" in HTML
> templates, and "&" in email).

And this is a very clear example :-).

> I've rewritten most of the filtering and auto-escaping section (in
> [6692]). Have a read of it and see if it makes more sense from the point
> of view of where you were 24 hours ago. I've tried to approach it from a
> different direction, hopefully motivating things a bit more without
> getting us bogged down in unimportant details.

Yes, it really is better now! Thanks :-). There are a couple of small 
points however:

 > This attribute tells Django that is a “safe” string is passed into 
your filter, the result will still be “safe”

I kinda think that emphasizing the safeness of input here is 
distracting. I'd rather emphasize that ".is_safe" means that author 
doesn't want to think of input very much and wants to let Django think 
for him, and the details of how it will be done are not important. They 
are still interesting though and might be noted afterwards. Something 
like this (though it's a bit verbose):

 This attribute tells Django that your filter works with
 various input types and can only be sure that it doesn't
 do any "unsafe" changes to it. Django will then decide if
 the whole output needs to be escaped or not keeping track
 of whether or not input was already safe.

Another thing is the example code of initial_letter_filter. I think it 
can be written shorter and without lambda:

-if autoescape:
-esc = conditional_escape
-else:
-esc = lambda x: x
-result = '%s%s' % (esc(first), esc(other))
+if autoescape:
+first, other = conditional_escape(first), conditional_escape(other)
+result = '%s%s' % (first, other)

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



Oracle Backend - syncdb

2007-11-21 Thread Brot

Hello,

yesterday I tried django in my company. We have oracle databases. But
now I have a problem! :-(

Is it possible to define TABLESPACES for the "syncdb" - CREATE TABLE -
Statements? If not, where can I find the Statements in the source code
to extend the statement? I am searching the source code, but couldn't
find it.

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