File tree Expand file tree Collapse file tree 2 files changed +3
-6
lines changed Expand file tree Collapse file tree 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(
355355
356356 Kwargs:
357357 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`.
359359 receiver: An async function that receives a `message: dict` from a channel.
360360 layer: The Django Channels layer to use. This layer must be defined in `settings.py:CHANNEL_LAYERS`.
361361
@@ -366,7 +366,7 @@ def use_channel_layer(
366366 channel_layer : InMemoryChannelLayer | RedisChannelLayer = get_channel_layer (layer ) # type: ignore
367367 channel_name = use_memo (lambda : str (channel or uuid4 ()))
368368
369- if not channel and not group :
369+ if not ( channel or group ) :
370370 msg = "You must either define a `channel` or `group` for this hook."
371371 raise ValueError (msg )
372372
@@ -382,10 +382,7 @@ def use_channel_layer(
382382 async def group_manager ():
383383 if group :
384384 await channel_layer .group_add (group , channel_name )
385-
386- if group :
387385 return lambda : asyncio .run (channel_layer .group_discard (group , channel_name ))
388-
389386 return None
390387
391388 # 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(
292292 # Force the query to execute
293293 getattr (data , field .name , None )
294294
295- if many_to_one and type (field ) == ManyToOneRel :
295+ if many_to_one and type (field ) is ManyToOneRel :
296296 prefetch_fields .append (field .related_name or f"{ field .name } _set" )
297297
298298 elif many_to_many and isinstance (field , ManyToManyField ):
You can’t perform that action at this time.
0 commit comments