VALUE not resetting on Foriegn Key Delete

2019-03-26 Thread Arun S
Hi,

I have a Model Class which has the Below schema:

class Pvt_ip_pools(AtlasAuditModel, AtlasBaseHelper):
"""
Represents a private IP Address used for LB Model.
This inherits all the fields from IPAddress model(database table).
"""
# Each data center has its own IP address range
data_center = models.ForeignKey(DataCenter,
verbose_name="Data Center")
ip = models.GenericIPAddressField(verbose_name="PvtIP",
  blank=False,
  null=False,
  unique=True)
prefix_length = models.PositiveSmallIntegerField(blank=False,
 null=False,
 unique=False)
gateway = models.GenericIPAddressField(blank=False,
   null=False,
   unique=False)
 




*   server_interface = 
models.ForeignKey('ServerInterface', 
related_name='pvt_ip_pools', 
blank=True, 
null=True, 
default=None, 
on_delete=models.SET_NULL)*
ipv6 = models.BooleanField(default=0)

segment_id = models.IntegerField(default=0,
verbose_name="Segment_ID")




*ip_status = 
models.ForeignKey('IPStatus',  
default=None,  
null=True,  on_delete=models.CASCADE)*

class Meta:
verbose_name = "[LB]Private IP Address"
verbose_name_plural = "[LB]Private IP Addresses"


In this, When a ServerInterface is Deleted, which is a foriegn Key, the 
Model here, sets the attribute to NULL.
But, each of these will have a Object "IP_STATUS" which will have a value 
assigned ( FREE, USED ..)
*Now On Delete of the ServerInterface Object, How do i reset the Value of 
"IP_STATUS" to FREE everytime Server_interface object is deleted?*

Another Problem observed is that When The ServerINterface Object is deleted 
from ADMIN page, offcourse, it will not call the default delete.

Even in this case
*, how do i reset the value of IP_STATUS? when Object deleted from ADMIN 
Page.*

Any Help is much appreciated.


*Cheers*

*Arun*

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/147aedbd-7dd2-4cef-bfda-7cd79e9b2e2e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: VALUE not resetting on Foriegn Key Delete

2019-03-26 Thread Adam Johnson
This mailing list is for the development of Django itself, not for support
using Django. Please use the django-users mailing list for that, or IRC
#django on freenode, or a site like Stack Overflow.

On Tue, 26 Mar 2019 at 05:49, Arun S  wrote:

> Hi,
>
> I have a Model Class which has the Below schema:
>
> class Pvt_ip_pools(AtlasAuditModel, AtlasBaseHelper):
> """
> Represents a private IP Address used for LB Model.
> This inherits all the fields from IPAddress model(database table).
> """
> # Each data center has its own IP address range
> data_center = models.ForeignKey(DataCenter,
> verbose_name="Data Center")
> ip = models.GenericIPAddressField(verbose_name="PvtIP",
>   blank=False,
>   null=False,
>   unique=True)
> prefix_length = models.PositiveSmallIntegerField(blank=False,
>  null=False,
>  unique=False)
> gateway = models.GenericIPAddressField(blank=False,
>null=False,
>unique=False)
>
>
>
>
>
> *   server_interface =
> models.ForeignKey('ServerInterface',
> related_name='pvt_ip_pools',
> blank=True,
> null=True,
> default=None,
> on_delete=models.SET_NULL)*
> ipv6 = models.BooleanField(default=0)
>
> segment_id = models.IntegerField(default=0,
> verbose_name="Segment_ID")
>
>
>
>
> *ip_status =
> models.ForeignKey('IPStatus',
> default=None,
> null=True,  on_delete=models.CASCADE)*
>
> class Meta:
> verbose_name = "[LB]Private IP Address"
> verbose_name_plural = "[LB]Private IP Addresses"
>
>
> In this, When a ServerInterface is Deleted, which is a foriegn Key, the
> Model here, sets the attribute to NULL.
> But, each of these will have a Object "IP_STATUS" which will have a value
> assigned ( FREE, USED ..)
> *Now On Delete of the ServerInterface Object, How do i reset the Value of
> "IP_STATUS" to FREE everytime Server_interface object is deleted?*
>
> Another Problem observed is that When The ServerINterface Object is
> deleted from ADMIN page, offcourse, it will not call the default delete.
>
> Even in this case
> *, how do i reset the value of IP_STATUS? when Object deleted from ADMIN
> Page.*
>
> Any Help is much appreciated.
>
>
> *Cheers*
>
> *Arun*
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-developers@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/147aedbd-7dd2-4cef-bfda-7cd79e9b2e2e%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Adam

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMyDDM3%2B9OYXgiQQqjvBF4ePZWuP42G7wJRFyrjZnRNGDKauhA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Help for GSoC proposal (Formset improvements)

2019-03-26 Thread PARTH PATIL
I was planning  to do the "Formset Improvements 
" 
project in GSoC. I would need some more explanation on what is expected as 
nothing was clearly mentioned there.
You can link the related tickets or elaborate on what is needed that would 
be helpful.

I dug a little bit deeper into this. and found some related issues 1 

 
| 2. 


I'm planning to add a request variable in the BaseFormSet Class 

 
and then handle it such that it will be available within every form (not 
completely polished till now).

   1. Is this a good approach?
   2. Will this solve the problem? (If not please mention the problems 
   which will not be solved

I am also looking for some additional features that maybe added to formset 
so am open for suggestions.
I'm currently in middle of making the abstract so before moving forward i 
would like to get some confirmation that this is correct approach. Thank you

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/09458146-224c-44c5-8bb3-2560f47350e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.