diff --git a/instagram/__pycache__/__init__.cpython-36.pyc b/instagram/__pycache__/__init__.cpython-36.pyc index 8115893..f098a57 100644 Binary files a/instagram/__pycache__/__init__.cpython-36.pyc and b/instagram/__pycache__/__init__.cpython-36.pyc differ diff --git a/instagram/__pycache__/settings.cpython-36.pyc b/instagram/__pycache__/settings.cpython-36.pyc index af16132..aa31e45 100644 Binary files a/instagram/__pycache__/settings.cpython-36.pyc and b/instagram/__pycache__/settings.cpython-36.pyc differ diff --git a/instagram/__pycache__/urls.cpython-36.pyc b/instagram/__pycache__/urls.cpython-36.pyc index fbcf44d..483affd 100644 Binary files a/instagram/__pycache__/urls.cpython-36.pyc and b/instagram/__pycache__/urls.cpython-36.pyc differ diff --git a/instagram/__pycache__/wsgi.cpython-36.pyc b/instagram/__pycache__/wsgi.cpython-36.pyc index e398148..0745dd6 100644 Binary files a/instagram/__pycache__/wsgi.cpython-36.pyc and b/instagram/__pycache__/wsgi.cpython-36.pyc differ diff --git a/photoapp/__pycache__/__init__.cpython-36.pyc b/photoapp/__pycache__/__init__.cpython-36.pyc index 026aa9e..ffb0b17 100644 Binary files a/photoapp/__pycache__/__init__.cpython-36.pyc and b/photoapp/__pycache__/__init__.cpython-36.pyc differ diff --git a/photoapp/__pycache__/admin.cpython-36.pyc b/photoapp/__pycache__/admin.cpython-36.pyc index 3a76b5c..7950582 100644 Binary files a/photoapp/__pycache__/admin.cpython-36.pyc and b/photoapp/__pycache__/admin.cpython-36.pyc differ diff --git a/photoapp/__pycache__/apps.cpython-36.pyc b/photoapp/__pycache__/apps.cpython-36.pyc index 00b6421..585ae93 100644 Binary files a/photoapp/__pycache__/apps.cpython-36.pyc and b/photoapp/__pycache__/apps.cpython-36.pyc differ diff --git a/photoapp/__pycache__/forms.cpython-36.pyc b/photoapp/__pycache__/forms.cpython-36.pyc index 9b40b14..e6dfa19 100644 Binary files a/photoapp/__pycache__/forms.cpython-36.pyc and b/photoapp/__pycache__/forms.cpython-36.pyc differ diff --git a/photoapp/__pycache__/models.cpython-36.pyc b/photoapp/__pycache__/models.cpython-36.pyc index b595347..9cebf3c 100644 Binary files a/photoapp/__pycache__/models.cpython-36.pyc and b/photoapp/__pycache__/models.cpython-36.pyc differ diff --git a/photoapp/__pycache__/urls.cpython-36.pyc b/photoapp/__pycache__/urls.cpython-36.pyc index f346b9b..b946603 100644 Binary files a/photoapp/__pycache__/urls.cpython-36.pyc and b/photoapp/__pycache__/urls.cpython-36.pyc differ diff --git a/photoapp/__pycache__/views.cpython-36.pyc b/photoapp/__pycache__/views.cpython-36.pyc index aa296ef..59c8719 100644 Binary files a/photoapp/__pycache__/views.cpython-36.pyc and b/photoapp/__pycache__/views.cpython-36.pyc differ diff --git a/photoapp/forms.py b/photoapp/forms.py index 140f104..0881948 100644 --- a/photoapp/forms.py +++ b/photoapp/forms.py @@ -1,6 +1,6 @@ from django import forms from django.contrib.auth.models import User -from .models import Profile, Post, Comment +from .models import Profile, Post, Comment,cuser from django.contrib.auth.forms import UserCreationForm class UserForm(UserCreationForm): @@ -29,3 +29,9 @@ class Meta: model=Profile fields=('bio','image') + +class searchuform(forms.ModelForm): + class Meta: + model=cuser + fields=('username',) + diff --git a/photoapp/migrations/0017_auto_20210126_1301.py b/photoapp/migrations/0017_auto_20210126_1301.py new file mode 100644 index 0000000..f9575d0 --- /dev/null +++ b/photoapp/migrations/0017_auto_20210126_1301.py @@ -0,0 +1,20 @@ +# Generated by Django 2.0.2 on 2021-01-26 07:31 + +import datetime +from django.db import migrations, models +from django.utils.timezone import utc + + +class Migration(migrations.Migration): + + dependencies = [ + ('photoapp', '0016_auto_20210125_1053'), + ] + + operations = [ + migrations.AlterField( + model_name='comment', + name='date', + field=models.DateTimeField(default=datetime.datetime(2021, 1, 26, 7, 31, 47, 436426, tzinfo=utc)), + ), + ] diff --git a/photoapp/migrations/0017_auto_20210130_0138.py b/photoapp/migrations/0017_auto_20210130_0138.py new file mode 100644 index 0000000..3b89656 --- /dev/null +++ b/photoapp/migrations/0017_auto_20210130_0138.py @@ -0,0 +1,20 @@ +# Generated by Django 2.0.2 on 2021-01-29 20:08 + +import datetime +from django.db import migrations, models +from django.utils.timezone import utc + + +class Migration(migrations.Migration): + + dependencies = [ + ('photoapp', '0016_auto_20210125_1053'), + ] + + operations = [ + migrations.AlterField( + model_name='comment', + name='date', + field=models.DateTimeField(default=datetime.datetime(2021, 1, 29, 20, 8, 31, 868623, tzinfo=utc)), + ), + ] diff --git a/photoapp/migrations/0018_auto_20210130_0256.py b/photoapp/migrations/0018_auto_20210130_0256.py new file mode 100644 index 0000000..c16eddb --- /dev/null +++ b/photoapp/migrations/0018_auto_20210130_0256.py @@ -0,0 +1,20 @@ +# Generated by Django 2.0.2 on 2021-01-29 21:26 + +import datetime +from django.db import migrations, models +from django.utils.timezone import utc + + +class Migration(migrations.Migration): + + dependencies = [ + ('photoapp', '0017_auto_20210130_0138'), + ] + + operations = [ + migrations.AlterField( + model_name='comment', + name='date', + field=models.DateTimeField(default=datetime.datetime(2021, 1, 29, 21, 26, 11, 838287, tzinfo=utc)), + ), + ] diff --git a/photoapp/migrations/0019_auto_20210130_0257.py b/photoapp/migrations/0019_auto_20210130_0257.py new file mode 100644 index 0000000..bbd21f8 --- /dev/null +++ b/photoapp/migrations/0019_auto_20210130_0257.py @@ -0,0 +1,27 @@ +# Generated by Django 2.0.2 on 2021-01-29 21:27 + +import datetime +from django.db import migrations, models +from django.utils.timezone import utc + + +class Migration(migrations.Migration): + + dependencies = [ + ('photoapp', '0018_auto_20210130_0256'), + ] + + operations = [ + migrations.CreateModel( + name='cuser', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('username', models.CharField(max_length=500)), + ], + ), + migrations.AlterField( + model_name='comment', + name='date', + field=models.DateTimeField(default=datetime.datetime(2021, 1, 29, 21, 27, 26, 629021, tzinfo=utc)), + ), + ] diff --git a/photoapp/migrations/0020_merge_20210130_1317.py b/photoapp/migrations/0020_merge_20210130_1317.py new file mode 100644 index 0000000..0f7d7ae --- /dev/null +++ b/photoapp/migrations/0020_merge_20210130_1317.py @@ -0,0 +1,14 @@ +# Generated by Django 2.0.2 on 2021-01-30 07:47 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('photoapp', '0017_auto_20210126_1301'), + ('photoapp', '0019_auto_20210130_0257'), + ] + + operations = [ + ] diff --git a/photoapp/migrations/__pycache__/0001_initial.cpython-36.pyc b/photoapp/migrations/__pycache__/0001_initial.cpython-36.pyc index 980b38c..47579bc 100644 Binary files a/photoapp/migrations/__pycache__/0001_initial.cpython-36.pyc and b/photoapp/migrations/__pycache__/0001_initial.cpython-36.pyc differ diff --git a/photoapp/migrations/__pycache__/0002_auto_20191218_0717.cpython-36.pyc b/photoapp/migrations/__pycache__/0002_auto_20191218_0717.cpython-36.pyc index ddd76e0..bbd5d24 100644 Binary files a/photoapp/migrations/__pycache__/0002_auto_20191218_0717.cpython-36.pyc and b/photoapp/migrations/__pycache__/0002_auto_20191218_0717.cpython-36.pyc differ diff --git a/photoapp/migrations/__pycache__/0003_post_image.cpython-36.pyc b/photoapp/migrations/__pycache__/0003_post_image.cpython-36.pyc index a85fb05..b446019 100644 Binary files a/photoapp/migrations/__pycache__/0003_post_image.cpython-36.pyc and b/photoapp/migrations/__pycache__/0003_post_image.cpython-36.pyc differ diff --git a/photoapp/migrations/__pycache__/0004_auto_20191218_1037.cpython-36.pyc b/photoapp/migrations/__pycache__/0004_auto_20191218_1037.cpython-36.pyc index 0602355..30b04fb 100644 Binary files a/photoapp/migrations/__pycache__/0004_auto_20191218_1037.cpython-36.pyc and b/photoapp/migrations/__pycache__/0004_auto_20191218_1037.cpython-36.pyc differ diff --git a/photoapp/migrations/__pycache__/0005_auto_20191218_1052.cpython-36.pyc b/photoapp/migrations/__pycache__/0005_auto_20191218_1052.cpython-36.pyc index e365bf3..454fa78 100644 Binary files a/photoapp/migrations/__pycache__/0005_auto_20191218_1052.cpython-36.pyc and b/photoapp/migrations/__pycache__/0005_auto_20191218_1052.cpython-36.pyc differ diff --git a/photoapp/migrations/__pycache__/0006_auto_20191218_1106.cpython-36.pyc b/photoapp/migrations/__pycache__/0006_auto_20191218_1106.cpython-36.pyc index 6122798..13ec160 100644 Binary files a/photoapp/migrations/__pycache__/0006_auto_20191218_1106.cpython-36.pyc and b/photoapp/migrations/__pycache__/0006_auto_20191218_1106.cpython-36.pyc differ diff --git a/photoapp/migrations/__pycache__/0007_profile_followers.cpython-36.pyc b/photoapp/migrations/__pycache__/0007_profile_followers.cpython-36.pyc index cf92f23..3a594e4 100644 Binary files a/photoapp/migrations/__pycache__/0007_profile_followers.cpython-36.pyc and b/photoapp/migrations/__pycache__/0007_profile_followers.cpython-36.pyc differ diff --git a/photoapp/migrations/__pycache__/0008_comment.cpython-36.pyc b/photoapp/migrations/__pycache__/0008_comment.cpython-36.pyc index 66b9dfd..836ab71 100644 Binary files a/photoapp/migrations/__pycache__/0008_comment.cpython-36.pyc and b/photoapp/migrations/__pycache__/0008_comment.cpython-36.pyc differ diff --git a/photoapp/migrations/__pycache__/0009_auto_20191226_1000.cpython-36.pyc b/photoapp/migrations/__pycache__/0009_auto_20191226_1000.cpython-36.pyc index 74ffca3..3c51d81 100644 Binary files a/photoapp/migrations/__pycache__/0009_auto_20191226_1000.cpython-36.pyc and b/photoapp/migrations/__pycache__/0009_auto_20191226_1000.cpython-36.pyc differ diff --git a/photoapp/migrations/__pycache__/0010_auto_20200117_1515.cpython-36.pyc b/photoapp/migrations/__pycache__/0010_auto_20200117_1515.cpython-36.pyc index 23d3d04..422a07e 100644 Binary files a/photoapp/migrations/__pycache__/0010_auto_20200117_1515.cpython-36.pyc and b/photoapp/migrations/__pycache__/0010_auto_20200117_1515.cpython-36.pyc differ diff --git a/photoapp/migrations/__pycache__/0011_auto_20200117_1519.cpython-36.pyc b/photoapp/migrations/__pycache__/0011_auto_20200117_1519.cpython-36.pyc index 1c9ebef..6551d07 100644 Binary files a/photoapp/migrations/__pycache__/0011_auto_20200117_1519.cpython-36.pyc and b/photoapp/migrations/__pycache__/0011_auto_20200117_1519.cpython-36.pyc differ diff --git a/photoapp/migrations/__pycache__/0012_auto_20200122_1626.cpython-36.pyc b/photoapp/migrations/__pycache__/0012_auto_20200122_1626.cpython-36.pyc index 85c1c0e..62bec3d 100644 Binary files a/photoapp/migrations/__pycache__/0012_auto_20200122_1626.cpython-36.pyc and b/photoapp/migrations/__pycache__/0012_auto_20200122_1626.cpython-36.pyc differ diff --git a/photoapp/migrations/__pycache__/0013_auto_20200123_1409.cpython-36.pyc b/photoapp/migrations/__pycache__/0013_auto_20200123_1409.cpython-36.pyc index f159901..beca3c4 100644 Binary files a/photoapp/migrations/__pycache__/0013_auto_20200123_1409.cpython-36.pyc and b/photoapp/migrations/__pycache__/0013_auto_20200123_1409.cpython-36.pyc differ diff --git a/photoapp/migrations/__pycache__/0014_auto_20200125_0710.cpython-36.pyc b/photoapp/migrations/__pycache__/0014_auto_20200125_0710.cpython-36.pyc index eaf01f9..e20c35b 100644 Binary files a/photoapp/migrations/__pycache__/0014_auto_20200125_0710.cpython-36.pyc and b/photoapp/migrations/__pycache__/0014_auto_20200125_0710.cpython-36.pyc differ diff --git a/photoapp/migrations/__pycache__/0015_auto_20200126_1011.cpython-36.pyc b/photoapp/migrations/__pycache__/0015_auto_20200126_1011.cpython-36.pyc index 9effd54..78dcac2 100644 Binary files a/photoapp/migrations/__pycache__/0015_auto_20200126_1011.cpython-36.pyc and b/photoapp/migrations/__pycache__/0015_auto_20200126_1011.cpython-36.pyc differ diff --git a/photoapp/migrations/__pycache__/__init__.cpython-36.pyc b/photoapp/migrations/__pycache__/__init__.cpython-36.pyc index e3106db..6f2c208 100644 Binary files a/photoapp/migrations/__pycache__/__init__.cpython-36.pyc and b/photoapp/migrations/__pycache__/__init__.cpython-36.pyc differ diff --git a/photoapp/models.py b/photoapp/models.py index b65f2e3..35bd1ed 100644 --- a/photoapp/models.py +++ b/photoapp/models.py @@ -54,4 +54,6 @@ class Likes(models.Model): def __str__(self): return str(self.post) +class cuser(models.Model): + username=models.CharField(max_length=500) diff --git a/photoapp/templates/photoapp/invalidsearch.html b/photoapp/templates/photoapp/invalidsearch.html new file mode 100644 index 0000000..b050a7b --- /dev/null +++ b/photoapp/templates/photoapp/invalidsearch.html @@ -0,0 +1,2 @@ +

NO SUCH USER FOUND!

+ diff --git a/photoapp/templates/photoapp/postlist.html b/photoapp/templates/photoapp/postlist.html index 5d36fbd..1278a61 100644 --- a/photoapp/templates/photoapp/postlist.html +++ b/photoapp/templates/photoapp/postlist.html @@ -20,7 +20,9 @@

THE

{{i.author}}



- +
+
+add comment

{{i.caption}}


{{i.date_posted}}
diff --git a/photoapp/templates/photoapp/search.html b/photoapp/templates/photoapp/search.html new file mode 100644 index 0000000..17fba12 --- /dev/null +++ b/photoapp/templates/photoapp/search.html @@ -0,0 +1,6 @@ +
+ +{{form.username}} +{% csrf_token %} +
+
\ No newline at end of file diff --git a/photoapp/templates/photoapp/show.html b/photoapp/templates/photoapp/show.html new file mode 100644 index 0000000..14fe928 --- /dev/null +++ b/photoapp/templates/photoapp/show.html @@ -0,0 +1,5 @@ +

USER:

+ +
USERNAME:{{k.username}} +
NAME:{{k.first_name|title}} {{k.last_name|title}} +
Email:{{k.email}} diff --git a/photoapp/templates/photoapp/viewpost.html b/photoapp/templates/photoapp/viewpost.html index 4be2049..c173463 100644 --- a/photoapp/templates/photoapp/viewpost.html +++ b/photoapp/templates/photoapp/viewpost.html @@ -13,8 +13,8 @@

User is -{{posts.author}}


{{posts.caption}}



likes is -{{l}}
- - + +
add comment
{% for i in co %} diff --git a/photoapp/urls.py b/photoapp/urls.py index a975a17..b3d427e 100644 --- a/photoapp/urls.py +++ b/photoapp/urls.py @@ -16,4 +16,5 @@ path('home//create_comment',views.create_comment,name='create-comment'), path('home//like_post', views.like_post, name='like-post'), + path('home/search',views.searchuser,name='searchuser'), ] \ No newline at end of file diff --git a/photoapp/views.py b/photoapp/views.py index e191952..608ecec 100644 --- a/photoapp/views.py +++ b/photoapp/views.py @@ -3,7 +3,7 @@ from django.contrib.auth import authenticate, login, logout from django.contrib.auth.decorators import login_required -from .forms import UserForm,CreatePostForm,UpdatePostForm,CreateCommentForm, UpdateProfileForm +from .forms import UserForm,CreatePostForm,UpdatePostForm,CreateCommentForm, UpdateProfileForm,searchuform from django.contrib.auth.models import User from .models import Profile,Post, Comment, Likes from django.core.files.storage import FileSystemStorage @@ -194,7 +194,44 @@ def like_post(request,key): - +def searchuser(request): + if request.method=='POST': + print('2') + t=0 + form=searchuform(request.POST) + usn=User.objects.all() + print(len(usn)) + #f=form.cleaned_data['username'] + print(form) + for i in usn: + #if i.username==form.username: + print(i.username) + + + if form.is_valid(): + print('17') + print(form) + f=form.cleaned_data['username'] + print(f) + for k in usn: + if k.username==f: + print(k.last_name) + t=1 + break + if t: + return render(request,'photoapp\show.html',{'k':k}) + else: + return render(request,'photoapp\invalidsearch.html') + # print('1') + # j=form.save(commit=False) + # usinst=User.objects.get(username=j.username) + # print(usinst) + # return render(request,'show.html',{'usinst':usinst}) + #else: + # form=searchuform() + else: + form=searchuform() + return render(request,'photoapp\search.html',{'form':form})