Changes between Initial Version and Version 2 of Ticket #30587
- Timestamp:
- Jun 24, 2019, 1:28:46 AM (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #30587
- Property Component Uncategorized → Database layer (models, ORM)
- Property Resolution → duplicate
- Property Status new → closed
- Property Summary Exceptions thrown by 'get_object_or_404()' shortcut method → Cloaking exceptions raised by get_object_or_404().
- Property Version 2.2 → master
-
Ticket #30587 – Description
initial v2 3 3 4 4 Models: 5 {{{ 5 6 >>class Test1(models.Model): 6 7 >> c2 = models.CharField(max_length=10) … … 9 10 >> c1 = models.UUIDField(primary_key=True, default=uuid.uuid4) 10 11 >> c2 = models.CharField(max_length=10) 11 12 }}} 12 13 query: 13 14 1. Below statement raises valueError: 15 {{{ 14 16 >> get_object_or_404(Test1, pk='test') 15 17 >> - invalid literal for int() with base 10: 'test' 16 18 }}} 17 19 2. Below statement raises ValidationError: 20 {{{ 18 21 >> get_object_or_404(Test2, pk="test") 19 22 >> - 'test' is not a valid UUID. 20 21 So this method will throw diff rent exceptions in diffenrent scenario. So would it be possible to raise 404 exceptions even if it finds invalid values.23 }}} 24 So this method will throw different exceptions in different scenario. So would it be possible to raise 404 exceptions even if it finds invalid values.