How to create a django model for a resume/CV app

363 views
Skip to first unread message

ronro...@googlemail.com

unread,
Nov 6, 2016, 12:54:57 PM11/6/16
to Django users
Hi,

I am rather new to django and not sure how to set up the relationship for all the fields of a resume app.

Let's say each user can have 1 or more resume. In each Resume, there is a introduction/about, 1 or more education entries and 1 or more previous job entries.
Is this correct?

class Resume(models.Model):
    about = models.TextField(max_length=500)
    applicant = models.ForeignKey(User)


class Education(models.Model):
    school = models.CharField(max_length=100)
    course = models.CharField(max_length=100)
    Resume = models.ForeignKey(Resume)
    start_date = models.DateField(blank=True, null=True)
    end_date = models.DateField(blank=True, null=True)
    
class Job(models.Model):
    title = models.CharField(max_length=100)
    company = models.CharField(max_length=100)
    Resume = models.ForeignKey(Resume)
    start_date = models.DateField(blank=True, null=True)
    end_date = models.DateField(blank=True, null=True)

What should I do in the view or form to let user to add more education or job fields?
Or I could only set it up certain amount of entries for each model, for example 3 eduction entries and 5 previous jobs.
Is there anyway I can do that dynamically so I can just start with 1 for each model and let the user add more if they need to?

Thanks


ludovic coues

unread,
Nov 6, 2016, 4:05:16 PM11/6/16
to django...@googlegroups.com
If you are using the default django admin, you can use inline model
admins [1]. The django's tutorial covert this point with polls'
questions having many possible choice in part 7 [2]

[1] https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#inlinemodeladmin-objects
[2] https://docs.djangoproject.com/en/1.10/intro/tutorial07/#adding-related-objects

2016-11-06 15:11 GMT+01:00 ronronald97 via Django users
<django...@googlegroups.com>:
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c23fc997-b723-4987-9be7-eb352f88814b%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--

Cordialement, Coues Ludovic
+336 148 743 42

ron

unread,
Nov 20, 2016, 3:56:15 PM11/20/16
to Django users
Thanks! I know it's been covered in the official django poll tutorial.

But how do I let users to do that without django admin? I probably will have an URL like: example.com/cv/create and only logged in users will be able to create their cv.
I am not sure how to set up the view so that users can create new cv.

I know class based view. But in my cv app, each user can have one CV, each CV can have one or more precious job and each CV can have one or more education entries.
So I can't actually use class based view here because a CV needs more than one class, right?

My questions are:
1) Is this the right set up in terms of the relationship for a CV app?
2) How can I let users create a CV with multiple related objects without user django admin.

This is my models.py. Is this the right way to set up the relationship of a CV??

> class Resume(models.Model): 
>     about = models.TextField(max_length=500) 
>     applicant = models.ForeignKey(User) 


> class Education(models.Model): 
>     resume = models.ForeignKey(Resume) 
>     school = models.CharField(max_length=100) 
>     course = models.CharField(max_length=100) 
>     start_date = models.DateField(blank=True, null=True) 
>     end_date = models.DateField(blank=True, null=True) 

> class Job(models.Model): 
>     resume = models.ForeignKey(Resume) 

>     title = models.CharField(max_length=100) 
>     company = models.CharField(max_length=100) 
>     start_date = models.DateField(blank=True, null=True) 
>     end_date = models.DateField(blank=True, null=True) 

ludovic coues

unread,
Nov 21, 2016, 5:22:12 AM11/21/16
to django...@googlegroups.com
I would be tempted to hook the admin site directly into the website.
Django's admin let you specify each form template so the look isn't an
issue. Putting a specific view from the admin at a specific url is a
bit more complex. Should be doable but maybe not easily or cleanly.

Short of doing that, django won't help you a lot. You can observe how
the admin is handling inline but it certainly involve a lot of
javascript that is specific to the admin.

2016-11-20 21:56 GMT+01:00 'ron' via Django users
<django...@googlegroups.com>:
> https://groups.google.com/d/msgid/django-users/12e86877-ea02-4a8c-b05f-874ef43746b0%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages