Opened 8 years ago

Closed 8 years ago

#16796 closed New feature (wontfix)

isMobile() should be added to request objects

Reported by: anonymous Owned by: nobody
Component: HTTP handling Version: 1.3
Severity: Normal Keywords:
Cc: chris@… Triage Stage: Someday/Maybe
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Currently, in Django one needs to use a custom middleware to handle template switching logic for mobile view presentations. Here's my suggestion, since knowing whether a user is_mobile() is kind of a common scenario, or should be in modern web development, is it appropriate to add this be added to Django out of the box? There's a debate whether to do this in the user agent handling, however, it seems it might the most appropriate for our concerns. Here's two different custom middlewares that might be a good candidate examples for how to handle this for or

Change History (3)

comment:1 Changed 8 years ago by Chris Heisel

Cc: chris@… added
Component: UncategorizedHTTP handling
Triage Stage: UnreviewedSomeday/Maybe


I'm not sure who submitted this ticket since it's marked as being reported by anonymous. You should visit the Trac register page to set up an account. That'll make it easier for you to follow the dialogue and to link up discussions on the django-developers list and in IRC with your tickets.

Your ticket asks a lot of questions, which means you might want to start by opening a thread in django-developers to get the thoughts of the community as to whether this is something that belongs in Django proper, or should be provided by third party libraries.



comment:2 Changed 8 years ago by Luke Plant

I'm going to mark as WONTFIX, because:

  1. there is no obviously correct consensus on how to do the user-agent sniffing, or even consensus on whether this is the right approach at all, depending on what you are going to do with 'is_mobile'. AFAICS, 'is_mobile' takes a set of abilities that devices may have, each of which has to be represented by a large spectrum, and reduces them all to a single boolean, which is of dubious value for many uses.
  1. Unlike with other things that are in contrib, there is no great problem caused by different solutions to this problem, so there is no reason for this to go in core/contrib.
  1. As soon as we added this functionality, we would be taking on the burden of maintaining a database of user agent strings for 'mobiles' (and defining what that means).

This should remain as a snippet, or 3rd party solution.

comment:3 Changed 8 years ago by Luke Plant

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top