python - rewriting unfilled field of the model in Django -
People did not fill the B fields in some objects (A, B, C) data base. Now I want the objects to be filtered from object to B, such as: obs in all_ob: if obj.b = "something": obj.delete ()
but I am getting this error: users.models.DoesNotExist: does not exist for the query line that matches the profile: if c.main_name.user == user [0]: the same error I'm getting on writing is c.main_name.user: so i How do I solve it? I can not rewrite this field because I can not address it and I can not filter this field by deleting some fields, I do not need it
Too much to help Thank you .. :)
There is a concept in C:
class concept (models.Model): partial_url = models.CharField (max_length = 200, unique = true) Insert_links = models.BooleanField (default = true) is_category = models.BooleanField (default = False) date_modified = models.DateTimeField (auto_now = True) main_name = Model. ForeignKey ('Little', related_name = 'concepts', empty = true, zero = true, unique = true) category = model. Forward ('self', empty = true, zero = true) deleted_request = normal. Generic Recallation (delete request, content_type_field = 'entry_ct', object_id_field = 'entry_id') and and c .main_name are verbatim:
class official .model): "" "literally represents the specific string of concept" "name = model. Kharifild (max_long = 200) norm_name = model CharField (max_length = 200) concept = models.ForeignKey (Conce PT) user = model. (Profile) date_modified = models.DateTimeField (auto_now = true) unknowable field - using Delete
YourModel.objects.filter (B = 'something') or empty for foreign key:
YourModel.objects.filter (B__isnull = True) .delete ()
Comments
Post a Comment