Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(requirements): update version django-chacheops to 5.1 #7885

Merged
merged 2 commits into from
Jan 11, 2021

Conversation

developerfred
Copy link
Contributor

Description

is working in administration update version django-chacheops

Refers/Fixes

close #7884

Testing

Screen Shot 2020-11-16 at 16 12 58

172.18.0.1 - - [16/Nov/2020 16:12:32] "POST /_administrationauth/user/22/delete/ HTTP/1.1" 302 -

@chibie chibie self-requested a review November 16, 2020 16:41
@developerfred
Copy link
Contributor Author

developerfred commented Nov 16, 2020

i still get the exception trying to delete a profile after this fix

@owocki in your script you need to have admin power to delete

@codecov
Copy link

codecov bot commented Nov 16, 2020

Codecov Report

Merging #7885 (8f59ec5) into master (5265bdb) will increase coverage by 0.03%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7885      +/-   ##
==========================================
+ Coverage   25.35%   25.39%   +0.03%     
==========================================
  Files         329      329              
  Lines       33401    33375      -26     
  Branches     4997     4986      -11     
==========================================
+ Hits         8470     8475       +5     
+ Misses      24641    24615      -26     
+ Partials      290      285       -5     
Impacted Files Coverage Δ
app/grants/tasks.py 15.54% <0.00%> (-0.11%) ⬇️
app/grants/views.py 10.87% <0.00%> (ø)
app/quests/views.py 14.91% <0.00%> (ø)
app/dashboard/sync/harmony.py 14.28% <0.00%> (ø)
...rketing/management/commands/no_applicants_email.py 0.00% <0.00%> (ø)
...eting/management/commands/assemble_leaderboards.py 39.73% <0.00%> (ø)
app/dashboard/views.py 10.34% <0.00%> (+0.01%) ⬆️
app/grants/sync/zcash.py 14.28% <0.00%> (+2.89%) ⬆️
app/dashboard/embed.py 31.60% <0.00%> (+3.44%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7a7a55d...2fc2b1d. Read the comment docs.

@thelostone-mc
Copy link
Member

Getting this in cause it doesn't look like anything we use would be impacted by the upgrade looking at the changelog!
In case if something breaks due to regression! will revert this

@thelostone-mc thelostone-mc merged commit 35817a8 into gitcoinco:master Jan 11, 2021
@owocki
Copy link
Contributor

owocki commented Jan 13, 2021

@developerfred @thelostone-mc @chibie this does not work. the below is on a server that has updated pip install django-cacheops==5.1

In [1]: from dashboard.models import Profile

In [2]: profile = Profile.objects.get(pk=7634)

In [3]: profile.delete()

---------------------------------------------------------------------------
DoesNotExist                              Traceback (most recent call last)
<ipython-input-3-8b9fba2101ca> in <module>()
----> 1 profile.delete()

~/gitcoin/gitcoin-37/lib/python3.7/site-packages/django/db/models/base.py in delete(self, using, keep_parents)
    917         collector = Collector(using=using)
    918         collector.collect([self], keep_parents=keep_parents)
--> 919         return collector.delete()
    920
    921     delete.alters_data = True

~/gitcoin/gitcoin-37/lib/python3.7/site-packages/django/db/models/deletion.py in delete(self)
    316                     for obj in instances:
    317                         signals.post_delete.send(
--> 318                             sender=model, instance=obj, using=self.using
    319                         )
    320

~/gitcoin/gitcoin-37/lib/python3.7/site-packages/django/dispatch/dispatcher.py in send(self, sender, **named)
    173         return [
    174             (receiver, receiver(signal=self, sender=sender, **named))
--> 175             for receiver in self._live_receivers(sender)
    176         ]
    177

~/gitcoin/gitcoin-37/lib/python3.7/site-packages/django/dispatch/dispatcher.py in <listcomp>(.0)
    173         return [
    174             (receiver, receiver(signal=self, sender=sender, **named))
--> 175             for receiver in self._live_receivers(sender)
    176         ]
    177

~/gitcoin/gitcoin-37/lib/python3.7/site-packages/cacheops/query.py in _post_delete(self, sender, instance, using, **kwargs)
    495         # NOTE: this will behave wrong if someone changed object fields
    496         #       before deletion (why anyone will do that?)
--> 497         invalidate_obj(instance, using=using)
    498
    499     def inplace(self):

~/gitcoin/gitcoin-37/lib/python3.7/site-packages/cacheops/invalidation.py in invalidate_obj(obj, using)
     34     """
     35     model = obj.__class__._meta.concrete_model
---> 36     invalidate_dict(model, get_obj_dict(model, obj), using=using)
     37
     38

~/gitcoin/gitcoin-37/lib/python3.7/site-packages/funcy/decorators.py in wrapper(*args, **kwargs)
     36         def wrapper(*args, **kwargs):
     37             call = Call(func, args, kwargs)
---> 38             return deco(call, *dargs, **dkwargs)
     39         return wraps(func)(wrapper)
     40     return _decorator

~/gitcoin/gitcoin-37/lib/python3.7/site-packages/funcy/flow.py in post_processing(call, func)
    161 def post_processing(call, func):
    162     """Post processes decorated function result with func."""
--> 163     return func(call())
    164
    165 collecting = post_processing(list)

~/gitcoin/gitcoin-37/lib/python3.7/site-packages/cacheops/invalidation.py in get_obj_dict(model, obj)
     97 def get_obj_dict(model, obj):
     98     for field in serializable_fields(model):
---> 99         value = getattr(obj, field.attname)
    100         if value is None:
    101             yield field.attname, None

~/gitcoin/gitcoin-37/lib/python3.7/site-packages/django/db/models/query_utils.py in __get__(self, instance, cls)
    133             val = self._check_parent_chain(instance, self.field_name)
    134             if val is None:
--> 135                 instance.refresh_from_db(fields=[self.field_name])
    136                 val = getattr(instance, self.field_name)
    137             data[self.field_name] = val

~/gitcoin/gitcoin-37/lib/python3.7/site-packages/django/db/models/base.py in refresh_from_db(self, using, fields)
    626             db_instance_qs = db_instance_qs.only(*fields)
    627
--> 628         db_instance = db_instance_qs.get()
    629         non_loaded_fields = db_instance.get_deferred_fields()
    630         for field in self._meta.concrete_fields:

~/gitcoin/gitcoin-37/lib/python3.7/site-packages/cacheops/query.py in get(self, *args, **kwargs)
    351             qs = self
    352
--> 353         return qs._no_monkey.get(qs, *args, **kwargs)
    354
    355     def first(self):

~/gitcoin/gitcoin-37/lib/python3.7/site-packages/django/db/models/query.py in get(self, *args, **kwargs)
    406             raise self.model.DoesNotExist(
    407                 "%s matching query does not exist." %
--> 408                 self.model._meta.object_name
    409             )
    410         raise self.model.MultipleObjectsReturned(

DoesNotExist: Profile matching query does not exist.

@owocki
Copy link
Contributor

owocki commented Jan 13, 2021

id recommend making a github ticket on the django cacheops repo if you guys cant figure it out.

@anggxyz
Copy link
Contributor

anggxyz commented Jan 14, 2021

Hey @developerfred, did you get a chance to circle back on the issue? I've been trying to test it out on my local instance it didn't work after updating my cacheops (is there something i'd be missing?), tweaking the models.py, but nothing seems to work. I see the following DB queries log on Sentry - any clue?
image

I'd be happy to have a quick chat/call regarding this to get things working

@owocki
Copy link
Contributor

owocki commented Jan 15, 2021 via email

@owocki
Copy link
Contributor

owocki commented Jan 23, 2021

asking for help in an actionable way when ya get stuck like - Suor/django-cacheops#387

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

500 error when deleting a profile (whether via command line or admin or via /settings/account/ )
5 participants