Well, I found solution.
``CreateWithInlinesView `` works perfectly with ``OneToOneField`` (after
all, 1-to-1 is just a foreign key with constraint), but my main model here
is ``Comment``, not ``Task``. So I should set ``Comment`` as ``model``
field in this view and ``Task`` as ``inline``. It lo
Thank you, that may work, but I feel that I reinventing wheel here.
Actually, there are inline_formset and CreateWithInlinesView (from django
extras) and they do exactly what I want, but they only support ForeignKey,
not OneToOne. Looks like I need to extend them to support OneToOne.
On Wedn
What about and old-school DetailView?
def get_context_data -> Creates the two forms and puts them in the context
def post -> Validates and process the forms
On Tue, Apr 21, 2015 at 7:41 PM, Ilya Kazakevich
wrote:
> Hello,
>
> I have several models with one-to-one relation. For example
>
> cl
Hello,
I have several models with one-to-one relation. For example
class Task(models.Model):
initial_comment = models.OneToOneField('Comment')
# A pack of other fields
class Comment(models.Model)
body = RichTextField()
# A pack of other fields
I want to create "create view" based
4 matches
Mail list logo