File tree 2 files changed +3
-6
lines changed
2 files changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -355,7 +355,7 @@ def use_channel_layer(
355
355
356
356
Kwargs:
357
357
group: If configured, the `channel` is added to a `group` and any messages sent by `AsyncMessageSender` \
358
- is broadcasted to all channels within the `group`
358
+ is broadcasted to all channels within the `group`.
359
359
receiver: An async function that receives a `message: dict` from a channel.
360
360
layer: The Django Channels layer to use. This layer must be defined in `settings.py:CHANNEL_LAYERS`.
361
361
@@ -366,7 +366,7 @@ def use_channel_layer(
366
366
channel_layer : InMemoryChannelLayer | RedisChannelLayer = get_channel_layer (layer ) # type: ignore
367
367
channel_name = use_memo (lambda : str (channel or uuid4 ()))
368
368
369
- if not channel and not group :
369
+ if not ( channel or group ) :
370
370
msg = "You must either define a `channel` or `group` for this hook."
371
371
raise ValueError (msg )
372
372
@@ -382,10 +382,7 @@ def use_channel_layer(
382
382
async def group_manager ():
383
383
if group :
384
384
await channel_layer .group_add (group , channel_name )
385
-
386
- if group :
387
385
return lambda : asyncio .run (channel_layer .group_discard (group , channel_name ))
388
-
389
386
return None
390
387
391
388
# Listen for messages on the channel using the provided `receiver` function.
Original file line number Diff line number Diff line change @@ -292,7 +292,7 @@ def django_query_postprocessor(
292
292
# Force the query to execute
293
293
getattr (data , field .name , None )
294
294
295
- if many_to_one and type (field ) == ManyToOneRel :
295
+ if many_to_one and type (field ) is ManyToOneRel :
296
296
prefetch_fields .append (field .related_name or f"{ field .name } _set" )
297
297
298
298
elif many_to_many and isinstance (field , ManyToManyField ):
You can’t perform that action at this time.
0 commit comments