Skip to content

Commit 023471b

Browse files
Merge pull request #5 from chaudharypraveen98/chaudharypraveen98
updated the project
2 parents 6b62dec + 2406729 commit 023471b

22 files changed

+435
-190
lines changed

.idea/workspace.xml

+102-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

db.sqlite3

-156 KB
Binary file not shown.

media/see.mp3

-503 KB
Binary file not shown.

media/see_aM0mfgC.mp3

-8.73 MB
Binary file not shown.

media/see_nnHDAq1.mp3

-8.73 MB
Binary file not shown.

music.zip

-17.6 MB
Binary file not shown.

music/forms.py

+13-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1+
'''The Django Meta class is a special thing through out Django which is used to transfer information about the model or other object to the Django framework; rather than using subclassing
2+
(which might have been another option but significantly more complex to implementing).
3+
4+
ModelForm is a regular Form which can automatically generate certain fields. The fields that are automatically generated depend on the content of the Meta class and on which fields have already been defined declaratively. Basically, ModelForm will only generate fields that are missing from the form, or in other words, fields that weren’t defined declaratively.
5+
Fields defined declaratively are left as-is, therefore any customizations made to Meta attributes such as widgets, labels, help_texts, or error_messages are ignored; these only apply to fields that are generated automatically.
6+
'''
7+
18
from django.contrib.auth.models import User
29
from django import forms
310

11+
412
class UserForm(forms.ModelForm):
5-
password = forms.CharField(widget=forms.PasswordInput)
6-
7-
'''The Django Meta class is a special thing
8-
through out Django which is used to transfer
9-
information about the model or other object to the
10-
Django framework; rather than using subclassing
11-
(which might have been another option
12-
but significantly more complex to implementing).'''
13-
class Meta:
14-
model = User
15-
fields = ('username','email','password')
13+
password = forms.CharField(widget=forms.PasswordInput)
1614

15+
class Meta:
16+
model = User
17+
# you can use ---fields = '__all__'--- for rendering all fields
18+
fields = ('username', 'email', 'password')

music/login.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
'''
2+
It is a django form class with some validation in the views.py such cleaned text and much more.
3+
'''
14
from django import forms
25

6+
37
class LoginForm(forms.Form):
4-
username = forms.CharField(max_length=100)
5-
password = forms.CharField(widget=forms.PasswordInput)
8+
username = forms.CharField(max_length=100)
9+
password = forms.CharField(widget=forms.PasswordInput)

music/messages.py

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 2.1.5 on 2020-05-25 23:54
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('music', '0009_auto_20200109_2228'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='song',
15+
name='song_logo',
16+
field=models.ImageField(default='2.jpg', upload_to=''),
17+
),
18+
]

music/models.py

+18-11
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,40 @@
55
from django.core.files.storage import FileSystemStorage
66

77

8-
class Album(models.Model):
8+
class Album(models.Model):
99
artist = models.CharField(max_length=250)
1010
album_title = models.CharField(max_length=250)
1111
genre = models.CharField(max_length=250)
1212
album_logo = models.FileField()
13+
1314
def get_absolute_url(self):
14-
return reverse('music:detail',kwargs={'pk':self.pk})
15+
return reverse('music:detail', kwargs={'pk': self.pk})
16+
1517
def __str__(self):
16-
return (self.album_title+"-"+self.artist)
18+
return (self.album_title + "-" + self.artist)
19+
1720

1821
class Song(models.Model):
19-
album = models.ForeignKey(Album,on_delete = models.CASCADE)
20-
file_type = models.CharField(max_length=10)
22+
album = models.ForeignKey(Album, on_delete=models.CASCADE)
23+
file_type = models.CharField(max_length=10, default="mp3")
2124
song_title = models.CharField(max_length=250)
22-
song_logo = models.FileField(max_length=140, null=True)
25+
song_logo = models.ImageField(default='2.jpg')
2326
song_link = models.FileField(upload_to='', default='see.mp3')
24-
is_favourite=models.BooleanField(default=False)
27+
is_favourite = models.BooleanField(default=False)
28+
2529
def __str__(self):
26-
return (self.song_title)
30+
return (self.song_title)
31+
2732

2833
class Contact_Us(models.Model):
2934
name = models.CharField(max_length=250)
3035
email = models.EmailField(max_length=250)
3136
subject = models.CharField(max_length=400)
3237
message = models.CharField(max_length=2500)
38+
3339
class Meta:
34-
verbose_name='message'
35-
verbose_name_plural='messages'
40+
verbose_name = 'message'
41+
verbose_name_plural = 'messages'
42+
3643
def __str__(self):
37-
return (self.name)
44+
return (self.name)

music/static/music/js/plugins.js

+41-4
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,49 @@ function closeNav() {
2828
var element = document.getElementById("mySidenav");
2929
element.style.width = "0px";
3030
element.classList.remove("padding-50");
31+
}
32+
33+
3134

35+
filterSelection("all")
36+
function filterSelection(c) {
37+
var x, i;
38+
x = document.getElementsByClassName("card");
39+
if (c == "all") c = "";
40+
for (i = 0; i < x.length; i++) {
41+
w3RemoveClass(x[i], "show");
42+
if (x[i].className.indexOf(c) > -1) w3AddClass(x[i], "show");
43+
}
3244
}
3345

46+
function w3AddClass(element, name) {
47+
var i, arr1, arr2;
48+
arr1 = element.className.split(" ");
49+
arr2 = name.split(" ");
50+
for (i = 0; i < arr2.length; i++) {
51+
if (arr1.indexOf(arr2[i]) == -1) {element.className += " " + arr2[i];}
52+
}
53+
}
54+
55+
function w3RemoveClass(element, name) {
56+
var i, arr1, arr2;
57+
arr1 = element.className.split(" ");
58+
arr2 = name.split(" ");
59+
for (i = 0; i < arr2.length; i++) {
60+
while (arr1.indexOf(arr2[i]) > -1) {
61+
arr1.splice(arr1.indexOf(arr2[i]), 1);
62+
}
63+
}
64+
element.className = arr1.join(" ");
65+
}
3466

35-
$(document).ready(function(){
36-
$(".navbar-toggler-icon").click(function(){
37-
$(".sidenav").addClass("padding-50");
67+
// Add active class to the current button (highlight it)
68+
var btnContainer = document.getElementById("myBtnContainer");
69+
var btns = btnContainer.getElementsByClassName("btn");
70+
for (var i = 0; i < btns.length; i++) {
71+
btns[i].addEventListener("click", function(){
72+
var current = document.getElementsByClassName("active");
73+
current[0].className = current[0].className.replace(" active", "");
74+
this.className += " active";
3875
});
39-
});
76+
}

0 commit comments

Comments
 (0)