Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internships #13

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
NGROK = https://861a-2405-201-d031-6835-4002-a4c2-fbdd-8e4e.ngrok-free.app
NGROK = https://5521-2405-201-d031-6835-9552-3bd5-b477-e591.ngrok-free.app
REACT_WEB = http://localhost:3000
GOOGLE_AUTH_CLIENT = 740045753381-vivakol1fv1d3qkips50tg0gaq4ndnth.apps.googleusercontent.com
7 changes: 6 additions & 1 deletion internships/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
from django.contrib import admin
from .models import *


# Register the models in the admin interface
admin.site.register(Internship)
admin.site.register(internshipApplied)

# Register your models here.
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# Generated by Django 4.2.4 on 2023-08-06 16:38

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('common', '0001_initial'),
('internships', '0001_initial'),
]

operations = [
migrations.CreateModel(
name='internshipApplied',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('candidate', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='common.candidate')),
],
),
migrations.RemoveField(
model_name='internshipskill',
name='internship',
),
migrations.RemoveField(
model_name='internshipskill',
name='skill',
),
migrations.RenameField(
model_name='internship',
old_name='internship_id',
new_name='id',
),
migrations.RemoveField(
model_name='internship',
name='skills_required',
),
migrations.AddField(
model_name='internship',
name='aboutCompany',
field=models.CharField(max_length=500, null=True),
),
migrations.AddField(
model_name='internship',
name='location',
field=models.CharField(default='Remote', max_length=20),
),
migrations.AddField(
model_name='internship',
name='numberofhiring',
field=models.FloatField(null=True),
),
migrations.AddField(
model_name='internship',
name='numberofopportunities',
field=models.FloatField(null=True),
),
migrations.AddField(
model_name='internship',
name='openings',
field=models.IntegerField(null=True),
),
migrations.AddField(
model_name='internship',
name='perks',
field=models.CharField(max_length=500, null=True),
),
migrations.AddField(
model_name='internship',
name='postedTime',
field=models.TimeField(null=True),
),
migrations.AddField(
model_name='internship',
name='skills',
field=models.CharField(max_length=500, null=True),
),
migrations.AddField(
model_name='internship',
name='startdate',
field=models.DateField(null=True),
),
migrations.AddField(
model_name='internship',
name='type',
field=models.CharField(max_length=10, null=True),
),
migrations.AddField(
model_name='internship',
name='whoCanApply',
field=models.CharField(max_length=150, null=True),
),
migrations.AlterField(
model_name='internship',
name='apply_before',
field=models.DateField(null=True),
),
migrations.AlterField(
model_name='internship',
name='company',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='common.company'),
),
migrations.AlterField(
model_name='internship',
name='duration',
field=models.CharField(max_length=50, null=True),
),
migrations.AlterField(
model_name='internship',
name='stipend',
field=models.FloatField(null=True),
),
migrations.AlterField(
model_name='internship',
name='title',
field=models.CharField(max_length=25, null=True),
),
migrations.DeleteModel(
name='Company',
),
migrations.DeleteModel(
name='InternshipSkill',
),
migrations.DeleteModel(
name='Skill',
),
migrations.AddField(
model_name='internshipapplied',
name='internship',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='internships.internship'),
),
migrations.AlterUniqueTogether(
name='internshipapplied',
unique_together={('internship', 'candidate')},
),
]
79 changes: 57 additions & 22 deletions internships/models.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,71 @@
import datetime
from django.db import models
from django.core.validators import MinValueValidator
from common.models import company, candidate

class Company(models.Model):
name = models.CharField(max_length=100)
# class Company(models.Model):
# name = models.CharField(max_length=100)

def __str__(self):
return self.name
# def __str__(self):
# return self.name


# class Skill(models.Model):
# name = models.CharField(max_length=100)

# def __str__(self):
# return self.name


# class Internship(models.Model):
# internship_id = models.AutoField(primary_key=True)
# title = models.CharField(max_length=100)
# description = models.TextField()
# apply_before = models.DateField()
# company = models.ForeignKey(Company, on_delete=models.CASCADE)
# skills_required = models.ManyToManyField(Skill, through='InternshipSkill')
# duration = models.CharField(max_length=50)
# stipend = models.DecimalField(max_digits=10, decimal_places=2)

# def __str__(self):
# return f"{self.internship_id}: {self.title}"


# class InternshipSkill(models.Model):
# internship = models.ForeignKey(Internship, on_delete=models.CASCADE)
# skill = models.ForeignKey(Skill, on_delete=models.CASCADE)

# def __str__(self):
# return f"{self.internship} requires {self.skill}"


class Skill(models.Model):
name = models.CharField(max_length=100)

def __str__(self):
return self.name


class Internship(models.Model):
internship_id = models.AutoField(primary_key=True)
title = models.CharField(max_length=100)
title = models.CharField(max_length=25,null=True)
location = models.CharField(max_length=20,default="Remote")
description = models.TextField()
apply_before = models.DateField()
company = models.ForeignKey(Company, on_delete=models.CASCADE)
skills_required = models.ManyToManyField(Skill, through='InternshipSkill')
duration = models.CharField(max_length=50)
stipend = models.DecimalField(max_digits=10, decimal_places=2)
apply_before = models.DateField(null=True)
stipend = models.FloatField(null=True)
type = models.CharField(max_length=10,null= True)
skills = models.CharField(max_length=500,null=True)
company = models.ForeignKey(company, on_delete=models.CASCADE)
startdate = models.DateField(null=True)
duration=models.CharField(max_length=50,null=True)
aboutCompany = models.CharField(max_length=500,null=True)
whoCanApply = models.CharField(max_length=150,null=True)
postedTime = models.TimeField(null=True)
openings = models.IntegerField(null=True)
perks = models.CharField(max_length=500,null=True)
numberofhiring = models.FloatField(null=True)
numberofopportunities = models.FloatField(null=True)

def __str__(self):
return f"{self.internship_id}: {self.title}"


class InternshipSkill(models.Model):
class internshipApplied(models.Model):
internship = models.ForeignKey(Internship, on_delete=models.CASCADE)
skill = models.ForeignKey(Skill, on_delete=models.CASCADE)

def __str__(self):
return f"{self.internship} requires {self.skill}"
candidate = models.ForeignKey(candidate, on_delete=models.CASCADE)
class Meta:
unique_together = (('internship','candidate'))
5 changes: 3 additions & 2 deletions internships/urls.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from django.urls import path
from internships.views import internship_list_view, internship_detail_view, add_internship_view
from internships.views import internship_list_view, internship_detail_view, add_internship_view,apply_internship_view

urlpatterns = [
path('list/', internship_list_view),
path('details/', internship_detail_view),
path('add/', add_internship_view)
path('add/', add_internship_view),
path('apply/',apply_internship_view)
]
Loading