Answer the question
In order to leave comments, you need to log in
Working with slug and pk in django?
I have 2 models (the first one is User, the standard one, the second one displays the user's resume)
class ResumesModel(models.Model):
client_id = models.OneToOneField(User, on_delete=models.CASCADE, primary_key=True)
work_experience = models.IntegerField(verbose_name="Опыт работы")
specialization = models.TextField(verbose_name="Специальность")
desired_salary = models.IntegerField(verbose_name="Желаемая зарплата", blank=True)
hard_skills = models.TextField(verbose_name="Ключевые навыки")
about_you = models.TextField(verbose_name="О себе")
native_language = models.TextField(verbose_name="Родной язык")
foreign_language = models.TextField(verbose_name="Иностранный язык")
def __str__(self):
return str(self.client_id)
class ResumesDetail(DetailView):
model = ResumesModel
template_name = "work/resumes/detail.html"
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# context["this_user"] = User.objects.get()
return context
path('resumes/<slug:client_id>', views.ResumesDetail.as_view(), name="check_resume"),
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question