The code you've shown shouldn't throw an error: it's perfectly valid.
However a better way to do this would be to use a classmethod instead of a staticmethod. The point of a classmethod is that it is automatically passed the class itself, which you can use in the method:
@classmethod
def from_user(cls, user):
return cls.objects.get(username=user.username)