Re: Obtaining schema info from models

2008-07-21 Thread SSA
Hi Malcolm,

On Mon, Jul 21, 2008 at 10:45 PM, Malcolm Tredinnick <
[EMAIL PROTECTED]> wrote:

>
> On Mon, 2008-07-21 at 21:23 -0700, s wrote:
>
> I'm trying to create a dynamic export mechanism (pretty simple) but
> > also trying to export a schema file for the parties wishing to re-
> > import, said-export, with better insight.
>


> Some of your words could have multiple meanings, so it's hard to know
>
exactly what you're asking. Do you mean that you're trying to export the
> database schema for these models? In that case, you could try to use
> what django.core.management.sql.sql_create() would return when you pass
> it the right parameters.
>

Well, I wasn't looking specifically for the SQL, but the
mechanisms effectively used to inspect the model(s) and subsequently
generate the SQL.

After a quick look at ...sql_create(), I see that
django.db.models.loading.py and
django.core.management.sql._get_sql_model_create() have the pieces I'm
looking for.

An interesting bit will be to see if I can do this from within a model or if
it will be easier as a separate util. I'm trying to make each model
responsible for the export of its own data (but not the marking to disk,
etc.). This is because the users can sub-select fields from within each
model, so the list - even the order, is somewhat dynamic.

If that isn't what you mean, a little more context will help us to help
> you.


It gives me a good place to look, without wasting too much valuable time of
others.

For better insight, here's hopefully a better explanation of what I'm
wishing to do:

Example model:

class dummy_model(models.Model):
name = models.CharField(maxlength=64)
active = models.BooleanField()
fav_color = models.CharField(max_length=16
...

Exported data:
"Fred",True,"red"
"Jane",True,"green"
"Bob",False,"pink"

I wish to create a file containing:
FieldTypeLength
name   string64
active   bool  1
fav_color   string16
...

Of course, I'd have to do something different for calculated values (from
methods).

Thanks for the info, much appreciated!

/S

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Making a Form from a model using ModelForms, but dont want to include the ForeignKey variable in the form

2008-07-21 Thread Django_newbie

Hi James,

That was a quick replyExcluding the field helped.

Thank you soo much


On Jul 21, 5:49 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Mon, Jul 21, 2008 at 4:09 PM, Django_newbie <[EMAIL PROTECTED]> wrote:
> > This save() fails because the form.is_valid() is not true, and the
> > Blog(foreignkey) field is missing from the post data, how can i make
> > this save without letting user choose this blog field? Or is it
> > necessary that the foreignkey field has to be alwayz chosen from a
> > form?
>
> The documentation for ModelForm covers both:
>
> 1. Excluding fields from a ModelForm (thus doing away with attempts to
> validate those fields), and
> 2. Getting a "partial" object back from a ModelForm which you can
> modify before actually saving to your database.
>
> Details are available here:
>
> http://www.djangoproject.com/documentation/modelforms/
>
> --
> "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: Using multiple databases

2008-07-21 Thread Ben Ford
It won't be in 1.0. It's only really been kicked off recently, so you'll
have to wait a while :-)

2008/7/21 CPF_ <[EMAIL PROTECTED]>:

>
> Ben Ford wrote:
> > Hi There,
> >
> > It has been possible in the past to use multiple databases with
> > django. There was a branch for it and about a year ago it was bought
> > up to date with trunk. However that branch hasn't seen any activity
> > for some time and is effectively dead. There's now a (low key) effort
> > under way to come up with a new API and to take advantage of the
> > recent work in refactoring the database API to again make it possible
> > to use multiple databases in your django project. As it stands at the
> > moment it's at an early stage, and it's really unlikely that anything
> > significant will happen until django 1.0 arrives.
> >
> > My advice based on what you've said above would be to use django's ORM
> > for your authentication (and sessions, permissions, groups etc) if
> > it's a good fit for you. That way you'd get all of the great time
> > saving bits of django (like request.user, perms in the template
> > language, authentication cookies etc). In addition to that  maybe
> > you'd like to think about using a different ORM for talking to the
> > other database. There is a project underway on google code to make
> > using SQLAlchemy easier with django - this might be the way to go.
> >
> > I'm not sure what others on this mailing list would think about this
> > approach... I'd certainly be interested to hear any thoughts!
> >
> > Cheers,
> > Ben
> >
> > 2008/7/20 CPF_ <[EMAIL PROTECTED]
> > >:
> >
> >
> > [EMAIL PROTECTED]  wrote:
> > > Dan wrote:
> > >>
> > >> Most ideally we would like to have it so that the application
> > >> uses DB1
> > >> (defined in the settings.py file) as the main database, but
> > when
> > >> it's
> > >> down to users, uses DB2.user as the users table.
> > >> Currently we are thinking of using raw sql, but that would
> > only be a
> > >> last resort preferably. And at that point I'd be more
> scrambled
> > >> on how
> > >> to use authenticate together with it.
> > >>
> > >>
> > >> If you are using MySQL, you can use the federated engine for
> tables
> > >> that are only "symlinks" to real tables in another database but
> > will
> > >> act as normal tables when doing regular operations on them.
> > >>
> > >> It might be possible with other databases too, I don't know.
> > > Hi Dan, thanks for the reply.
> > > We are indeed using MySQL, and attemipting to symlink (as the mysql
> > > documentation at
> > >
> > http://dev.mysql.com/doc/refman/5.0/en/symbolic-links-to-tables.html)
> > > didn't work out ("SQL show index from `users` failed : Table
> > > 'bingo.users' doesn't exist" is what webmin said)
> > >
> > > If you're implying some other technique, I have no idea what you
> are
> > > talking about - could you please explain, or redirect to a page
> > > explaining it?
> > >
> > > Thanks.
> > Sorry for kicking this subject, but I'd really like to have an
> > answer to
> > that...
> >
> > Thanks in advance.
> >
> >
> >
> >
> >
> > --
> > Regards,
> > Ben Ford
> > [EMAIL PROTECTED] 
> > +447792598685
> Hi Ben,
> Thanks a lot for the explanation and the insight. I'll be looking up
> some of those ideas you mentioned, and the way you explain it is really
> the way I would like to do it.
> Currently I started development using a standard auth_users but at some
> time, I would like to use the users database already existing...
> There's the other possibility to change the project originally using the
> database. However, regardless, I would still know the way to use
> multiple databases, and if it will be integrated in the 1.0 release, I
> really believe that I will use the 1.0 a lot. Therefore I'll look for
> that feature.
>
> cpf_
>
> >
>


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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 permission problem in newforms-admin

2008-07-21 Thread [EMAIL PROTECTED]

I believe you can override get_form and have it create a new modelform
for each request, you'd probably have to look into the source to see
what the method and signature look like.


On Jul 21, 8:04 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote:
> Doh! You're absolutely right Malcom. Sorry, don't know why I didn't
> see that before.
>
> So, now that I have my lovely permission, I have a new problem...
> I need the ability to let a user 'add' a story, even if they can't
> 'approve' one. So, I'm wondering where I should try to disable the
> field? In the model, or in the change_form? I'm not very experienced
> in customizing the admin, but am very eager to learn.
>
> Kind regards,
> Brandon
>
> On Jul 21, 5:50 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
> wrote:
>
> > On Mon, 2008-07-21 at 15:46 -0700, Brandon Taylor wrote:
> > > Hi everyone,
>
> > > I'm trying to enforce a customer permission on Add/Update. In my
> > > model, I have defined the permission:
>
> > > permissions = (
> > >                        ('can_approve_stories','Can Approve Stories'),
> > >         )
>
> > > in my model.ModelAdmin I have:
>
> > > def change_view(self, request, obj_id):
> > >         if request.user.has_perm('can_approve_stories'):
> > >             return super(StoryAdmin, self).change_view(request,
> > > obj_id)
> > >         else:
> > >             raise PermissionDenied
>
> > >     def add_view(self, request, obj_id):
> > >         if request.user.has_perm('can_approve_stories'):
> > >             return super(StoryAdmin, self).add_view(request, obj_id)
> > >         else:
> > >             raise PermissionDenied
>
> > > The change_view permission is working. The add_view thrown an error:
>
> > > TypeError at /admin/stories/story/add/
> > > add_view() takes exactly 3 arguments (2 given)
>
> > > Can someone please show me what I'm doing wrong?
>
> > At a guess: if you're adding an object, passing in the object_id doesn't
> > make a lot of sense (the object doesn't exist yet).
>
> > Regards,
> > Malcolm
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Must Have Python resources

2008-07-21 Thread Kenneth Gonsalves


On 21-Jul-08, at 6:14 PM, Amirouche wrote:

> On 21 juil, 11:11, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
>> On 21-Jul-08, at 1:53 PM, Hussein B wrote:
>>
>>> Well, I know this question isn't related to Django but I hope it  
>>> is ok
>>> to ask.
>>> What are your favourite Python resources?
>>
>> diveintopython -
>
> how is that book outdated ?

the django book is based on version 0.96 - which is very old, hence  
outdated

-- 

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



Re: Must Have Python resources

2008-07-21 Thread Amirouche



On 21 juil, 11:11, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
> On 21-Jul-08, at 1:53 PM, Hussein B wrote:
>
> > Well, I know this question isn't related to Django but I hope it is ok
> > to ask.
> > What are your favourite Python resources?
>
> diveintopython -

how is that book outdated ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Obtaining schema info from models

2008-07-21 Thread Malcolm Tredinnick


On Mon, 2008-07-21 at 21:23 -0700, s wrote:
> Okay, I know this _should_ be easy but I'm in my all-too-familiar mode
> of "mental block" with a little frustration peppered in.
> 
> I'm trying to create a dynamic export mechanism (pretty simple) but
> also trying to export a schema file for the parties wishing to re-
> import, said-export, with better insight.

Some of your words could have multiple meanings, so it's hard to know
exactly what you're asking. Do you mean that you're trying to export the
database schema for these models? In that case, you could try to use
what django.core.management.sql.sql_create() would return when you pass
it the right parameters.

If that isn't what you mean, a little more context will help us to help
you.

Regards,
Malcolm



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



Obtaining schema info from models

2008-07-21 Thread s

Okay, I know this _should_ be easy but I'm in my all-too-familiar mode
of "mental block" with a little frustration peppered in.

I'm trying to create a dynamic export mechanism (pretty simple) but
also trying to export a schema file for the parties wishing to re-
import, said-export, with better insight.

Thanks IA,

/S

PS. Yup, I have a padded spot handy for the head-meeting-wall d'oh
moment.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Table Row count: Limiting factor

2008-07-21 Thread Ramdas S
Lakh =100,000.

Answer is yes

On Mon, Jul 21, 2008 at 8:42 PM, madhav <[EMAIL PROTECTED]> wrote:

>
> Hello guys, I am just confused with a fundamental db problem. I have
> table which has got 48 lakh rows(each row has got 8 fields, all
> INDEXED) and I just need to fetch 500 rows from it. Would that take
> more time than extracting the same number(500) of rows from a small
> table of say 1 Lakh rows? Each row field is indexed in both the cases.
> Please correct me if I am wrong.
> >
>


-- 
Ramdas S
+91 9342 583 065
My Personal Blog: http://ramdas.diqtech.com

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



Re: How to inline somethin to a FlatPage

2008-07-21 Thread slav0nic

try admin.site.unregister(FlatPage) befor register 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ImportError: cannot import name parse_lookup

2008-07-21 Thread Karen Tracey
If you search this list for likely keywords like the book you are using and
the app you are trying to get working you will find that other people have
hit the same problem, and I believe they have described solutions.  I don't
have time to look up specific posts right now, but I know I have seen this
question asked and answered in the last week or so.

Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Password reset/recovery for code.djangoproject.com?

2008-07-21 Thread Justin Fagnani

I can't seem to find any password reset form for Trac, or an
administrator email address.

There has to be some way I can avoid creating a new account, no?

-Justin

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: propagation of modification in children to parents

2008-07-21 Thread Daniel Roseman

On Jul 21, 7:52 pm, "Andre Meyer" <[EMAIL PROTECTED]> wrote:
> hi again
>
> so, auto_now is deprecated and can be replaced by overriding the
> save()method. but what about
> auto_now_add?
>
> how to distinguish between creation and update in save()???
>

You can tell whether or not it's a new object by checking to see if it
has an id. New objects don't get an id until they've been saved to the
database, so if it has one, you can tell it's an update.

def save(self):
if self.id:
# it's an update...
self.modified = datetime.datetime.now()
else:
# it's a new object
self.created = datetime.datetime.now()
super(Foo, self).save()

--
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: Newforms admin problem: TemplateSyntaxError at /admin/

2008-07-21 Thread Florencio Cano

Uhm, the solution was to delete the database and recreate it. Now it
runs correctly.

2008/7/21 Florencio Cano <[EMAIL PROTECTED]>:
> Hi,
> After viewing the new documentation for the admin interface and
> modifying, properly I think, the files when I try to access
> http://localhost:8000/admin/ I get a template problem that seems to be
> caused because 'user' is not found in the context of the template. I
> did not changed anything in the template, and the template is an admin
> template. Here is all the 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
-~--~~~~--~~--~--~---



Re: Newforms admin problem: TemplateSyntaxError at /admin/

2008-07-21 Thread Karen Tracey
On Mon, Jul 21, 2008 at 10:59 AM, Florencio Cano <[EMAIL PROTECTED]>
wrote:

>
> Uhm, the solution was to delete the database and recreate it. Now it
> runs correctly.
>

Note this sort of thing (delete/recreate database) IS NOT generally
necessary for updating to the newforms admin code, which is now in trunk.
Sorry, I have not had time to look in detail at the problem you were having
but if anyone else hits a similar thing it would be good to figure out what
was actually going on, if possible.  Delete/recreate the database is not
something that should be required to migrate to the new code.

Karen


>
> 2008/7/21 Florencio Cano <[EMAIL PROTECTED]>:
> > Hi,
> > After viewing the new documentation for the admin interface and
> > modifying, properly I think, the files when I try to access
> > http://localhost:8000/admin/ I get a template problem that seems to be
> > caused because 'user' is not found in the context of the template. I
> > did not changed anything in the template, and the template is an admin
> > template. Here is all the 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
-~--~~~~--~~--~--~---



Setting different attributes in a SplitDateTimeWidget

2008-07-21 Thread Torsten Bronger

Hallöchen!

I wanted to have those neat Javascript functions with my
DateTimeField that Django's admin facility offers.  However, the
only way I found to achieve this was:

class MyModelForm(ModelForm):
def __init__(self, data=None, **keyw):
super(MyModelForm, self).__init__(data, **keyw)
split_widget = forms.SplitDateTimeWidget()
split_widget.widgets[0].attrs = {'class': 'vDateField'}
split_widget.widgets[1].attrs = {'class': 'vTimeField'}
self.fields["timestamp"].widget = split_widget
class Meta:
model = models.MyModel

Thus, I inject different attributes into the child widgets of a
SplitDateTimeWidget in oder to activate the Javascript.  Is there a
more straightforwand way for getting different attributes into a
"multi-widget"?

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
   Jabber ID: [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: autodiscover() fails too silently...

2008-07-21 Thread [EMAIL PROTECTED]

Brian and I looked briefly at testing for the modules existence using
the imp module, and that may yet happen, but for know, be aware of
your own code.

On Jul 21, 5:47 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Mon, Jul 21, 2008 at 4:12 PM, Amit Ramon <[EMAIL PROTECTED]> wrote:
> > autodiscover() goes over INSTALLED_APPS and tries to import their admin 
> > modules. When such a module isn't present, ImportError is caught and 
> > consumed. However, if some admin module do exists, but for some reason it 
> > throws an ImportError (e.g., it tries to load a non-existing module), it 
> > will not be loaded and will not be seen in the admin interface, without any 
> > significant notice. To me this seems like an undesired side-effect, perhaps 
> > even a bug.
>
> This is a well-known side effect of anything which needs to import
> something which might not exist: it is nearly impossible to write
> robust code that can correctly differentiate:
>
> 1. An ImportError raised by a non-existent module
> 2. A module which exists but whose initialization raises an ImportError
>
> The solution is to test your code independently and ensure that it
> functions correctly before attempting to use it (e.g., write a unit
> test which attempts to import your admin declarations and fails if an
> exception is raised in the process; if this test passes, you can rest
> easy).
>
> --
> "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: Must Have Python resources

2008-07-21 Thread Russell Keith-Magee

On Tue, Jul 22, 2008 at 2:21 AM, eka <[EMAIL PROTECTED]> wrote:
>
> On Jul 21, 6:11 am, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
>> On 21-Jul-08, at 1:53 PM, Hussein B wrote:
>>
>> > Well, I know this question isn't related to Django but I hope it is ok
>> > to ask.
>> > What are your favourite Python resources?
>>
>> diveintopython - and the django book is outdated, better you get
>
>
>> uby's practical django projects
>
> This is the printed book you are talking about?

Let me help out here. The problem appears to be that there is some
reluctance to talk in complete sentences, with verbs, subjects,
prepositions, punctuation and capitalization.

Let's try to do this the right way:

"The Django Book", written by Jacob and Adrian, is based on Django
0.96. As such, it's a little out of date. Most of the stuff in this
book is still relevant, but there are a few areas (such as the
discussions about the admin interface) where it is out of date.

James Bennett's "Practical Django Projects" was published quite
recently, so it is more up to date. However, due to the rapidly
evolving nature of Django at the moment, there will be some minor
discrepancies between the book and v1.0.

"Dive Into Python" is a good general Python reference. It is available
for free online, as well as a 'dead tree' version. It is a little bit
old, but Python as a language hasn't changed that much since it was
published - there isn't anything in this book that has been deprecated
or is likely to confuse.

See - that wasn't hard. It takes one message, and it's unambiguous. As
a side benefit, the single message works standalone in the archive.
Centuries from now, archaeologists will be able to determine what the
hell was going on by reading a single message.

Please, people - when a thread is turning into dozens of one line
replies which reduce to "that isn't what I meant", please consider
that maybe TXT SPK might not be the right way to communicate
effectively with other professionals. :-)

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: Error: cannot import name ugettext_lazy

2008-07-21 Thread Fernando Rodríguez

El lun, 21-07-2008 a las 12:10 -0500, James Bennett escribió:

> You will not be able to follow along with the book using the Django
> 0.96 release (as stated in the opening chapters). You will need to
> instal a dev version from SVN.
> 

Thanks, I just got version 0.97 from svn.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 SQL issues

2008-07-21 Thread Karantir

I've just find out, that explicit transaction.commit() in my view
eliminates the problem. But i want django to commit pending
transactions automatically.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



global / site-wide variables?

2008-07-21 Thread Andy Lei

I'm writing a website for a newspaper; each day, the website will have
a different current issue, and the site will display articles based on
the current issue.  What I was wondering was the best way to go about
storing the current issue.  I was thinking a global / site-wide
variable, but I couldn't find anything in the documentation about how
to do this.  Does anyone know if this is possible, and if not, suggest
a different way to implement the current issue?  I'd prefer not to
have to make database requests every time I want to know the current
issue, since this will only change once per day.

-Andy

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



Re: Getting an IndexError when using distinct() and order_by()

2008-07-21 Thread Malcolm Tredinnick


On Mon, 2008-07-21 at 15:41 -0700, bhunter wrote:
> Ahh, never mind.  Looks like it IS a bug, but a very new one:
> 
> http://code.djangoproject.com/ticket/7791

I haven't had a chance to look at that bug yet, except to reproduce it
(and to remove Ivan from my Christmas card list for this year). So,
unfortunately, it'll still be broken in the 1.0-alpha release that
should be tagged today. Later this week I'll have some time to sit down
and nail the half dozen or so open SQL bugs that are floating around, so
these things should be fixed by the beta release.

Regards,
Malcolm



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



separate datetime into two fields a la admin area?

2008-07-21 Thread hotani

Since loading the most recent updates from svn, the one piece that is
broken for me is where I had a datetime field split into two on a form
using generic update.

I had basically copied the method from the old admin area which used
oldforms. For a datetime field called "date," the date field would be
"date_date" and the time would be "date_time." Since the conversion,
however, this no longer works. I noticed a new method in the admin
area but have yet to find the guts of it, or determine if it will even
work with newforms generic views.

What is the best way to set this up?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 permission problem in newforms-admin

2008-07-21 Thread Malcolm Tredinnick


On Mon, 2008-07-21 at 15:46 -0700, Brandon Taylor wrote:
> Hi everyone,
> 
> I'm trying to enforce a customer permission on Add/Update. In my
> model, I have defined the permission:
> 
> permissions = (
>('can_approve_stories','Can Approve Stories'),
> )
> 
> 
> 
> in my model.ModelAdmin I have:
> 
> def change_view(self, request, obj_id):
> if request.user.has_perm('can_approve_stories'):
> return super(StoryAdmin, self).change_view(request,
> obj_id)
> else:
> raise PermissionDenied
> 
> def add_view(self, request, obj_id):
> if request.user.has_perm('can_approve_stories'):
> return super(StoryAdmin, self).add_view(request, obj_id)
> else:
> raise PermissionDenied
> 
> 
> The change_view permission is working. The add_view thrown an error:
> 
> TypeError at /admin/stories/story/add/
> add_view() takes exactly 3 arguments (2 given)
> 
> Can someone please show me what I'm doing wrong?

At a guess: if you're adding an object, passing in the object_id doesn't
make a lot of sense (the object doesn't exist yet).

Regards,
Malcolm



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



Re: Getting an IndexError when using distinct() and order_by()

2008-07-21 Thread bhunter

Ahh, never mind.  Looks like it IS a bug, but a very new one:

http://code.djangoproject.com/ticket/7791



On Jul 21, 6:27 pm, bhunter <[EMAIL PROTECTED]> wrote:
> I have a perfectly legal query into my database.  When I add
> 'order_by' some field, it gives the results just fine.  But when I add
> distinct() to it, it dies:
>
> >>> res.order_by('blk__name')
>
> [,  ldoyzb>, , ,  hqmnlbt rle atocv>]>>> res.order_by('block__name').distinct()
>
> Traceback (most recent call last):
>   File "", line 1, in ?
>   File "/usr/lib/python2.4/site-packages/django/db/models/query.py",
> line 143, in __repr__
>     return repr(list(self))
>   File "/usr/lib/python2.4/site-packages/django/db/models/query.py",
> line 155, in __len__
>     self._result_cache.extend(list(self._iter))
>   File "/usr/lib/python2.4/site-packages/django/db/models/query.py",
> line 273, in iterator
>     obj = self.model(*row[index_start:])
>   File "/usr/lib/python2.4/site-packages/django/db/models/base.py",
> line 181, in __init__
>     raise IndexError("Number of args exceeds number of fields")
> IndexError: Number of args exceeds number of fields
>
> Is this a known bug?  Or am I doing something wrong?  Note that I am
> tracking the development version.
>
> Strangely, if I order_by a different field (one that is not a
> ForeignKey), then the problem goes away.
>
> Thanks,
> Brian
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django Tutorial for NFA has bugs

2008-07-21 Thread John M

Ticket 7861 created for this.

John

On Jul 20, 1:25 pm, "Chris H." <[EMAIL PROTECTED]> wrote:
> On Jul 20, 3:21 pm, John M <[EMAIL PROTECTED]> wrote:
>
> > Given that the group has figured out that you need to run
> > autodiscover() and register any models you want to show in NFA Admin
> > page, I wanted to point out that the tutorial has the same bug,
> > somewhere in Tutorial 2, it tells you to un-comment the # for admin
> > access, which DOES NOT show anything in Admin.  The correction would
> > be to add the autodiscover() call.
>
> Errors, or perceived errors, in documentation should be logged as
> tickets on the trac site.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



ordering a queryset by _CHOICES

2008-07-21 Thread gkelly

Is there a better way to do this? In a model, perhaps with some new
magic from qs-rf?

http://www.djangosnippets.org/snippets/902/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Getting an IndexError when using distinct() and order_by()

2008-07-21 Thread bhunter

I have a perfectly legal query into my database.  When I add
'order_by' some field, it gives the results just fine.  But when I add
distinct() to it, it dies:

>>> res.order_by('blk__name')
[, , , , ]
>>> res.order_by('block__name').distinct()
Traceback (most recent call last):
  File "", line 1, in ?
  File "/usr/lib/python2.4/site-packages/django/db/models/query.py",
line 143, in __repr__
return repr(list(self))
  File "/usr/lib/python2.4/site-packages/django/db/models/query.py",
line 155, in __len__
self._result_cache.extend(list(self._iter))
  File "/usr/lib/python2.4/site-packages/django/db/models/query.py",
line 273, in iterator
obj = self.model(*row[index_start:])
  File "/usr/lib/python2.4/site-packages/django/db/models/base.py",
line 181, in __init__
raise IndexError("Number of args exceeds number of fields")
IndexError: Number of args exceeds number of fields

Is this a known bug?  Or am I doing something wrong?  Note that I am
tracking the development version.

Strangely, if I order_by a different field (one that is not a
ForeignKey), then the problem goes away.

Thanks,
Brian


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



Re: Is the same request.method == "POST" and request.POST?

2008-07-21 Thread [EMAIL PROTECTED]

Correct, but it will also be empty if the user doesn't fill out any of
the fields in the form(or whatever), and in that case you'd want to
return the page with the appropriate errors.

On Jul 21, 6:10 pm, "Juanjo Conti" <[EMAIL PROTECTED]> wrote:
> 2008/7/21 [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
>
>
>
> > The correct way to test is to do request.method == "POST", not test
> > request.POST, because that could be empty even on a post request.
>
> OK. But it will not have content if the view is reached via GET, right?
>
> --
> Juanjo Conti
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Is the same request.method == "POST" and request.POST?

2008-07-21 Thread Juanjo Conti

2008/7/21 [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
>
> The correct way to test is to do request.method == "POST", not test
> request.POST, because that could be empty even on a post request.
>

OK. But it will not have content if the view is reached via GET, right?

-- 
Juanjo Conti

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



Re: Is the same request.method == "POST" and request.POST?

2008-07-21 Thread [EMAIL PROTECTED]

The correct way to test is to do request.method == "POST", not test
request.POST, because that could be empty even on a post request.

On Jul 21, 5:53 pm, "Juanjo Conti" <[EMAIL PROTECTED]> wrote:
> I have used both ways in my views, now I am wondering know if one is
> wrong and why.
>
> Thanks in advance,
> --
> Juanjo Conti
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: propagation of modification in children to parents

2008-07-21 Thread Andre Meyer
hi Daniel

cool, thanks

in combination, now it looks like this:


class MyModel(models.Model):
created = models.DateTimeField()
modified = models.DateTimeField()
parent = models.ForeignKey('self', related_name='children', null=True,
blank=True)

def save(self, **kwargs):
now = datetime.now()
self.modified = now
if not self.id:
self.created = now
if self.parent:
self.parent.save(**kwargs)
super(MyModel, self).save(**kwargs)

cheers
André


On Mon, Jul 21, 2008 at 10:47 PM, Daniel Roseman <
[EMAIL PROTECTED]> wrote:

>
> On Jul 21, 7:52 pm, "Andre Meyer" <[EMAIL PROTECTED]> wrote:
> > hi again
> >
> > so, auto_now is deprecated and can be replaced by overriding the
> > save()method. but what about
> > auto_now_add?
> >
> > how to distinguish between creation and update in save()???
> >
>
> You can tell whether or not it's a new object by checking to see if it
> has an id. New objects don't get an id until they've been saved to the
> database, so if it has one, you can tell it's an update.
>
> def save(self):
>if self.id:
># it's an update...
>self.modified = datetime.datetime.now()
>else:
># it's a new object
>self.created = datetime.datetime.now()
>super(Foo, self).save()
>
> --
> 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: Making a Form from a model using ModelForms, but dont want to include the ForeignKey variable in the form

2008-07-21 Thread James Bennett

On Mon, Jul 21, 2008 at 4:09 PM, Django_newbie <[EMAIL PROTECTED]> wrote:
> This save() fails because the form.is_valid() is not true, and the
> Blog(foreignkey) field is missing from the post data, how can i make
> this save without letting user choose this blog field? Or is it
> necessary that the foreignkey field has to be alwayz chosen from a
> form?

The documentation for ModelForm covers both:

1. Excluding fields from a ModelForm (thus doing away with attempts to
validate those fields), and
2. Getting a "partial" object back from a ModelForm which you can
modify before actually saving to your database.

Details are available here:

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


-- 
"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: autodiscover() fails too silently...

2008-07-21 Thread James Bennett

On Mon, Jul 21, 2008 at 4:12 PM, Amit Ramon <[EMAIL PROTECTED]> wrote:
> autodiscover() goes over INSTALLED_APPS and tries to import their admin 
> modules. When such a module isn't present, ImportError is caught and 
> consumed. However, if some admin module do exists, but for some reason it 
> throws an ImportError (e.g., it tries to load a non-existing module), it will 
> not be loaded and will not be seen in the admin interface, without any 
> significant notice. To me this seems like an undesired side-effect, perhaps 
> even a bug.

This is a well-known side effect of anything which needs to import
something which might not exist: it is nearly impossible to write
robust code that can correctly differentiate:

1. An ImportError raised by a non-existent module
2. A module which exists but whose initialization raises an ImportError

The solution is to test your code independently and ensure that it
functions correctly before attempting to use it (e.g., write a unit
test which attempts to import your admin declarations and fails if an
exception is raised in the process; if this test passes, you can rest
easy).



-- 
"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: How to inline somethin to a FlatPage

2008-07-21 Thread eka

The problem is

class FlatPageAdmin(admin.ModelAdmin):
inline = [
SearchKeywordInline,
]

its inlines instead of inline...

but still i have to unregister and the register flatpages and that
breaks some other things


any better solution?


On Jul 21, 5:53 pm, eka <[EMAIL PROTECTED]> wrote:
> Doesn't seem to work
>
> On Jul 21, 4:56 pm, slav0nic <[EMAIL PROTECTED]> wrote:
>
> > try admin.site.unregister(FlatPage) befor register 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Get ModelAdmin for specific Model

2008-07-21 Thread Alaa Salman

Hi all,

Is there another way to get the ModelAdmin registered for a specific
Model than to access the _registry of the AdminSite instance.

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



autodiscover() fails too silently...

2008-07-21 Thread Amit Ramon

Hi,

autodiscover() goes over INSTALLED_APPS and tries to import their admin 
modules. When such a module isn't present, ImportError is caught and consumed. 
However, if some admin module do exists, but for some reason it throws an 
ImportError (e.g., it tries to load a non-existing module), it will not be 
loaded and will not be seen in the admin interface, without any significant 
notice. To me this seems like an undesired side-effect, perhaps even a bug.

Any ideas?

--- Amit


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Can't Send Password With Test Client

2008-07-21 Thread James

It appears that the password value isn't printed for security reasons.
The problem remains that the form will not validate.

James wrote:
> I've confirmed that while I can send other fields via the Django test
> client, I can't send password fields.
>
> So for instance:
>
> print "password:", form['password']
> print "email:", form['email']
>
>  >>>password:  id="id_password" />
>  >>>email:  value="[EMAIL PROTECTED]" id="id_email" />
>
>
>
> There is no value for the password field, and the form is not being
> validated.
>
> I've also tried the client.login() method, but haven't gotten that to
> work. Shouldn't I be able to login through the same POST request that
> a client would normally make?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Tabular data, limited columns in a template.

2008-07-21 Thread truebosko

Thanks guys, both viable solutions but took up Daniel's :)

Thanks again!

On Jul 21, 3:46 pm, Daniel Roseman <[EMAIL PROTECTED]>
wrote:
> On Jul 21, 8:28 pm, truebosko <[EMAIL PROTECTED]> wrote:
> 
>
> > {% if is_new_row forloop.counter %}
> >  ...
> > {% endif %}
>
> You can't use a tag inside another tag - in this case, the 'if' tag.
> What you can do, though, is use a filter. So you need something like
> this:
>
> @register.filter
> def is_new_row(counter)
> ... etc ...
>
> and in the template:
>
> {% if forloop.counter|is_new_row %}
> ...etc...
> --
> 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: Tabular data, limited columns in a template.

2008-07-21 Thread Alaa Salman

On Jul 21, 10:28 pm, truebosko <[EMAIL PROTECTED]> wrote:
> if counter % 2 == 1: Output new row
>
> With this, every 2 items a new row is made so I have 2 items per row.
> Very simple right?
>
> So I tried making a template tag like so
> @register.simple_tag
> def is_new_row(counter):
>     if counter % 2 == 1:
>         return True
>     else:
>         return False
>
> Then in my template I would do:
>
> {% if is_new_row forloop.counter %}
>  ...
> {% endif %}

I don't think you can do that. Custom template tags are meant to be
used sort-of standalone, if i understand them correctly. So you can't
use the result of a custom tag in another tag(if tag in this case).

What you can do, and this is just one way to do it, is something like:
def Inject_new_row(counter):
 if counter % 2 == 1:
 return ""

Or something like that.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 inline somethin to a FlatPage

2008-07-21 Thread eka

Hi,

Im reading the book 'Practical Django Projects', and trying to make it
work with latest changes in Django SVN
I'm trying to use edit inline (this is very new to me) with FlatPages
and when I do the following

from django.contrib import admin
from cms.search.models import SearchKeyword
from django.contrib.flatpages.models import FlatPage

class SearchKeywordInline(admin.StackedInline):
model = SearchKeyword

class FlatPageAdmin(admin.ModelAdmin):
inline = [
SearchKeywordInline,
]


admin.site.register(FlatPage, FlatPageAdmin)

I get:

The model FlatPage is already registered.

I think that FlatPages have another way to inline edit things?

any help here appreciated...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: i18n project custom locale won't stick

2008-07-21 Thread Malcolm Tredinnick


On Sun, 2008-07-20 at 21:06 -0700, robin wrote:
[...]
> Should I submit a ticket or something?

Rewriting the i18n.txt documentation in a slightly different fashion is
already on a few TODO lists, so don't worry about a ticket.

I will note, however, that the warning is right at the top of the
section somebody creating a translation has to read, so it's going to be
hard to make it more obvious. Reordering is always a possibility, but
different people process information in different ways, so it's
impossible to appeal to everybody. That being said, I'll be the first to
admit that that document is a mixture of many different things and quite
hard to understand. I want to hit it with big sticks before 1.0 comes
out.

Regards,
Malcolm


> 
> Thank you for your prompt response,
> Robin
> 
> On Jul 21, 4:51 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
> wrote:
> > On Sun, 2008-07-20 at 13:02 -0700, robin wrote:
> > > I've spend 3 days on this. Please help.
> >
> > > I've created the following locale to my project below:
> > > /home/robin/myproject/locale/id/LC_MESSAGES/django.po
> > > /home/robin/myproject/locale/id/LC_MESSAGES/django.mo
> >
> > > so I have a custom language which is suppose to be Indonesian
> > > indentified as 'id'
> >
> > Read the "locale restrictions" at the top of this 
> > section:http://www.djangoproject.com/documentation/i18n/#how-to-create-langua...
> >
> > Django does not have an Indonesian translation in core, so it cannot
> > support it in your applications either. One day we'll remove that
> > restriction, maybe even before 1.0.
> >
> > Regards,
> > Malcolm
> > 
> 


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



Re: Model Meta verbose_name setter

2008-07-21 Thread Marty Alchin

On Mon, Jul 21, 2008 at 2:55 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> This is why i need to code a little mechanism to set the verbose_name
> property of Meta subclass of Model.
> I can't get it to work!

All of the options you're suggesting would work just fine if only Meta
ever got instantiated into an object. Alas, it doesn't. Django doesn't
really use it as a means to create an object, but more as a way to
create a separate namespace for all the various options you can set,
without getting in the way of model fields and methods.

Unfortunately, from your examples, I can't really figure out what
problem you're trying to solve, so I don't know what to recommend for
you. All I can say is that none of your attempts will work without
Meta being instantiated, which Django doesn't (and likely won't) do.

-Gul

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: "ColorField"?

2008-07-21 Thread Sean Legassick


On 8 Jul 2008, at 04:24, Leaf wrote:

>
> Does anyone know if there is such thing as a ColorField - something
> that stores a hex value and has a JavaScript-powered color picker
> beside it? If there is, where can I get it? If there isn't, how would
> I go about writing one?


I've uploaded a snippet at http://www.djangosnippets.org/snippets/900/

(note this works with current trunk - i.e. post newforms-admin merge.  
If you need it for the old admin I also have the code knocking about,  
it's fairly similar - let me know and I'll post it here).

Sean


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: ContentType "content_object" as a filter parameter?

2008-07-21 Thread [EMAIL PROTECTED]

Hey guys,

I don't suppose anybody has any ideas on this?

My current thinking is that I'm making the problem too complicated
perhaps and that I need to try another method. Does anyone have any
ideas of how I could achieve the same functionality another way?

For instance, although I'm intermixing A and B into the "clist", I
don't *HAVE* to, I mean I could have a separate list of B models on
another part of the site. For the functionality of the site and from a
user interface perspective, it would be great to intermix them - but
if it's going to be too much hassle then I suppose I could separate
them. It seems like giving up though! :-)

Thanks again,

Mike.

On Jul 21, 10:51 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Hi guys,
>
> I have two models (A and B) that I want to intermix into a QuerySet. I
> know this is not yet possible in Django, so I decided to work around
> the problem using a third model C as a generic "wrapper" that posesses
> a GenericForeignKey to either A or B.
>
> Now, I'd also like to filter records within A and B by various means,
> so I've been attempting something like this within a view:
>
> -
> content_A = ContentType.objects.get_for_model(A)
> content_B = ContentType.objects.get_for_model(B)
>
> clist = C.objects.filter(content_type=content_A)
> clist = clist | C.objects.filter(content_type=content_B)
> -
>
> That all works fine, but as soon as I try and filter the "clist" with
> something like this:
>
> ---
> clist = C.objects.filter(content_type=content_A,
> content_object__property_on_A=some_property)
> ---
>
> It throws an exception:
> "Cannot resolve keyword 'content_object' into field. Choices are:
> content_type, id, object_id, * "
>
> Having hunted around a bit I saw another post on here regarding ticket
> #6805:http://code.djangoproject.com/ticket/6805
>
> Am I to understand that I cannot actually use the content_object field
> as a filter parameter because it is dynamically generated? If so, is
> there a way around this somehow that isn't going to involve a rather
> nasty set of looped hits on the database?
>
> Thanks for reading! If you need me to clarify a little more, then I
> certainly will.
>
> Mike.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Model Meta verbose_name setter

2008-07-21 Thread [EMAIL PROTECTED]

Hello everybody,

I subclassed AdminSite to allow setting several ModelAdmin per Model,
because of a bug of model inheritance of nfa (no flames please).

This is why i need to code a little mechanism to set the verbose_name
property of Meta subclass of Model.
I can't get it to work!

0) Set it in the constructor:
class Meta:
def __init__(self):
verbose_name = 'foo'
Result in the admin: still making verbose_name itself and no change is
visible.

1) Using property() forces to comment lines 87 and 88 of /db/models/
options.py:
class Meta:
def __init__(self):
self.__verbose_name = None
def getverbose_name(self):
 return self.__verbose_name
def setverbose_name(self, value):
self.__verbose_name = value
def delverbose_name(self):
del self.__verbose_name
verbose_name = property(getverbose_name, setverbose_name,
delverbose_name, "I'm the 'verbose_name' property.")
Result in the admin: instead of the return value, it uses: 

2) Using @property:
class Meta(object):
@property
def verbose_name(self):
print 'foo'
return 'bar@'
Result: Same as in 1)

Note that i am a newbie with the python object model (2-3 weeks), so
please be descriptive and make a little code example with your
points :)

Regards, James.

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



Re: Django Deploy

2008-07-21 Thread DoctorMO

Hey Graham,

Well... at the moment it targets mod_python, but there isn't any
reason for such deployment options not to be added so it calculates
the dependencies and configs based on those choices. I was trying to
make sure there was room for postgress, other httpd servers and other
kinds of settings in case people wanted to expand into those areas.

Best Regards, Martin Owens

On Jul 20, 10:30 pm, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> Are you targeting mod_python or mod_wsgi?
>
> On Jul 21, 8:33 am, DoctorMO <[EMAIL PROTECTED]> wrote:
>
> > Hey all,
>
> > In order to deploy multiple django based websites I've created a set
> > of scripts which build the setup.py and debian directory for deb based
> > deployment of django websites. At the moment it handles apache
> > configuration, mysql database creation (with random passwords) and
> > setting up the settings.template file.
>
> > I'm putting it up for others in case your interested in something
> > similar. I haven't intended it as a serious project that everyone will
> > use or anything so you may find there are some assumptions that it
> > makes about the structures of a website project which don't apply.
>
> > Code in a bzr branch here:https://code.launchpad.net/django-deployer
>
> > To install you can either use the setup.py (create an rmp or whatever)
> > or build the deb, you'll need moxml (https://code.launchpad.net/
> > ~doctormo/python-moxml/trunk) which just saves all the settings in
> > xml.
>
> > To use go into your django project directory (the parent to your site
> > directory)
>
> > django-build.py --build-settings
> > *Follow instructions*
> > django-build.py
> > debuild (to make the deb)
>
> > If you want to make an rpm version, you need to run setup.py rpm
> > builder with --post-install=debian/postinst to include the post
> > install script.
>
> > Let me know if anyone finds it useful.
>
> > Best Regards, Martin Owens
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Is Django development active?

2008-07-21 Thread Hernan Olivera

>> Heh, the USA has been stuck on version 50 since 1959 when Hawaii
>> was added to the union.  There are some development branches
>> ("Puerto Rico" and "Virgin Islands" feature-branches are
>> potential release-candidates, if a merge ever becomes official)
>> moving towards version 51.  Clearly the US hasn't had active
>> development for about 49 years. :)

And because the frozen /allTheWorld.Bush branch! :-)

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



Re: propagation of modification in children to parents

2008-07-21 Thread Andre Meyer
hi again

so, auto_now is deprecated and can be replaced by overriding the
save()method. but what about
auto_now_add?

how to distinguish between creation and update in save()???

is 
thisstill
being worked on?


class Foo(models.Model):
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True)


thanks
André


On Mon, Jul 21, 2008 at 8:18 AM, Andre Meyer <[EMAIL PROTECTED]>
wrote:

> hi Julien
>
> that makes perfect sense and looks much better than auto_now. always good
> to avoid deprecated stuff.
>
> thanks a lot
> André
>
>
>
>
> On Mon, Jul 21, 2008 at 6:26 AM, Julien Phalip <[EMAIL PROTECTED]> wrote:
>
>>
>> Hi,
>>
>> The declarative attribute 'auto_now' (as well as 'auto_now_add') is
>> deprecated and its support will eventually be dropped. To achieve that
>> you need to override the 'save' method. In that same method you can
>> also call the parent's 'save' method to propagate the change to the
>> ancestors:
>>
>> ModelA(models.Model):
>>modified = models.DateTimeField()
>> parent = models.ForeignKey('self', related_name='children',
>> null=True,
>> blank=True)
>>
>> def save(def):
>>self.modified = datetime.now()
>>if self.parent:
>>self.parent.save()
>>super(ModelA, self).save()
>>
>> On Jul 20, 6:28 pm, "Andre Meyer" <[EMAIL PROTECTED]> wrote:
>> > hi all
>> >
>> > i have a model with a modifed field
>> >
>> > modified = models.DateTimeField(auto_now=True)
>> >
>> > and a parent field
>> >
>> > parent = models.ForeignKey('self', related_name='children', null=True,
>> > blank=True)
>> >
>> > in order to allow for creating a tree of items.
>> >
>> > what is the best way to propagate a modification in a child to set all
>> its
>> > parents to the same modification time?
>> >
>> > or is it possible to sort a query set that retrieves only the top-most
>> items
>> > (parent=None) on the latest modification time of its children? maybe
>> using a
>> > method that calculates and returns that date on the fly?
>> >
>> > thanks a lot for your help
>> > André
>> >
>> > using trunk 8004, full code is
>> > here
>> > .
>> >>
>>
>

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



Re: ImportError: cannot import name parse_lookup

2008-07-21 Thread Alaa Salman



Fernando Rodríguez wrote:
> Hi,
>
> I'm implementing the coltrane blog app in "Practical Django Projects"
> and when I try to syncdb I get this error and traceback.
>
> I'm using version 0.97 downloaded from svn.
> from tagging.managers import TagManager, TaggedItemManager
>   File "/home/fernando/django/tagging/managers.py", line 6, in 
> from django.db.models.query import QuerySet, parse_lookup
> ImportError: cannot import name parse_lookup

I believe you need to upgrade the tagging app. Get that from its svn.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



ImportError: cannot import name parse_lookup

2008-07-21 Thread Fernando Rodríguez

Hi,

I'm implementing the coltrane blog app in "Practical Django Projects"
and when I try to syncdb I get this error and traceback.

I'm using version 0.97 downloaded from svn.

Any ideas? O:-)

PS Here's the traceback:

Traceback (most recent call last):
  File "./manage", line 11, in 
execute_manager(settings)
  File
"/usr/lib/python2.5/site-packages/django/core/management/__init__.py",
line 301, in execute_manager
utility.execute()
  File
"/usr/lib/python2.5/site-packages/django/core/management/__init__.py",
line 248, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File
"/usr/lib/python2.5/site-packages/django/core/management/base.py", line
77, in run_from_argv
self.execute(*args, **options.__dict__)
  File
"/usr/lib/python2.5/site-packages/django/core/management/base.py", line
91, in execute
output = self.handle(*args, **options)
  File
"/usr/lib/python2.5/site-packages/django/core/management/base.py", line
173, in handle
return self.handle_noargs(**options)
  File
"/usr/lib/python2.5/site-packages/django/core/management/commands/shell.py", 
line 18, in handle_noargs
loaded_models = get_models()
  File "/usr/lib/python2.5/site-packages/django/db/models/loading.py",
line 136, in get_models
self._populate()
  File "/usr/lib/python2.5/site-packages/django/db/models/loading.py",
line 57, in _populate
self.load_app(app_name, True)
  File "/usr/lib/python2.5/site-packages/django/db/models/loading.py",
line 72, in load_app
mod = __import__(app_name, {}, {}, ['models'])
  File "/home/fernando/django/elis/models.py", line 6, in 
from tagging.fields import TagField
  File "/home/fernando/django/tagging/fields.py", line 10, in 
from tagging.models import Tag
  File "/home/fernando/django/tagging/models.py", line 9, in 
from tagging.managers import TagManager, TaggedItemManager
  File "/home/fernando/django/tagging/managers.py", line 6, in 
from django.db.models.query import QuerySet, parse_lookup
ImportError: cannot import name parse_lookup






--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Must Have Python resources

2008-07-21 Thread eka



On Jul 21, 6:11 am, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
> On 21-Jul-08, at 1:53 PM, Hussein B wrote:
>
> > Well, I know this question isn't related to Django but I hope it is ok
> > to ask.
> > What are your favourite Python resources?
>
> diveintopython - and the django book is outdated, better you get  


> uby's practical django projects

This is the printed book you are talking about?

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



Re: django-admin.py not recognized in Windows Vista despite adding it to the PATH

2008-07-21 Thread Karen Tracey
On Mon, Jul 21, 2008 at 2:13 PM, Tye <[EMAIL PROTECTED]> wrote:

>
> I've had this issue as well.
>
> Just restart.
>

Or, exit and re-open all your command prompts.  Changing the PATH setting in
the System settings doesn't update the path for existing command prompts.
At least not on 2K/XP, I don't have any Vista boxes.

Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: status of unicode support in 0.96?

2008-07-21 Thread Jeff Anderson

Andrew D. Ball wrote:

Greetings.

I haven't found any good documentation yet on how Django
supports Unicode in version 0.96.  The following webpage
has links for version 0.96 and 0.95, but those links don't
work. :-/ :
  
The header at the top is a generic header that gets added blindly to all 
documentation, hence the broken links.

Does anyone have some more information on using Unicode with
Django 0.96?
  
Unfortunately, unicode support was added post-0.96. If you need it, 
you'll need the development version.


Fortunately, the svn version is very stable, has more features, and less 
bugs than 0.96. It is also very near to 1.0 status. It would be silly to 
start with 0.96 and then have to rework all your code for 1.0 in the 
near future.


Cheers!


Jeff Anderson



signature.asc
Description: OpenPGP digital signature


Re: status of unicode support in 0.96?

2008-07-21 Thread John M

Any reason why you wouldn't just use the SVN version, given we're so
close to 1.0?

Also, not sure if they will update .96 anymore other than security
fixes.  It's very behind in features compared to SVN version.

JOhn

On Jul 21, 11:09 am, "Andrew D. Ball" <[EMAIL PROTECTED]> wrote:
> Greetings.
>
> I haven't found any good documentation yet on how Django
> supports Unicode in version 0.96.  The following webpage
> has links for version 0.96 and 0.95, but those links don't
> work. :-/ :
>
> http://www.djangoproject.com/documentation/unicode/
>
> Does anyone have some more information on using Unicode with
> Django 0.96?
>
> Thanks for your help.
>
> Peace,
> Andrew
> --
> ===
> Andrew D. Ball
> [EMAIL PROTECTED]
> Software Engineer
> American Research Institute, Inc.http://www.americanri.com/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



status of unicode support in 0.96?

2008-07-21 Thread Andrew D. Ball

Greetings.

I haven't found any good documentation yet on how Django
supports Unicode in version 0.96.  The following webpage
has links for version 0.96 and 0.95, but those links don't
work. :-/ :

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

Does anyone have some more information on using Unicode with
Django 0.96?

Thanks for your help.

Peace,
Andrew
-- 
===
Andrew D. Ball
[EMAIL PROTECTED]
Software Engineer
American Research Institute, Inc.
http://www.americanri.com/

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



Error: cannot import name ugettext_lazy

2008-07-21 Thread Fernando Rodríguez

Hi, 

I'm implementing the coltrane blog app in "Practical Django Projects"
and when I try to syncdb I get this odd error:

Error: Couldn't install apps, because there were errors in one or more
models:
coltrane: cannot import name ugettext_lazy

Anybody knows what this might mean?


Thanks in advance,
Fernando

PS: 
These are my installed apps:

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.flatpages',
'cms.search',
'coltrane',
)

And this is my model:


import datetime

from django.db import models
from django.contrib.auth.models import User
from tagging.fields import TagField
from markdown import markdown

import datetime


class Category(models.Model):
"""
Categories that will be  assigned to entries
"""
title = models.CharField(maxlength=250, help_text = "Maximum 250
chars")
slug = models.SlugField(prepopulate_from=['title'], 
unique=True,
help_text = "Suggested value automagically
generated from title. Must be unique")
description = models.TextField()

class Meta:
verbose_name_plural = "Categories"
ordering = ['title']

class Admin:
pass

def __unicode__(self):
return self.title

def __str__(self):
"""
Admin uses this one to name the instance
"""
return self.title

def get_absolute_url(self):
"""
All django models that will be used in a public facing view must
implemente this method.
"""
return "/categories/%s/" % (self.slug)


class Entry(models.Model):
"""
Article
"""
LIVE_STATUS = 1
DRAFT_STATUS = 2
HIDDEN_STATUS = 3

STATUS_CHOICES = ((LIVE_STATUS, 'Live'),
  (DRAFT_STATUS, 'Draft'),
  (HIDDEN_STATUS, 'Hidden'),)

title = models.CharField(maxlength=250)
slug = models.SlugField(prepopulate_from=['title'],
unique_for_date='pub_date')
excerpt = models.CharField(blank=True)
body = models.TextField()
pub_date = models.DateField(default = datetime.datetime.now)
author = models.ForeignKey(User)
enable_comments = models.BooleanField(default=True)
featured = models.BooleanField(default = False)
status = models.IntegerField(choices = STATUS_CHOICES, default =
Entry.LIVE_STATUS)
categories = models.ManyToManyField(Category)
tags = TagField()

# html rendered fields
# editable=False means it shouldn't be editable in the admin view
excerpt_html = models.TextField(editable=False, blank=True)
body_html = models.TextField(editable=False, blank=True)

class Meta:
verbose_name_plural = "Entries"
ordering = ['-pub_date']

class Admin:
pass

def __unicode__(self):
return "%s - (%s)" % (self.title, self.pub_date.strftime("%Y/%
b/%d").lower())

def __str__(self):
return self.__unicode__()

def get_absolute_url(self):
"""
All django models that will be used in a public facing view must
implemente this method.
"""
return "/weblog/%s/%s" % (self.pub_date.strftime("%Y/%b/%
d").lower(), self.slug)

def save(self):
"""
Override Model's save method to save an htmlified version of the
markdown text.
"""
self.body_html = markdown(self.body)
if self.excerpt:
self.excerpt_html = markdown(self.excerpt)

super(Entry, self).save()




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: URL encoding problem

2008-07-21 Thread Karen Tracey
On Mon, Jul 21, 2008 at 12:23 PM, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:

>
> Some news;
> I found an old trunk (0.97-pre-SVN-unknown ... ?!?!) and I downgraded
> the django version..
> Now all works well...
>
> It's a bug of the new versions..?
>
>
Not likely.  It's more likely your code is not properly handing non-ASCII
data.  Things might have worked in a prior version of Django (before Unicode
support was added), but that was largely by chance.  If you want to be able
to update to a Unicode-enabled version of Django then you need to update
your code to properly handle non-ASCII data.  See the checklist here:

http://code.djangoproject.com/wiki/UnicodeBranch#PortingApplicationsTheQuickChecklist

Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Testing with an Oracle DB

2008-07-21 Thread Ian

On Jul 21, 2:39 am, "Gwyn Evans" <[EMAIL PROTECTED]> wrote:
> Just wondered if I'm missing something, or if it's just not been an
> issue to anyone...
>
> Looking at the DB testing docs, it seems that it tries to use a
> 'TEST_', for testing.  This is a bit of a problem with Oracle,
> where a new DB is a rather 'heavyweight' thing and may not be possible
> if using something like Oracle XE.  The equivalent functionality with
> Oracle is handled by changing schemaes (sp?) which would typically be
> done by supplying a different username (& password) within the same
> DB, but there didn't seem to be any way of tweaking the testing
> framework to do this?
>
> /Gwyn

The Oracle backend uses a custom module to create and destroy the test
"database", and it actually just creates a new schema and tablespace,
not a full database (take a look at django/db/backends/oracle/
creation.py for the full details).

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



Re: URL encoding problem

2008-07-21 Thread [EMAIL PROTECTED]

Some news;
I found an old trunk (0.97-pre-SVN-unknown ... ?!?!) and I downgraded
the django version..
Now all works well...

It's a bug of the new versions..?

Thanks
Davide
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Must Have Python resources

2008-07-21 Thread Kenneth Gonsalves


On 21-Jul-08, at 6:32 PM, Amirouche wrote:

> On 21 juil, 14:48, cschand <[EMAIL PROTECTED]> wrote:
>> The django book is based on version 0.96 and it last updated on
>> December 2007.
>>
>> Now people are using latest SVN and Version 1.0 is at our door steps
>
> I know that, I'm wondering about diveintopython

I did not say its outdated

-- 

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



Re: i18n: How to the language on per-user basis

2008-07-21 Thread Jannis Leidel


Am 18.07.2008 um 14:01 schrieb Rishabh Manocha:

> You could use "user profiles" which will allow you to store various  
> user specific preferences.

At the Pinax project for example, we are using a language field in the  
profile model [1] together with a custom middleware [2] to set the  
locale of the website for every logged-in user.

Cheers,
Jannis

1: 
http://code.google.com/p/django-hotclub/source/browse/trunk/projects/pinax/profiles/models.py#18
2: 
http://code.google.com/p/django-hotclub/source/browse/trunk/projects/pinax/profiles/middleware.py

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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-admin.py not recognized in Windows Vista despite adding it to the PATH

2008-07-21 Thread iamelgringo

I've been having that problem, too but with XP.  My system and user
path are both set, but Windows isn't playing nice.

If you can't get it working, you really only need django-admin.py to
get a project up and running.  So, if you must, you can call it
using:

python C:\Python\Lib\site-packages\django\django-admin.py startproject





After that, you're mostly using the manage.py commands.

On Jul 20, 5:14 pm, zippers24 <[EMAIL PROTECTED]> wrote:
> I am completley new to this and am installing it for the first time, I
> am trying to create my first project in a file called djprojects. The
> windows command prompt says that django-admin.py is not recognized
> even though I added its location: C:\Python\Lib\site-packages\django
> \bin to both the user and system PATH. Does anybody have any ideas
> about this? I would appreciate any 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to display UserProfiles in newforms-admin

2008-07-21 Thread [EMAIL PROTECTED]

On Jul 20, 4:22 pm, slav0nic <[EMAIL PROTECTED]> wrote:
> #admin.py
> from django.contrib import admin
> from profile.models import UserProfile
> from django.contrib.auth.models import User
>
> class ProfileInline(admin.StackedInline):
> model = UserProfile
> extra = 1
> max_num = 1
>
> class ProfileAdmin(admin.ModelAdmin):
> inlines = (ProfileInline,)
>
> admin.site.unregister(User)  #!!!
> admin.site.register(User, ProfileAdmin)
>
> ;)

Doing this will wipe out the rest of the admin settings for the User
moel, unfortunate.y It would be better for the ProfileAdmin to
subclass django.contrib.auth.admin.UserAdmin so that all the other
settings are retained.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 display UserProfiles in newforms-admin

2008-07-21 Thread Bernd Donner

In the old version of the admin site the fields of the UserProfile could be 
displayed "inline" on the corresponding User page of the admin site. This was 
done by somthing like:

class UserProfile(models.Model):
  ...
  user = models.ForeignKey(User, unique=True, edit_inline=models.STACKED)

How can the same effect be achieved with newforms-admin?

Thanks for your help,
Bernd Donner

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: does it means we have to user Admin tool?

2008-07-21 Thread Scott Moonen
Hi Eric.  Take a look at Django's generic views (
http://www.djangoproject.com/documentation/generic_views/), especially the
List/Detail generic views and the Create/Update/Delete generic views on that
page.  If these generic views suit your needs then you may be able to get
away with writing only some template code.

  -- Scott

On Mon, Jul 21, 2008 at 5:45 AM, Eric Liu <[EMAIL PROTECTED]> wrote:

> Hi all,
> after I readed the djangobook,I found if I wrote following code and I
> want to get some cool stuff.like auto generate the CRUD logic,I found that I
> have to use the Django Admin tool.I mean if I use Rails Or Grail,it can auto
> generate the code for me (both logic code and page code).but it seems that
> Django didn't provide these feature.I think if I want to some "user_define"
> feature ,and I don't use the Django Admin tool,that means I have to write
> some redundancy,for example every model with same CRUD method.and even if I
> extend the Django Admin template ,and  I want to custom some behavious of
> page logic,it's tough.
>
> Is there some better methods I can use under Django,like Rails or Grails?
>
> Thanks
>
>
>
>
> class Publisher(models.Model):
> name=models.CharField(max_length=30)
> address=models.CharField(max_length=50)
> city=models.CharField(max_length=60)
> state_province=models.CharField(max_length=30)
> country=models.CharField(max_length=50)
> website=models.URLField()
>
> def __str__(self):
> return self.name
> class Meta:
> ordering=['name']
> class Admin:
> pass
>
> >
>


-- 
http://scott.andstuff.org/ | http://truthadorned.org/

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



Re: Multiple languages in Admin

2008-07-21 Thread Dan
On Mon, Jul 21, 2008 at 2:20 AM, Chris Ovenden <[EMAIL PROTECTED]>
wrote:

>
> Hi All!
>
> My first post here, though I've been using Django for about 6 months.
>
> I am building a site that will appear in three different languages
> (maybe more, later), which means that every text field has to have
> three text fields with the text for each language. After toying with
> various inelegant solutions I have settled on have a model like this:
>
> class TextItem(models.Model):
>en_gb = models.TextField('UK English', blank=True)
>en_us = models.TextField('US English', blank=True)
>fr = models.TextField('French', blank=True)
>
>
You might want to look at this:

http://code.google.com/p/django-multilingual/

Good luck

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 validation

2008-07-21 Thread Alex Rades

The point is that i see this validation as tied to the model, not to a
specific form. For me this as an integrity check, something which
should be done at model level.

On Mon, Jul 21, 2008 at 3:20 PM, Jeff FW <[EMAIL PROTECTED]> wrote:
>
> Sounds like you're looking at the oldforms documentation--that's all
> been deprecated.  Read this instead:
> http://www.djangoproject.com/documentation/newforms/
>
> Especially this part:
> http://www.djangoproject.com/documentation/newforms/#custom-form-and-field-validation
>
> -Jeff
>
> On Jul 21, 8:14 am, "Alex Rades" <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> First of all, I'm using trunk :)
>>
>> I have a couple of models like:
>>
>> class User(model.Model):
>> group = models.ForeignKey(Group)
>>
>> Class Group(model.Model):
>> interest = models.ForeignKey(Interests)
>>
>> Basically i want to be possible to change in the admin the interest of
>> a Group *only if*:
>>
>> self.user_set.count() == 0
>>
>> The documentation is not very about custom validation, it says to pass
>> validator_list to the field definition, so i've tried with:
>>
>> interest = models.ForeignKey(interests, validator_list = [ myvalidator ])
>>
>> But it seems the custom validators are not called at all. Is this
>> possible? How do I perform custom validation on a specific form? Doing
>> it into the save() method of the model is not suitable (I want to
>> raise an error which is specific to a field and is displayed next to
>> the field itself)
>>
>> 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: ViewDoesNotExist 'index' attribute in contrib.admin.views.main

2008-07-21 Thread V

I think the easyest way to see the difference is if you do a new
django-admin startproject, and check the comments in urls.py

then you can go on and have a look at the admin.site.root as well,
that is put in urls.py by default, but if you just want a basic admin
site, then probably you won't need it

at least, this is what I did, and now I understand pretty well what
has happened :)

V

On Jul 21, 12:32 pm, "Florencio Cano" <[EMAIL PROTECTED]>
wrote:
> The problem is that in the last versions in the repository of Django
> the Admin interface has changed. More info 
> in:http://www.djangoproject.com/documentation/admin/
> I have read the documentation but now I have another error. Now the
> error is with the template index of the admin interface:
>
> TemplateSyntaxError at /admin/
> Caught an exception while rendering: u'user' Original Traceback (most
> recent call last): File
> "/usr/lib/python2.4/site-packages/django/template/debug.py", line 71,
> in render_node result = node.render(context) File
> "/usr/lib/python2.4/site-packages/django/contrib/admin/templatetags/log.py",
> line 18, in render self.user = context[self.user].id File
> "/usr/lib/python2.4/site-packages/django/template/context.py", line
> 43, in __getitem__ raise KeyError(key) KeyError: u'user'
>
> After reading the document the most importante change I see is
> extracting the Admin class from the models and creating another class
> called MyModelAdmin that extends admin.ModelAdmin and modifying the
> urls.py to include:
>
> urlpatterns = patterns('',
>     ('^admin/(.*)', admin.site.root),
>     [...]
>
> Any ideas to solve this problem in the new Admin interface version?
>
> 2008/7/21 Florencio Cano <[EMAIL PROTECTED]>:
>
> > Hi!
> > I have updated Django from svn, installed a new app and some new
> > models and now when I try to browse /admin/ I get this error:
>
> > ViewDoesNotExist: Tried index in module
> > django.contrib.admin.views.main. Error was: 'module' object has no
> > attribute 'index'
>
> > I have checked that my user is the owner of all the files in
> > django.contrib.admin.views and I have checked that there not exist any
> > method in django.contrib.admin.views.main called index.
>
> > What is this attribute used for and how I can fix this error?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 validation

2008-07-21 Thread Jeff FW

Sounds like you're looking at the oldforms documentation--that's all
been deprecated.  Read this instead:
http://www.djangoproject.com/documentation/newforms/

Especially this part:
http://www.djangoproject.com/documentation/newforms/#custom-form-and-field-validation

-Jeff

On Jul 21, 8:14 am, "Alex Rades" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> First of all, I'm using trunk :)
>
> I have a couple of models like:
>
> class User(model.Model):
>     group = models.ForeignKey(Group)
>
> Class Group(model.Model):
>     interest = models.ForeignKey(Interests)
>
> Basically i want to be possible to change in the admin the interest of
> a Group *only if*:
>
> self.user_set.count() == 0
>
> The documentation is not very about custom validation, it says to pass
> validator_list to the field definition, so i've tried with:
>
> interest = models.ForeignKey(interests, validator_list = [ myvalidator ])
>
> But it seems the custom validators are not called at all. Is this
> possible? How do I perform custom validation on a specific form? Doing
> it into the save() method of the model is not suitable (I want to
> raise an error which is specific to a field and is displayed next to
> the field itself)
>
> 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: ViewDoesNotExist 'index' attribute in contrib.admin.views.main

2008-07-21 Thread Florencio Cano

Yes. I already have done that:

from django.conf.urls.defaults import *
from django.contrib import admin

import os

admin.autodiscover()

urlpatterns = patterns('',
# Example:
# (r'^seinhe/', include('seinhe.foo.urls')),

# Uncomment this for admin:
('^admin/(.*)', admin.site.root),


2008/7/21 cschand <[EMAIL PROTECTED]>:
>
> Did you add
> admin.autodiscover()
> in urls.py? I think the problem due to this
> read
> http://www.djangoproject.com/documentation/admin/#hooking-adminsite-instances-into-your-urlconf
>
> Satheesh
>
> Florencio Cano wrote:
>> The problem is that in the last versions in the repository of Django
>> the Admin interface has changed. More info in:
>> http://www.djangoproject.com/documentation/admin/
>> I have read the documentation but now I have another error. Now the
>> error is with the template index of the admin interface:
>>
>> TemplateSyntaxError at /admin/
>> Caught an exception while rendering: u'user' Original Traceback (most
>> recent call last): File
>> "/usr/lib/python2.4/site-packages/django/template/debug.py", line 71,
>> in render_node result = node.render(context) File
>> "/usr/lib/python2.4/site-packages/django/contrib/admin/templatetags/log.py",
>> line 18, in render self.user = context[self.user].id File
>> "/usr/lib/python2.4/site-packages/django/template/context.py", line
>> 43, in __getitem__ raise KeyError(key) KeyError: u'user'
>>
>> After reading the document the most importante change I see is
>> extracting the Admin class from the models and creating another class
>> called MyModelAdmin that extends admin.ModelAdmin and modifying the
>> urls.py to include:
>>
>> urlpatterns = patterns('',
>> ('^admin/(.*)', admin.site.root),
>> [...]
>>
>> Any ideas to solve this problem in the new Admin interface version?
>>
>> 2008/7/21 Florencio Cano <[EMAIL PROTECTED]>:
>> > Hi!
>> > I have updated Django from svn, installed a new app and some new
>> > models and now when I try to browse /admin/ I get this error:
>> >
>> > ViewDoesNotExist: Tried index in module
>> > django.contrib.admin.views.main. Error was: 'module' object has no
>> > attribute 'index'
>> >
>> > I have checked that my user is the owner of all the files in
>> > django.contrib.admin.views and I have checked that there not exist any
>> > method in django.contrib.admin.views.main called index.
>> >
>> > What is this attribute used for and how I can fix this error?
>> >
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: does it means we have to user Admin tool?

2008-07-21 Thread Eric Liu
Hi Scott,

Thank you reply,I'll read it

all the best

Eric

2008/7/21 Scott Moonen <[EMAIL PROTECTED]>:

> Hi Eric.  Take a look at Django's generic views (
> http://www.djangoproject.com/documentation/generic_views/), especially the
> List/Detail generic views and the Create/Update/Delete generic views on that
> page.  If these generic views suit your needs then you may be able to get
> away with writing only some template code.
>
>   -- Scott
>
>
> On Mon, Jul 21, 2008 at 5:45 AM, Eric Liu <[EMAIL PROTECTED]> wrote:
>
>> Hi all,
>> after I readed the djangobook,I found if I wrote following code and I
>> want to get some cool stuff.like auto generate the CRUD logic,I found that I
>> have to use the Django Admin tool.I mean if I use Rails Or Grail,it can auto
>> generate the code for me (both logic code and page code).but it seems that
>> Django didn't provide these feature.I think if I want to some "user_define"
>> feature ,and I don't use the Django Admin tool,that means I have to write
>> some redundancy,for example every model with same CRUD method.and even if I
>> extend the Django Admin template ,and  I want to custom some behavious of
>> page logic,it's tough.
>>
>> Is there some better methods I can use under Django,like Rails or Grails?
>>
>> Thanks
>>
>>
>>
>>
>> class Publisher(models.Model):
>> name=models.CharField(max_length=30)
>> address=models.CharField(max_length=50)
>> city=models.CharField(max_length=60)
>> state_province=models.CharField(max_length=30)
>> country=models.CharField(max_length=50)
>> website=models.URLField()
>>
>> def __str__(self):
>> return self.name
>> class Meta:
>> ordering=['name']
>> class Admin:
>> pass
>>
>>
>>
>
>
> --
> http://scott.andstuff.org/ | http://truthadorned.org/
>
> >
>

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



Re: Must Have Python resources

2008-07-21 Thread Amirouche



On 21 juil, 14:48, cschand <[EMAIL PROTECTED]> wrote:
> The django book is based on version 0.96 and it last updated on
> December 2007.
>
> Now people are using latest SVN and Version 1.0 is at our door steps

I know that, I'm wondering about diveintopython

> Satheesh
>
> On Jul 21, 5:44 pm, Amirouche <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > On 21 juil, 11:11, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
>
> > > On 21-Jul-08, at 1:53 PM, Hussein B wrote:
>
> > > > Well, I know this question isn't related to Django but I hope it is ok
> > > > to ask.
> > > > What are your favourite Python resources?
>
> > > diveintopython -
>
> > how is that book outdated ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Must Have Python resources

2008-07-21 Thread cschand

The django book is based on version 0.96 and it last updated on
December 2007.

Now people are using latest SVN and Version 1.0 is at our door steps

Satheesh

On Jul 21, 5:44 pm, Amirouche <[EMAIL PROTECTED]> wrote:
> On 21 juil, 11:11, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
>
> > On 21-Jul-08, at 1:53 PM, Hussein B wrote:
>
> > > Well, I know this question isn't related to Django but I hope it is ok
> > > to ask.
> > > What are your favourite Python resources?
>
> > diveintopython -
>
> how is that book outdated ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using multiple databases

2008-07-21 Thread Amirouche

Have a look a this http://code.djangoproject.com/ticket/4747 &
http://trac.woe-beti.de/

On 21 juil, 03:04, CPF_ <[EMAIL PROTECTED]> wrote:
> Ben Ford wrote:
> > Hi There,
>
> > It has been possible in the past to use multiple databases with
> > django. There was a branch for it and about a year ago it was bought
> > up to date with trunk. However that branch hasn't seen any activity
> > for some time and is effectively dead. There's now a (low key) effort
> > under way to come up with a new API and to take advantage of the
> > recent work in refactoring the database API to again make it possible
> > to use multiple databases in your django project. As it stands at the
> > moment it's at an early stage, and it's really unlikely that anything
> > significant will happen until django 1.0 arrives.
>
> > My advice based on what you've said above would be to use django's ORM
> > for your authentication (and sessions, permissions, groups etc) if
> > it's a good fit for you. That way you'd get all of the great time
> > saving bits of django (like request.user, perms in the template
> > language, authentication cookies etc). In addition to that  maybe
> > you'd like to think about using a different ORM for talking to the
> > other database. There is a project underway on google code to make
> > using SQLAlchemy easier with django - this might be the way to go.
>
> > I'm not sure what others on this mailing list would think about this
> > approach... I'd certainly be interested to hear any thoughts!
>
> > Cheers,
> > Ben
>
> > 2008/7/20 CPF_ <[EMAIL PROTECTED]
> > >:
>
> >     [EMAIL PROTECTED]  wrote:
> >     > Dan wrote:
>
> >     >>     Most ideally we would like to have it so that the application
> >     >> uses DB1
> >     >>     (defined in the settings.py file) as the main database, but
> >     when
> >     >> it's
> >     >>     down to users, uses DB2.user as the users table.
> >     >>     Currently we are thinking of using raw sql, but that would
> >     only be a
> >     >>     last resort preferably. And at that point I'd be more scrambled
> >     >> on how
> >     >>     to use authenticate together with it.
>
> >     >> If you are using MySQL, you can use the federated engine for tables
> >     >> that are only "symlinks" to real tables in another database but
> >     will
> >     >> act as normal tables when doing regular operations on them.
>
> >     >> It might be possible with other databases too, I don't know.
> >     > Hi Dan, thanks for the reply.
> >     > We are indeed using MySQL, and attemipting to symlink (as the mysql
> >     > documentation at
>
> >    http://dev.mysql.com/doc/refman/5.0/en/symbolic-links-to-tables.html)
> >     > didn't work out ("SQL show index from `users` failed : Table
> >     > 'bingo.users' doesn't exist" is what webmin said)
>
> >     > If you're implying some other technique, I have no idea what you are
> >     > talking about - could you please explain, or redirect to a page
> >     > explaining it?
>
> >     > Thanks.
> >     Sorry for kicking this subject, but I'd really like to have an
> >     answer to
> >     that...
>
> >     Thanks in advance.
>
> > --
> > Regards,
> > Ben Ford
> > [EMAIL PROTECTED] 
> > +447792598685
>
> Hi Ben,
> Thanks a lot for the explanation and the insight. I'll be looking up
> some of those ideas you mentioned, and the way you explain it is really
> the way I would like to do it.
> Currently I started development using a standard auth_users but at some
> time, I would like to use the users database already existing...
> There's the other possibility to change the project originally using the
> database. However, regardless, I would still know the way to use
> multiple databases, and if it will be integrated in the 1.0 release, I
> really believe that I will use the 1.0 a lot. Therefore I'll look for
> that feature.
>
> cpf_
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Problems with Template "Extends" - Voodoo, anyone?

2008-07-21 Thread Tye

Quick background: I started a new project ("mpi") and app ("main"),
created a template folder and added its path to settings, and did
everything I needed to do with database work. Also fooled around with
Admin (which worked).

What happened: I created an html file from scratch, plopped it into
the templates dir, hooked it into urls.py, put everything together
myself, and everything turned out being beautiful and smooth. Then I
wanted to take advantage of Django's templating mechanisms, starting
with {% extends "base.html" %} and {% block content %}{% endblock %}.
I've done it before without issues, so I re-built the "from-scratch"
html file into two other files we'll just call "base.html" and
"main.html". I hooked them into a separate url for comparison against
the original html file.

The browser's "view source" code was *identical* between the two
versions. The problem? Although the code is _completely identical_,
somehow there are a few very noticeable differences.

How?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Custom validation

2008-07-21 Thread Alex Rades

Hi,

First of all, I'm using trunk :)

I have a couple of models like:

class User(model.Model):
group = models.ForeignKey(Group)

Class Group(model.Model):
interest = models.ForeignKey(Interests)

Basically i want to be possible to change in the admin the interest of
a Group *only if*:

self.user_set.count() == 0

The documentation is not very about custom validation, it says to pass
validator_list to the field definition, so i've tried with:

interest = models.ForeignKey(interests, validator_list = [ myvalidator ])

But it seems the custom validators are not called at all. Is this
possible? How do I perform custom validation on a specific form? Doing
it into the save() method of the model is not suitable (I want to
raise an error which is specific to a field and is displayed next to
the field itself)

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: Must Have Python resources

2008-07-21 Thread bruno desthuilliers



On 21 juil, 10:23, Hussein B <[EMAIL PROTECTED]> wrote:
> Hey.
> Well, I know this question isn't related to Django but I hope it is ok
> to ask.
> What are your favourite Python resources?

Python's interactive interpreter, the FineManual(tm) and
comp.lang.python.

> I'm a Java developer and currently learning Python.

You might be interested in this then:
http://dirtsimple.org/2004/12/python-is-not-java.html


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: ViewDoesNotExist 'index' attribute in contrib.admin.views.main

2008-07-21 Thread cschand

Did you add
admin.autodiscover()
in urls.py? I think the problem due to this
read
http://www.djangoproject.com/documentation/admin/#hooking-adminsite-instances-into-your-urlconf

Satheesh

Florencio Cano wrote:
> The problem is that in the last versions in the repository of Django
> the Admin interface has changed. More info in:
> http://www.djangoproject.com/documentation/admin/
> I have read the documentation but now I have another error. Now the
> error is with the template index of the admin interface:
>
> TemplateSyntaxError at /admin/
> Caught an exception while rendering: u'user' Original Traceback (most
> recent call last): File
> "/usr/lib/python2.4/site-packages/django/template/debug.py", line 71,
> in render_node result = node.render(context) File
> "/usr/lib/python2.4/site-packages/django/contrib/admin/templatetags/log.py",
> line 18, in render self.user = context[self.user].id File
> "/usr/lib/python2.4/site-packages/django/template/context.py", line
> 43, in __getitem__ raise KeyError(key) KeyError: u'user'
>
> After reading the document the most importante change I see is
> extracting the Admin class from the models and creating another class
> called MyModelAdmin that extends admin.ModelAdmin and modifying the
> urls.py to include:
>
> urlpatterns = patterns('',
> ('^admin/(.*)', admin.site.root),
> [...]
>
> Any ideas to solve this problem in the new Admin interface version?
>
> 2008/7/21 Florencio Cano <[EMAIL PROTECTED]>:
> > Hi!
> > I have updated Django from svn, installed a new app and some new
> > models and now when I try to browse /admin/ I get this error:
> >
> > ViewDoesNotExist: Tried index in module
> > django.contrib.admin.views.main. Error was: 'module' object has no
> > attribute 'index'
> >
> > I have checked that my user is the owner of all the files in
> > django.contrib.admin.views and I have checked that there not exist any
> > method in django.contrib.admin.views.main called index.
> >
> > What is this attribute used for and how I can fix this error?
> >
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: ViewDoesNotExist 'index' attribute in contrib.admin.views.main

2008-07-21 Thread Florencio Cano

The problem is that in the last versions in the repository of Django
the Admin interface has changed. More info in:
http://www.djangoproject.com/documentation/admin/
I have read the documentation but now I have another error. Now the
error is with the template index of the admin interface:

TemplateSyntaxError at /admin/
Caught an exception while rendering: u'user' Original Traceback (most
recent call last): File
"/usr/lib/python2.4/site-packages/django/template/debug.py", line 71,
in render_node result = node.render(context) File
"/usr/lib/python2.4/site-packages/django/contrib/admin/templatetags/log.py",
line 18, in render self.user = context[self.user].id File
"/usr/lib/python2.4/site-packages/django/template/context.py", line
43, in __getitem__ raise KeyError(key) KeyError: u'user'

After reading the document the most importante change I see is
extracting the Admin class from the models and creating another class
called MyModelAdmin that extends admin.ModelAdmin and modifying the
urls.py to include:

urlpatterns = patterns('',
('^admin/(.*)', admin.site.root),
[...]

Any ideas to solve this problem in the new Admin interface version?

2008/7/21 Florencio Cano <[EMAIL PROTECTED]>:
> Hi!
> I have updated Django from svn, installed a new app and some new
> models and now when I try to browse /admin/ I get this error:
>
> ViewDoesNotExist: Tried index in module
> django.contrib.admin.views.main. Error was: 'module' object has no
> attribute 'index'
>
> I have checked that my user is the owner of all the files in
> django.contrib.admin.views and I have checked that there not exist any
> method in django.contrib.admin.views.main called index.
>
> What is this attribute used for and how I can fix this error?
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 Tutorial for NFA has bugs

2008-07-21 Thread John M

This has been fixed in the latest SVN release.

J

On Jul 20, 8:42 pm, John M <[EMAIL PROTECTED]> wrote:
> Ticket 7861 created for this.
>
> John
>
> On Jul 20, 1:25 pm, "Chris H." <[EMAIL PROTECTED]> wrote:
>
> > On Jul 20, 3:21 pm, John M <[EMAIL PROTECTED]> wrote:
>
> > > Given that the group has figured out that you need to run
> > > autodiscover() and register any models you want to show in NFA Admin
> > > page, I wanted to point out that the tutorial has the same bug,
> > > somewhere in Tutorial 2, it tells you to un-comment the # for admin
> > > access, which DOES NOT show anything in Admin.  The correction would
> > > be to add the autodiscover() call.
>
> > Errors, or perceived errors, in documentation should be logged as
> > tickets on the trac site.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



ContentType "content_object" as a filter parameter?

2008-07-21 Thread [EMAIL PROTECTED]

Hi guys,

I have two models (A and B) that I want to intermix into a QuerySet. I
know this is not yet possible in Django, so I decided to work around
the problem using a third model C as a generic "wrapper" that posesses
a GenericForeignKey to either A or B.

Now, I'd also like to filter records within A and B by various means,
so I've been attempting something like this within a view:

-
content_A = ContentType.objects.get_for_model(A)
content_B = ContentType.objects.get_for_model(B)

clist = C.objects.filter(content_type=content_A)
clist = clist | C.objects.filter(content_type=content_B)
-

That all works fine, but as soon as I try and filter the "clist" with
something like this:

---
clist = C.objects.filter(content_type=content_A,
content_object__property_on_A=some_property)
---

It throws an exception:
"Cannot resolve keyword 'content_object' into field. Choices are:
content_type, id, object_id, * "

Having hunted around a bit I saw another post on here regarding ticket
#6805:
http://code.djangoproject.com/ticket/6805

Am I to understand that I cannot actually use the content_object field
as a filter parameter because it is dynamically generated? If so, is
there a way around this somehow that isn't going to involve a rather
nasty set of looped hits on the database?

Thanks for reading! If you need me to clarify a little more, then I
certainly will.

Mike.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



does it means we have to user Admin tool?

2008-07-21 Thread Eric Liu
Hi all,
after I readed the djangobook,I found if I wrote following code and I
want to get some cool stuff.like auto generate the CRUD logic,I found that I
have to use the Django Admin tool.I mean if I use Rails Or Grail,it can auto
generate the code for me (both logic code and page code).but it seems that
Django didn't provide these feature.I think if I want to some "user_define"
feature ,and I don't use the Django Admin tool,that means I have to write
some redundancy,for example every model with same CRUD method.and even if I
extend the Django Admin template ,and  I want to custom some behavious of
page logic,it's tough.

Is there some better methods I can use under Django,like Rails or Grails?

Thanks




class Publisher(models.Model):
name=models.CharField(max_length=30)
address=models.CharField(max_length=50)
city=models.CharField(max_length=60)
state_province=models.CharField(max_length=30)
country=models.CharField(max_length=50)
website=models.URLField()

def __str__(self):
return self.name
class Meta:
ordering=['name']
class Admin:
pass

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Must Have Python resources

2008-07-21 Thread Kenneth Gonsalves


On 21-Jul-08, at 1:53 PM, Hussein B wrote:

> Well, I know this question isn't related to Django but I hope it is ok
> to ask.
> What are your favourite Python resources?

diveintopython - and the django book is outdated, better you get  
uby's practical django projects

-- 

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



ViewDoesNotExist 'index' attribute in contrib.admin.views.main

2008-07-21 Thread Florencio Cano

Hi!
I have updated Django from svn, installed a new app and some new
models and now when I try to browse /admin/ I get this error:

ViewDoesNotExist: Tried index in module
django.contrib.admin.views.main. Error was: 'module' object has no
attribute 'index'

I have checked that my user is the owner of all the files in
django.contrib.admin.views and I have checked that there not exist any
method in django.contrib.admin.views.main called index.

What is this attribute used for and how I can fix this error?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 SQL issues

2008-07-21 Thread Karantir

adding transaction.commit_unless_management() to the end of my move()
function solve the problem.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: superuser has no rights with newforms admin

2008-07-21 Thread Justin Wong

Never mind, newforms-admin works great. :)

I forgot that I had copied a custom version of the old admin templates
and it was parsing that instead.

Cheers!
Justin


On Sun, Jul 20, 2008 at 7:27 PM, Justin Wong <[EMAIL PROTECTED]> wrote:
> Well, I tracked down the admin/index.html page and I see that it
> checks the variable app_list.
>
> Going to django/contrib/admin/sites.py, I put a print statement to
> print out my app_list.  Can anyone spot anything wrong?
>
> [   {   'has_module_perms': True,
>'models': [   {   'admin_url': 'auth/group/',
>  'name':  object at 0x89ad60c>,
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}},
>  {   'admin_url': 'auth/user/',
>  'name':  object at 0x89ad80c>,
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}}],
>'name': 'Auth'},
>{   'has_module_perms': True,
>'models': [   {   'admin_url': 'blog/entry/',
>  'name': u'Entries',
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}}],
>'name': 'Blog'},
>{   'has_module_perms': True,
>'models': [   {   'admin_url': 'database/article/',
>  'name':  object at 0x89adfac>,
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}},
>  {   'admin_url': 'database/artist/',
>  'name':  object at 0x89ada8c>,
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}},
>  {   'admin_url': 'database/dictionary/',
>  'name': u'Dictionary entries',
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}},
>  {   'admin_url': 'database/event/',
>  'name':  object at 0x89ad68c>,
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}},
>  {   'admin_url': 'database/image/',
>  'name':  object at 0x89ada6c>,
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}},
>  {   'admin_url': 'database/poem/',
>  'name':  object at 0x8967e4c>,
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}},
>  {   'admin_url': 'database/signature/',
>  'name':  object at 0x89addec>,
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}},
>  {   'admin_url': 'database/stamp/',
>  'name':  object at 0x89ade0c>,
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}},
>  {   'admin_url': 'database/style/',
>  'name':  object at 0x89ad98c>,
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}},
>  {   'admin_url': 'database/word/',
>  'name':  object at 0x89ad92c>,
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}},
>  {   'admin_url': 'database/work/',
>  'name':  object at 0x893c24c>,
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}},
>  {   'admin_url': 'database/year/',
>  'name':  object at 0x8967f4c>,
>  'perms': {   'add': True,
>   'change': True,
>   'delete': True}}],
>'name': 'Database'},
>{   'has_module_perms': True,
>'models': [   {   'admin_url': 'market/category/',

Custom SQL issues

2008-07-21 Thread Karantir

Hi, guys )

I'm expecting some troubles with performing custom SQL. Could you help
me please?

I'm using nested sets method to store tree in Postgres DB. So i've
wrote decorators for tree model manager to perform generic tree
functions like move, create, delete etc. It's strange, but when i'm
running move() function nothing happens with table data despite of
that (and i can see it) valid sql has executed and i have no error
reports, exceptions or something like this, so i have no idea where i
should search the source of my problem.

Any thoughts?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Testing with an Oracle DB

2008-07-21 Thread Gwyn Evans

Just wondered if I'm missing something, or if it's just not been an
issue to anyone...

Looking at the DB testing docs, it seems that it tries to use a
'TEST_', for testing.  This is a bit of a problem with Oracle,
where a new DB is a rather 'heavyweight' thing and may not be possible
if using something like Oracle XE.  The equivalent functionality with
Oracle is handled by changing schemaes (sp?) which would typically be
done by supplying a different username (& password) within the same
DB, but there didn't seem to be any way of tweaking the testing
framework to do this?

/Gwyn

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Must Have Python resources

2008-07-21 Thread Ben Ford
I would say I learned the most about python in one go when I started reading
through the django source code! Activestate's "python cookbook" is
invaluable, and the online books "Dive into Python" and "Thinking in python"
are great.
Cheers,
Ben

2008/7/21 Hussein B <[EMAIL PROTECTED]>:

>
> Hey.
> Well, I know this question isn't related to Django but I hope it is ok
> to ask.
> What are your favourite Python resources?
> I'm a Java developer and currently learning Python.
> I got "Learning Python, 3rd Edition" and "Beginning Python" and the
> Django book.
> Do you suggest a must have book or reference for a serious Python
> programmer?
> Thanks.
> >
>


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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Must Have Python resources

2008-07-21 Thread Hussein B

Hey.
Well, I know this question isn't related to Django but I hope it is ok
to ask.
What are your favourite Python resources?
I'm a Java developer and currently learning Python.
I got "Learning Python, 3rd Edition" and "Beginning Python" and the
Django book.
Do you suggest a must have book or reference for a serious Python
programmer?
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-admin.py not recognized in Windows Vista despite adding it to the PATH

2008-07-21 Thread arsyed
On Sun, Jul 20, 2008 at 8:14 PM, zippers24 <[EMAIL PROTECTED]>
wrote:

>
> I am completley new to this and am installing it for the first time, I
> am trying to create my first project in a file called djprojects. The
> windows command prompt says that django-admin.py is not recognized
> even though I added its location: C:\Python\Lib\site-packages\django
> \bin to both the user and system PATH. Does anybody have any ideas
> about this? I would appreciate any help.
>
>
I don't have Vista, but the ActivePython installer took care of the file
association and pathext under Windows XP on my setup.  Does the information
at the following URL help?

http://www.python.org/doc/faq/windows/#how-do-i-make-python-scripts-executable

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



django-admin.py not recognized in Windows Vista despite adding it to the PATH

2008-07-21 Thread zippers24

I am completley new to this and am installing it for the first time, I
am trying to create my first project in a file called djprojects. The
windows command prompt says that django-admin.py is not recognized
even though I added its location: C:\Python\Lib\site-packages\django
\bin to both the user and system PATH. Does anybody have any ideas
about this? I would appreciate any 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to display UserProfiles in newforms-admin

2008-07-21 Thread Malcolm Tredinnick


On Sun, 2008-07-20 at 21:35 +0200, Bernd Donner wrote:
> In the old version of the admin site the fields of the UserProfile could be 
> displayed "inline" on the corresponding User page of the admin site. This was 
> done by somthing like:
> 
> class UserProfile(models.Model):
>   ...
>   user = models.ForeignKey(User, unique=True, edit_inline=models.STACKED)
> 
> How can the same effect be achieved with newforms-admin?

Have you searched for the word "inline" in the admin documentation (or
the backwards incompatible changes entry for this change)? That should
lead you to the section about the InlineModelAdmin class.

Regards,
Malcolm



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



Multiple languages in Admin

2008-07-21 Thread Chris Ovenden

Hi All!

My first post here, though I've been using Django for about 6 months.

I am building a site that will appear in three different languages
(maybe more, later), which means that every text field has to have
three text fields with the text for each language. After toying with
various inelegant solutions I have settled on have a model like this:

class TextItem(models.Model):
en_gb = models.TextField('UK English', blank=True)
en_us = models.TextField('US English', blank=True)
fr = models.TextField('French', blank=True)

with a ForeignKey into TextItem with a suitable related_name wherever
I would normally put a TextField. This is fine, but it means the
person inputting the text will get a new window every time they want
to edit some text - not ideal. Every attempt I have made to inline
these fields has failed because the TextItem model has no ForeignKey
into the Model being edited. I thought that changing the relationships
to ManyToMany might work, but no. Any suggestions?

I am using the newforms-admin branch, but I suppose I might as well
switch back to the trunk now it's been merged.

Thanks!

Chris

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



Django Deploy

2008-07-21 Thread DoctorMO

Hey all,

In order to deploy multiple django based websites I've created a set
of scripts which build the setup.py and debian directory for deb based
deployment of django websites. At the moment it handles apache
configuration, mysql database creation (with random passwords) and
setting up the settings.template file.

I'm putting it up for others in case your interested in something
similar. I haven't intended it as a serious project that everyone will
use or anything so you may find there are some assumptions that it
makes about the structures of a website project which don't apply.

Code in a bzr branch here: https://code.launchpad.net/django-deployer

To install you can either use the setup.py (create an rmp or whatever)
or build the deb, you'll need moxml (https://code.launchpad.net/
~doctormo/python-moxml/trunk) which just saves all the settings in
xml.

To use go into your django project directory (the parent to your site
directory)

django-build.py --build-settings
*Follow instructions*
django-build.py
debuild (to make the deb)

If you want to make an rpm version, you need to run setup.py rpm
builder with --post-install=debian/postinst to include the post
install script.

Let me know if anyone finds it useful.

Best Regards, Martin Owens

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: propagation of modification in children to parents

2008-07-21 Thread Andre Meyer
hi Julien

that makes perfect sense and looks much better than auto_now. always good to
avoid deprecated stuff.

thanks a lot
André



On Mon, Jul 21, 2008 at 6:26 AM, Julien Phalip <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> The declarative attribute 'auto_now' (as well as 'auto_now_add') is
> deprecated and its support will eventually be dropped. To achieve that
> you need to override the 'save' method. In that same method you can
> also call the parent's 'save' method to propagate the change to the
> ancestors:
>
> ModelA(models.Model):
>modified = models.DateTimeField()
> parent = models.ForeignKey('self', related_name='children',
> null=True,
> blank=True)
>
> def save(def):
>self.modified = datetime.now()
>if self.parent:
>self.parent.save()
>super(ModelA, self).save()
>
> On Jul 20, 6:28 pm, "Andre Meyer" <[EMAIL PROTECTED]> wrote:
> > hi all
> >
> > i have a model with a modifed field
> >
> > modified = models.DateTimeField(auto_now=True)
> >
> > and a parent field
> >
> > parent = models.ForeignKey('self', related_name='children', null=True,
> > blank=True)
> >
> > in order to allow for creating a tree of items.
> >
> > what is the best way to propagate a modification in a child to set all
> its
> > parents to the same modification time?
> >
> > or is it possible to sort a query set that retrieves only the top-most
> items
> > (parent=None) on the latest modification time of its children? maybe
> using a
> > method that calculates and returns that date on the fly?
> >
> > thanks a lot for your help
> > André
> >
> > using trunk 8004, full code is
> > here
> > .
> >
>

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