Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8654161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:43:05+00:00 2026-06-12T14:43:05+00:00

I have 1 question. These are my django models.(This is just example) class Users(models.Model):

  • 0

I have 1 question.
These are my django models.(This is just example)

 class Users(models.Model):
    username = models.Charfield()


 class CommunityBoard(models.Model):
    user = models.ForeignKey(User)
    title = models.CharField(max_length=30)
    contents = models.TextField()

I send data(nsdictionary format) to server using post

 { pk = 1 }

in views.py

 def detailCommuBoard(request):
     returnValues = {}
     returnValues.update(csrf(request))
     pk = request.POST['pk'];
     detailContents = CommunityBoard.objects.filter(pk=pk)
     returnValues = serializers.serialize('json', detailContents)

     return HttpResponse(returnValues)

then, I got serialized data in iphone.(json format)

 {
    fields =         {

        contents = "\Uc5ed\Uc2dc \Ud30c\Uc774\Uc36c";
        title = "\Ud30c\Uc774\Uc36c \Ud504\Ub85c\Uadf8\Ub798\Ubc0d";           
        user = 1;

    };        
    pk = 11;
}

I want to show User model’s username when make queryset, not user model’s pk.

please Help me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T14:43:06+00:00Added an answer on June 12, 2026 at 2:43 pm

    I think you need to change the Queryset to include that information.

    detailContents = CommunityBoard.objects.filter(pk=pk).values_list('contents', 'title', 'user__username')
    returnValues = serializers.serialize('json', detailContents)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have these models class User(models.Model): user_name = models.CharField() ph_number = models.CharField() class ExamPaper(models.Model):
I have the following model in Django: from django.db import models class User(models.Model): pen_name
I have some Django models with a structure similar to this: class Grandparent(models.Model): name
I have few similar models in Django: class Material(models.Model): title = models.CharField(max_length=255) class Meta:
I have a Django Model that implements a time range, like this: class Period(models.Model):
I have a django model like this: class Something(models.Model): attr1 = models.IntegerField() attr2 =
I have these 3 models in models.py class Customer(models.Model): name = models.CharField(max_length=50) .... class
Note: I've since asked this question again given the updates to Django's user model
I have a following model: class Car(models.Model): make = models.CharField(max_length=40) mileage_limit = models.IntegerField() mileage
This is how my models look: class QuestionTagM2M(models.Model): tag = models.ForeignKey('Tag') question = models.ForeignKey('Question')

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.