How can to get data from related model in Django Rest Framework?

I have next models class User(AbstractUser): ip_address = models.CharField(max_length=15) class Statistic(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE, related_name=’statistics’) clicks = models.PositiveSmallIntegerField() and serializers class UserListSerializer(serializers.ModelSerializer): class Meta: model = User fields = [‘id’, ‘first_name’, ‘ip_address’] class UserStatisticSerializer(serializers.ModelSerializer): class Meta: model = Statistic How can I get in Response data in following format: { ‘user_data’: { ‘id’: 1,…

Details

$_GET[“foo”] NULL from RewriteRule

I am trying to redirect http://localhost/tour/hello to http://localhost/tour.php?name=hello I have tried the following in my .htaccess RewriteEngine on RewriteCond %{REQUEST_URI} ^/tour/(.+)/?$ RewriteRule ^tour/(.+)/?$ tour.php?name=$1 [L,QSA, NC] It redirects to http://localhost/tour.php but $_GET[“name”] is always NULL if I change the target page to anything other than tour.php it works RewriteRule ^tour/(.+)/?$ handler.php?name=$1 RewriteRule ^tour/(.+)/?$ blah.php?name=$1 All…

Details