Hi,
The idea for a separate model for author with a foreign key back to book is
interesting.  I hadn't thought of that.  Thanks for the ideas about how to
approach this problem.

On Sat, Oct 13, 2018 at 12:10 PM Ryan Nowakowski <[email protected]>
wrote:

> I've done something similar in the past but I use a separate model for
> author that has a foreign key back to book. You can limit the number of
> authors to 3 in the author save method.
>
> Then you can use an inline form for author in the admin. That will give
> you the + functionality you're looking for.
>
> If you want to keep you current book model the same with authors as
> fields, take a look at admin fieldsets.
>
> On October 12, 2018 8:43:26 PM CDT, [email protected] wrote:
>>
>> Hi,
>> I'm still a bit new to django, but making slow progress.
>>
>> I'm wondering how to move forward with a book class as model which has an
>> author field which
>> allows adding additional authors.
>>
>> I have three fields allocated in the SQLite db for up to three different
>> authors.
>>
>> What I'm trying to do is only expose the additional author text entry box
>> for the book class in admin
>> when say for example a plus or other widget is clicked.
>>
>> ex.  Author [          ]  +
>> ...then
>>       Additional Author1 [         ]  +
>> ...and finally
>>       Additional Author2 [         ]
>>
>> So if you click the plus the additional author1 text entry shows up, then
>> click again the last or third
>> author entry shows up, but no more plus we're out of db fields at that
>> point.
>>
>> Not trying to dynamically add fields to the db.  Just expose when needed
>> for up to three authors.
>>
>> Prefer to not use jquery and/or javascript, but stick to pure python
>> django if possible.
>>
>> I've been reading alot about admin but still confused as to best way to
>> proceed.
>>
>> Thank You,
>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/96rMeBTLgOY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/38283332-0AB7-4F6B-93E2-F4BD347CAFD6%40fattuba.com
> <https://groups.google.com/d/msgid/django-users/38283332-0AB7-4F6B-93E2-F4BD347CAFD6%40fattuba.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALWZDaM7V4EXSHTJUtnemJr0LQxeHykyhR4nxmnCVx0N1KUh%2BA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to