Skip to content

Commit 67273f4

Browse files
authored
Merge pull request #92 from kmAyush/forPr1
Interview Experience Update
2 parents 4e21f39 + 95329cf commit 67273f4

26 files changed

Lines changed: 678 additions & 147 deletions

website/events/forms.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
from .validators import valid_url_extension
55
from .validators import valid_url_mimetype
66
from django.utils.translation import ugettext as _
7+
from markdownx.fields import MarkdownxFormField
78
import mimetypes
89

910
class Eventsform(forms.ModelForm):
1011
title = models.CharField(max_length=30)
1112
description = models.TextField()
13+
description = MarkdownxFormField()
1214
image_url = models.URLField()
1315
start_time = models.DateTimeField()
1416
end_time = models.DateTimeField()

website/events/models.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
from django.db import models
22
from django.contrib.auth.models import User
33
from django.contrib.auth import get_user_model
4+
from markdownx.models import MarkdownxField
5+
from markdownx.utils import markdownify
46

57
# DONE
68
class Events(models.Model):
79
title = models.CharField(max_length=30)
8-
description = models.TextField()
10+
description = MarkdownxField()
911
image_url = models.URLField(blank=True, null=True)
1012
image = models.ImageField(blank=True, null=True, upload_to='images/')
1113
start_time = models.DateTimeField()
@@ -14,6 +16,12 @@ class Events(models.Model):
1416
# AUTOGEN DATE TIME
1517
created_at = models.DateTimeField(auto_now=False, auto_now_add=True)
1618
updated_at = models.DateTimeField(auto_now=True, auto_now_add=False)
19+
20+
# Create a property that returns the markdown instead
21+
@property
22+
def formatted_markdown(self):
23+
return markdownify(self.description)
24+
1725
def __str__(self):
1826
return self.title
1927
class Meta:

website/events/templates/create_event.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ <h1>Hello superuser:Add New Event</h1>
2424
{{ form }}
2525

2626
</table>
27+
{{ form.media }}
2728
<br>
2829
<input type="submit" value="Submit">
2930
</form>

website/forum/templates/base.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@
7979
<li class="nav-item {% block AskREC_active %}{% endblock %}">
8080
<a href="{% url 'forum:list_questions' %}" class="nav-link m-2 menu-item">AskREC</a>
8181
</li>
82+
<li class="nav-item {% block interview_active %}{% endblock %}">
83+
<a href="{% url 'experience:list_experiences' %}" class="nav-link m-2 menu-item">Interview Experiences</a>
84+
</li>
8285
<li class="nav-item {% block Events_active %}{% endblock %}">
8386
<a href="{% url 'events:calender' %}" class="nav-link m-2 menu-item">Events</a>
8487
</li>

website/forum/templates/home.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
{% endblock%}
6161

6262
{% block content %}
63+
{% load widget_tweaks %}
6364
<!-- <h2>Homepage</h2> -->
6465
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
6566
<script type="text/javascript" src="https://rawgit.com/notifyjs/notifyjs/master/dist/notify.js"></script>
@@ -100,9 +101,9 @@
100101
<a class="small text-center"href="{% url 'events:calender' %}">Check out upcoming events!</a>
101102
<hr class="mt-0">
102103
{% for event in events %}
103-
<h5 class="text-muted text-center" style="text-transform:uppercase;">{{event.title}}</h5>
104-
<span style="font-size:90%;">{{event.description}}</span><br>
105-
<p class="small mb-0" style="color:#666666; float:right;">on {{event.start_time}}</p>
104+
<h5 class="text-muted text-center" style="text-transform:uppercase;">{{ event.title }}</h5>
105+
<span style="font-size:90%;">{{ event.formatted_markdown | safe }}</span><br>
106+
<p class="small mb-0" style="color:#666666; float:right;">on {{ event.start_time }}</p>
106107
{%endfor%}
107108
</div>
108109
<div class="row">

website/forum/templates/team.html

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ <h3 class="team-title">Shubham Gupta</h3>
6262
<!-- TEAM MEMBER -->
6363
<div class="container mt-5">
6464
<div class="row">
65-
<div class="col-sm-4 col-md-2 col-lg-3"></div>
6665
<div class="col-sm-4 col-md-2 col-lg-3">
6766
<center>
6867
<img class="head mt-3 mb-2 rounded-circle" src="../media/images/team/3 Ritesh.jpg" style="border: solid 5px #343A3F; border-radius: 100%;"height="120px" width="120px"><br>
@@ -79,7 +78,6 @@ <h3 class="team-title">Shubham Gupta</h3>
7978
</center>
8079
</div>
8180

82-
<div class="col-sm-4 col-md-2 col-lg-3"></div>
8381

8482
<div class="col-sm-4 col-md-2 col-lg-3">
8583
<center>
@@ -101,7 +99,7 @@ <h3 class="team-title">Shubham Gupta</h3>
10199
<center>
102100
<img class="head mt-3 mb-2 rounded-circle" src="../media/images/team/3 Jaysurya.jpg" style="border: solid 5px #343A3F; border-radius: 100%;"height="120px" width="120px"><br>
103101
<strong>Jeya Surya</strong><br>
104-
<small class="text-muted">WebD Head</small>
102+
<small class="text-muted">Web and Tech Head</small>
105103
</center>
106104
</div>
107105

@@ -164,23 +162,23 @@ <h3 class="team-title">Shubham Gupta</h3>
164162
<div class="col-sm-4 col-md-2 col-lg-3">
165163
<center>
166164
<img class="head mt-3 mb-2 rounded-circle" src="../media/images/team/2 Abhishekh.jpg" style="border: solid 5px #343A3F; border-radius: 100%;"height="120px" width="120px"><br>
167-
<strong>Abhishek Kumar (abhi_nitd)</strong><br>
165+
<strong>Abhishek Kumar</strong><br>
168166
<small class="text-muted">Senior Coordinator</small>
169167
</center>
170168
</div>
171169

172170
<div class="col-sm-4 col-md-2 col-lg-3">
173171
<center>
174172
<img class="head mt-3 mb-2 rounded-circle" src="../media/images/team/2 AbhishekhMithila.jpg" style="border: solid 5px #343A3F; border-radius: 100%;"height="120px" width="120px"><br>
175-
<strong>Abhishek Kumar</strong><br>
173+
<strong>Abhishek Kumar Chaudhary</strong><br>
176174
<small class="text-muted">Senior Coordinator</small>
177175
</center>
178176
</div>
179177

180178
<div class="col-sm-4 col-md-2 col-lg-3">
181179
<center>
182180
<img class="head mt-3 mb-2 rounded-circle" src="../media/images/team/x.jpg" style="border: solid 5px #343A3F; border-radius: 100%;"height="120px" width="120px"><br>
183-
<strong>Anupam Kr. Singh</strong><br>
181+
<strong>Anupam Kumar Singh</strong><br>
184182
<small class="text-muted">Senior Coordinator</small>
185183
</center>
186184
</div>

website/interview_exp/admin.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@
44

55
@admin.register(Experiences)
66
class ExperiencesAdmin(admin.ModelAdmin):
7+
pass
8+
9+
@admin.register(Revisions)
10+
class RevisionsAdmin(admin.ModelAdmin):
711
pass

website/interview_exp/forms.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1-
from django import forms
2-
from .models import *
3-
from django.contrib.auth.models import User
4-
5-
class ExperienceForm(forms.ModelForm):
6-
class Meta:
7-
model = Experiences
8-
fields = ['company', 'year', 'job_Profile', 'no_of_Rounds', 'interview_Questions', 'total_Compensation']
9-
10-
class SearchForm(forms.Form):
11-
key = forms.CharField(max_length=25)
1+
from django import forms
2+
from .models import *
3+
from django.contrib.auth.models import User
4+
from markdownx.fields import MarkdownxFormField
5+
6+
class ExperienceForm(forms.ModelForm):
7+
class Meta:
8+
model = Experiences
9+
interview_Questions = MarkdownxFormField()
10+
fields = ['company', 'year', 'job_Profile', 'role_Type', 'no_of_Rounds', 'interview_Questions', 'total_Compensation']
11+
12+
class SearchForm(forms.Form):
13+
key = forms.CharField(max_length=25)
14+
15+
class RevisionForm(forms.ModelForm):
16+
class Meta:
17+
model = Revisions
18+
fields = ['message',]

website/interview_exp/models.py

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
from django.contrib.auth.models import User
33
import datetime
44
from django.core.validators import MaxValueValidator, MinValueValidator
5+
from markdownx.models import MarkdownxField
6+
from markdownx.utils import markdownify
57

68
# Create your models here.
79

@@ -16,20 +18,37 @@ class Experiences(models.Model):
1618
year = models.PositiveIntegerField(
1719
default=current_year(), validators=[MinValueValidator(1984), max_value_current_year])
1820
job_Profile = models.CharField(max_length=100)
21+
role_Type_choices = (
22+
('Internship', 'Internship'),
23+
('Full Time', 'Full Time'),
24+
)
25+
role_Type = models.CharField(max_length=50, choices=role_Type_choices)
1926
user = models.ForeignKey(User, on_delete=models.CASCADE)
2027
no_of_Rounds = models.PositiveIntegerField(
2128
default=1, validators=[MinValueValidator(1)])
2229
interview_Questions = models.TextField()
30+
interview_Questions = MarkdownxField()
2331
total_Compensation = models.PositiveIntegerField(
2432
blank=True, null=True
2533
)
34+
verification_Status_choices = (
35+
('Approved', 'Approved'),
36+
('Review Pending', 'Review Pending'),
37+
('Changes Requested', 'Changes Requested'),
38+
)
39+
verification_Status = models.CharField(max_length=50, choices=verification_Status_choices, default='Review Pending')
40+
verifier = models.ForeignKey(User, related_name='verifier', on_delete=models.SET_NULL, null=True)
2641
# TODO
2742
# AUTOGENERATE DATETIME
2843
created_at = models.DateTimeField(auto_now=False, auto_now_add=True)
2944
updated_at = models.DateTimeField(auto_now=True, auto_now_add=False)
3045

46+
@property
47+
def formatted_markdown(self):
48+
return markdownify(self.interview_Questions)
49+
3150
def __str__(self):
32-
return self.company
51+
return str(self.company) + " " + str(self.user)
3352

3453
def get_cname(self):
3554
class_name = "Experiences"
@@ -40,3 +59,26 @@ class Meta:
4059
ordering = ['-created_at']
4160
db_table = 'experiences'
4261
verbose_name_plural = 'Experiences'
62+
63+
64+
class Revisions(models.Model):
65+
experience = models.OneToOneField(Experiences, on_delete=models.CASCADE)
66+
reviewer = models.ForeignKey(User, on_delete=models.CASCADE)
67+
message = models.TextField()
68+
# TODO
69+
# AUTOGENERATE DATETIME
70+
created_at = models.DateTimeField(auto_now=False, auto_now_add=True)
71+
updated_at = models.DateTimeField(auto_now=True, auto_now_add=False)
72+
73+
def __str__(self):
74+
return str(self.experience.company) + " " + str(self.reviewer)
75+
76+
def get_cname(self):
77+
class_name = "Revisions"
78+
return class_name
79+
80+
class Meta:
81+
managed = True
82+
ordering = ['-created_at']
83+
db_table = 'revisions'
84+
verbose_name_plural = 'Revisions'
1.17 KB
Loading

0 commit comments

Comments
 (0)