Jacob Kaplan-Moss | 1 Aug 2005 02:06
Gravatar

Re: Anonymous Session?


On Jul 31, 2005, at 3:36 PM, Chuck Thier wrote:
> Since there has been no docs on sessions yet, I have been looking
> through the code to figure out how to use anonymous sessions.  The
> only problem is that it looks like it sets the session object in the
> response to None if it is an anonymous user, and I'm not sure what to
> do at that point.  Anyone have any ideas?

This is my #1 task these days (literally; it's ticket #1: http:// 
code.djangoproject.com/ticket/1).  I'll try to have something done in  
the next day or two; stay tuned.

Jacob

N. C. Deepak Ramesh | 1 Aug 2005 08:18
Picon

Re: Help on cookbook


Hi,

> Just give an amount field to the Ingredient:
> 
> class Ingredient(meta.Model):
>     fields = (
>         meta.CharField('name', 'Name', maxlength=64),
>         meta.CharField('description', 'Description', maxlength=128,
> blank=True),
>         meta.FloatField('amount','Amount', max_digits=5,
> decimal_places=2),
>         meta.CharField('unit', 'Unit', maxlength=32,
> choices=('kg','lb','ps','l',))
>     )
> 

This won't work because different recipes will have different amounts.

Radek's suggestion is the way to go. But make sure you re-visit your
Recipe class to remove the ManytoMany attrib pointing to Ingredients.
The problem as you have rightly identified is that the intermediate
table (automatically created by django when a ManytoMany field is
used) provides for only foreign keys and does not provide for
additional data fields. Therefore we have to step in and create the
intermediate table with the extra fields via the RecipeIngridient
class.

Also, once you have become comfortable with this approach you could
add some code such as _get_ingredients (in the Recipe class) and
(Continue reading)

N. C. Deepak Ramesh | 1 Aug 2005 08:28
Picon

Re: Help on cookbook

Hi,

Hadn't read the new docs before answering.

> Also, once you have become comfortable with this approach you could
> add some code such as _get_ingredients (in the Recipe class) and
> _get_recipes (in the Ingredients class) for easy access to the related
> data.
>

Ignore above paragraph and look at http://www.djangoproject.com/documentation/models/m2m_intermediary/

The convenience functions are automatically created for you.

<Removes big foot from mouth>

Deepak

Ksenia Marasanova | 1 Aug 2005 12:07
Picon

DRY strategy for portal site


Hi,

I want to use Django for portal-like project. There will be no real
"public" and "cms" parts -- everybody with an account can log in in
one place, even admin. Sort of site where Plone was made for.

Now i was thinking what would be the most effecient, DRY way to use
Django here. My first though is to use admin site as a site template.
Copy admin templates into new location and try to use it as much as
possible, and where it needs customizing  -- hook in generic views,
and if it is not sufficient -- custom modifiers.

Is it the right way of work? 

Another thing is authentication. Hard to say without tutorial, but
Django authentication seems powerfull enough for a portal. I am not
sure about ownership of records, the only thing that has something to
do with it is auth_admin_log, is it what you use to track down the
owner and to do some workflow stuff? ( i can imagine that on a news
site content provider cannot publish news, only editor can do it --
that's what I need too).

Anyway, if I want to hook in custom authentication, does it make any
sense to use admin for this? I believe this question was asked
already, but what is the proper way to use custom authentication?

Thanks a lot.

--

-- 
Ksenia

Nebojša Đorđević | 1 Aug 2005 19:13
Picon

Re: how about i18n ?


On 29-08-2005, at 20:19, Nebojša Đorđević wrote:

> I'll will have this running on current version until the end of  
> next week.

First version is out. I'm attached patch to http:// 
code.djangoproject.com/ticket/65.

btw. Is this thread is more appropriate for django-devel?
Mamading Ceesay | 2 Aug 2005 13:51
Picon
Gravatar

Re: deployment processes


How about continuous integration using BuildBot to automatically deploy
the latest checked in code onto the testing environment and run tests
using doctest/py.test/Twill/Selenium/PyFIT/whatever?

Regards,
Mamading.

Adrian Holovaty | 1 Aug 2005 20:08
Picon

Re: how about i18n ?

On 8/1/05, Nebojša Đorđević <nesh <at> studioquattro.co.yu> wrote:
> > I'll will have this running on current version until the end of
> > next week.
> 
> First version is out. I'm attached patch to http://
> code.djangoproject.com/ticket/65.
> 
> btw. Is this thread is more appropriate for django-devel?

Yes, let's move this to django-devel...

Adrian
Andre Posumentov | 2 Aug 2005 18:08

Django + Apache2 and mod_python on FreeBSD 5.4


Hi,

I'm posting this in case anyone else is having trouble persuading the  
current FreeBSD 5.4 'port' installations of mod_python / Apache2, and  
Django to play together nicely.

Trivial mod_python examples work fine, but attempts to run Django  
result in Apache crashing with:

   Fatal error 'Spinlock called when not threaded.' ...

This is with everything compiled to use libpthread (the default).

The cure to the problem seems to be to revert everything to use /lib/ 
libc_r.so.

So, create an  /etc/libmap.conf, with:

     libpthread.so.1    libc_r.so.5
     libpthread.so      libc_r.so

My installation:
     apache-2.0.54_2
     mod_python-3.1.4_1

Hope this saves someone wasting a day or so ..

raffaele messuti | 2 Aug 2005 19:17
Picon

edit_inline


using this simple model:

class Label(meta.Model):
        fields = (
                meta.CharField('name', 'name', maxlength=200, core=True),
                meta.URLField('url', 'url', blank=True, core=True),
        )
        #admin = meta.Admin()

        def __repr__(self):
                return self.name

class Artist(meta.Model):
        fields = (
                meta.ForeignKey(Label, edit_inline=True),
                meta.CharField('name', maxlength=200),
                meta.URLField('url', blank=True)
        )
        admin = meta.Admin()
        def __repr__(self):
                return self.name    

http://..../admin/apps/artists/add 
return:

KeyError: 'Field label_id not found'
either with mysql or sqlite3

where is the error?

greets

--
rm

Jacob Kaplan-Moss | 2 Aug 2005 20:01
Gravatar

Re: edit_inline


On Aug 2, 2005, at 12:17 PM, raffaele messuti wrote:
> class Label(meta.Model):
>         fields = (
>                 meta.CharField('name', 'name', maxlength=200,  
> core=True),
>                 meta.URLField('url', 'url', blank=True, core=True),
>         )
>         #admin = meta.Admin()
>
>         def __repr__(self):
>                 return self.name
>
>
> class Artist(meta.Model):
>         fields = (
>                 meta.ForeignKey(Label, edit_inline=True),
>                 meta.CharField('name', maxlength=200),
>                 meta.URLField('url', blank=True)
>         )
>         admin = meta.Admin()
>         def __repr__(self):
>                 return self.name

You've got the admin objects backwards -- if an object is edit_inline  
on another object, it should not have its own admin, and the related- 
to object needs to have an admin.  So, you should do this:

class Label(meta.Model):
         fields = (
                 meta.CharField('name', 'name', maxlength=200,  
core=True),
                 meta.URLField('url', 'url', blank=True, core=True),
         )
         admin = meta.Admin()

class Artist(meta.Model):
         fields = (
                 meta.ForeignKey(Label, edit_inline=True),
                 meta.CharField('name', maxlength=200),
                 meta.URLField('url', blank=True)
         )
         # Note: no admin!

Jacob


Gmane