- Where Developers Learn, Share, & Build Careers


  1. Why would I create a recursive relationship?
  2. Is it like the above?
     class a class (models.model): eiffel = model.   

    1. When you use the same model structure, If the father and child want to node, you may need to make a recurring relationship. For example, if you have any comments with text, data and user_id:

        class comment (models.model): text = models.TextField () create_date_time = models.DateTimeField () parent_comment = Models.ForeignKey ('self')    
    2. I think yes (you can try testing it), but this is not a good form If you change the name of a class, then you have to change the string value in the brackets. If you use 'self' then you do not do this headache.

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -