Coder Social home page Coder Social logo

django-coupon-management's People

Contributors

krishnaansh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

django-coupon-management's Issues

more than two couponuser count

hi there!

Can't quite put my finger on it and why it's happening, but if a user has used two different coupons (showing twice as a coupon user in admin), any attempt for the same user to use a coupon ever again causes this error. At first glance it has to do with the .get() call in your validations.py. Not quite sure though why in the end it raises MultipleObjecstReturned:

Variable | Value
-- | --
args | ()
clone | <QuerySet [<CouponUser: testuser10>, <CouponUser: testuser10>]>
kwargs | {'user': <SimpleLazyObject: <User: testuser10>>}
limit | 21
num | 2
self | <QuerySet [<CouponUser: testuser11>, <CouponUser: testuser11>, <CouponUser: testuser10>, <CouponUser: rado>, <CouponUser: rado>, <CouponUser: piratko>, <CouponUser: piratko>, <CouponUser: testuser10>]>

Traceback (most recent call last):
  File "D:\Code\price_tracker_django\.venv\lib\site-packages\django\core\handlers\exception.py", line 55, in inner
    response = get_response(request)
  File "D:\Code\price_tracker_django\.venv\lib\site-packages\django\core\handlers\base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "D:\Code\price_tracker_django\.venv\lib\site-packages\django\contrib\auth\decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "D:\Code\price_tracker_django\tracker\views.py", line 1157, in profile
    status = validate_coupon(coupon_code=activation_code,user=user)
  File "D:\Code\price_tracker_django\.venv\lib\site-packages\coupon_management\validations.py", line 68, in validate_coupon
    valid_max_uses_rule = validate_max_uses_rule(coupon_object=coupon_object, user=user)
  File "D:\Code\price_tracker_django\.venv\lib\site-packages\coupon_management\validations.py", line 33, in validate_max_uses_rule
    coupon_user = CouponUser.objects.get(user=user)
  File "D:\Code\price_tracker_django\.venv\lib\site-packages\django\db\models\manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "D:\Code\price_tracker_django\.venv\lib\site-packages\django\db\models\query.py", line 499, in get
    raise self.model.MultipleObjectsReturned(

Exception Type: MultipleObjectsReturned at /testuser10/profile/
Exception Value: get() returned more than one CouponUser -- it returned 2!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.