PiRSquared17 / django-page-cms

Automatically exported from code.google.com/p/django-page-cms
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Connected models inline #135

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello!

As I say in #134, I write a patch to connect 3rd patry models through 
InlineModelAdmin class.
So, I add 'options' key for PAGE_CONNECTED_MODELS, which may contain these 
options:

PAGE_CONNECTED_MODELS = [{
    'model':'documents.models.Document',
    'form':'documents.models.DocumentForm',
    'options':{
            'extra': 3,
            'max_num': 10,
        },
},]

'form' key works as it worked.

Original issue reported on code.google.com by summer.is.gone on 31 Jul 2009 at 7:51

Attachments:

GoogleCodeExporter commented 9 years ago
That's really cool. Let me have a look as soon as possible!

Original comment by batiste....@gmail.com on 31 Jul 2009 at 8:08

GoogleCodeExporter commented 9 years ago
Wait, I've found a bug here. Form doesn't come multipart, if formset contains 
file 
inputs.

Original comment by summer.is.gone on 31 Jul 2009 at 9:07

GoogleCodeExporter commented 9 years ago
...and fix it!

Original comment by summer.is.gone on 31 Jul 2009 at 9:59

Attachments:

GoogleCodeExporter commented 9 years ago
Removed requirement for 'form' key in PAGE_CONNECTED_MODELS, with automatic 
modelforms it is unnessesary as I think.

Original comment by summer.is.gone on 31 Jul 2009 at 10:42

Attachments:

GoogleCodeExporter commented 9 years ago
I applied your patch easily. Thanks a lot for your work. It's new functionality 
and a
nice code clean up a the same time. Can you provide a little bit of 
documentation for
the new syntax?

Original comment by batiste....@gmail.com on 3 Aug 2009 at 2:29

GoogleCodeExporter commented 9 years ago
I got a strange exception with this feature enabled... For example, I have some 
news 
application, it may be any other application and model. 

At http://localhost:8000/admin/news/newsitem/add/
I got exception like this:
fk_name 'page' is not a ForeignKey to <class 'news.models.NewsItem'>

Django admin tries to find 'page' FK in models of other applications! Give me a 
time 
to fix it

Original comment by summer.is.gone on 3 Aug 2009 at 5:59

GoogleCodeExporter commented 9 years ago
Hmm... Maybe I misunderstand something... 
Anyway, this patch helped for me.

Original comment by summer.is.gone on 3 Aug 2009 at 6:27

Attachments:

GoogleCodeExporter commented 9 years ago
Please apply last patch, it is django bug workaround, PAGE_CONNECTED_MODELS 
crashes 
all project without it!

Original comment by summer.is.gone on 6 Aug 2009 at 8:50

GoogleCodeExporter commented 9 years ago
I am in vacation right now so I can't apply any patches. But I have given you 
the
commiter rights. Please apply the necessary modifications.

Original comment by batiste....@gmail.com on 8 Aug 2009 at 11:15

GoogleCodeExporter commented 9 years ago

Original comment by summer.is.gone on 8 Aug 2009 at 8:14

GoogleCodeExporter commented 9 years ago
I have the same problem (using r623), so:
http://code.djangoproject.com/ticket/11715
Thank you for the fix.

Original comment by alexande...@gmail.com on 13 Aug 2009 at 10:45