-
Notifications
You must be signed in to change notification settings - Fork 5
review done #39
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
Open
wlwkgus
wants to merge
1
commit into
develop
Choose a base branch
from
review
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
review done #39
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,7 @@ | |
| from django.utils import timezone | ||
| from django.views.decorators.csrf import csrf_exempt | ||
| import json | ||
| from django.http import JsonResponse | ||
| from django.http import JsonResponse | ||
| from random import randint | ||
|
|
||
|
|
||
|
|
@@ -32,28 +32,29 @@ def myInfo(request): | |
|
|
||
|
|
||
| def mainSearch(request): | ||
| # TODO : arr 변수 이름 명확하게 바꾸기 | ||
| arr = ['','','',''] | ||
| len = HashTag.objects.count() | ||
| count = 0; | ||
| while (count < 4): | ||
| random_object = HashTag.objects.all()[randint(0, len - 1)] | ||
| if random_object.name in arr: | ||
| if random_object.name in arr: | ||
| continue | ||
| else: | ||
| arr[count]=random_object.name | ||
| count += 1; | ||
| print(arr) | ||
| print(arr) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. return HashTag.objects.orderbyRandom[:4] |
||
| return render(request, 'mainPage.html', {'hashTags':arr}) | ||
|
|
||
|
|
||
|
|
||
| def searchResult(request): | ||
| feeds = None | ||
| query = None | ||
| music = None | ||
| artist = None | ||
| tags = None | ||
|
|
||
| if ('q' in request.GET): | ||
| query = request.GET.get('q') | ||
| if query=="": | ||
|
|
@@ -67,14 +68,14 @@ def searchResult(request): | |
| return render(request, 'feedSearch.html', {'query':query, 'feeds':feeds}) | ||
| # try: | ||
| # music = Music.objects.get(title=query) | ||
| feeds = Feed.objects.all().filter(Q(music__icontains=query) | Q(artist__icontains=query) | Q(content__icontains=query)).order_by('-createdDate') | ||
| feeds = Feed.objects.all().filter(Q(music__icontains=query) | Q(artist__icontains=query) | Q(content__icontains=query)).order_by('-createdDate') | ||
| # except: | ||
| # try: | ||
| # artist = Artist.objects.get(name=query) | ||
| # feeds = Feed.objects.all().filter(Q(feedName__icontains=query) | Q(artist=artist.id)) | ||
| # except: | ||
| # feeds = Feed.objects.all().filter(Q(feedName__icontains=query)) | ||
|
|
||
| return render(request, 'feedSearch.html', {'query':query, 'feeds':feeds}) | ||
|
|
||
| def createFeed(request): | ||
|
|
@@ -89,7 +90,7 @@ def createFeed(request): | |
| feeds = Feed.objects.all().order_by('-createdDate') | ||
| query = "#모든" | ||
| return render(request, 'feedSearch.html', {'query':query, 'feeds':feeds}) | ||
|
|
||
| else: | ||
| form = createFeedForm() | ||
| ctx = {'form': form} | ||
|
|
@@ -98,8 +99,9 @@ def createFeed(request): | |
| def feedDetail(request, pk): | ||
| feed = Feed.objects.get(id=pk) | ||
| return render(request, template_name='feedDetail.html', context={'feed':feed}) | ||
|
|
||
| def certDetail(request, pk): | ||
| # get_object_or_404 사용하기 | ||
| cert = Certification.objects.get(id=pk) | ||
| music = cert.music | ||
|
|
||
|
|
@@ -146,15 +148,17 @@ def musicSearch(request): | |
|
|
||
| @csrf_exempt | ||
| def addMusicAjax(request): | ||
| # request에서 받은 걸 그대로 응답해주는게 맞나요?? | ||
| req = json.loads(request.body) | ||
| title = req['music'] | ||
| artist = req['artist'] | ||
|
|
||
| return JsonResponse({'music': title, 'artist': artist}) | ||
|
|
||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @login_required |
||
| def searchMyFeed(request): | ||
| # Login Requried | ||
| current_user = request.user | ||
| feeds = Feed.objects.all().filter(userId=current_user.id).order_by('-createdDate') | ||
| query = "내가 쓴글" | ||
| return render(request, 'feedSearch.html', {'query':query, 'feeds':feeds}) | ||
|
|
||
| return render(request, 'feedSearch.html', {'query':query, 'feeds':feeds}) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
len : 기본적인 파이썬 내장 함수
len()을 사용 못할 수 있음