<commit_before># -*- coding: utf-8 -*-
from telemeta.views.core import *
from telemeta.models import *

class NewPlaylistView(object):

    def display(self, request):

        template_name = loader.get_template('search/addplaylist.html')

        idlist = request.POST.getlist('selected_items_list')
        itemlist = []
        for itemid in idlist:
            itemlist.append(MediaItem.objects.all().get(id=itemid))
        context = RequestContext(request, {
                'selected_items_list': itemlist,
                'existing_playlists': Playlist.objects.all().filter(author=request.user),
                'lastquerypath':request.POST.get('lastquerypath')})
        return HttpResponse(template_name.render(context))

    def addToPlaylist(self, request):
        template_name = loader.get_template('search/confirmation_add_playslist.html')

        idlist = request.POST.getlist('item_id')
        selected_playlist_id = request.POST.get('playlist_id')
        selected_playlist = Playlist.objects.all().get(id=selected_playlist_id)

        itemlist = []
        for itemid in idlist:
            itemlist.append(MediaItem.objects.all().get(id=itemid))

        for item in itemlist:
            resource = PlaylistResource.objects.get_or_create(resource_type='item',public_id='4567891542',resource_id=item.id,playlist=selected_playlist)

        context = RequestContext(request, {
                'selected_items_list': itemlist,
                'lastquerypath': request.POST.get('lastquerypath')})
        return HttpResponse(template_name.render(context))

<commit_msg>fix playlist uuid creation<commit_after># -*- coding: utf-8 -*-
from telemeta.views.core import *
from telemeta.models import *
import uuid

class NewPlaylistView(object):

    def display(self, request):

        template_name = loader.get_template('search/addplaylist.html')

        idlist = request.POST.getlist('selected_items_list')
        itemlist = []
        for itemid in idlist:
            itemlist.append(MediaItem.objects.all().get(id=itemid))
        context = RequestContext(request, {
                'selected_items_list': itemlist,
                'existing_playlists': Playlist.objects.all().filter(author=request.user),
                'lastquerypath':request.POST.get('lastquerypath')})
        return HttpResponse(template_name.render(context))

    def addToPlaylist(self, request):
        template_name = loader.get_template('search/confirmation_add_playslist.html')

        idlist = request.POST.getlist('item_id')
        selected_playlist_id = request.POST.get('playlist_id')
        selected_playlist = Playlist.objects.all().get(id=selected_playlist_id)

        itemlist = []
        for itemid in idlist:
            itemlist.append(MediaItem.objects.all().get(id=itemid))

        for item in itemlist:
            new_id = uuid.uuid4()
            PlaylistResource.objects.get_or_create(resource_type='item',public_id=new_id,resource_id=item.id,playlist=selected_playlist)

        context = RequestContext(request, {
                'selected_items_list': itemlist,
                'lastquerypath': request.POST.get('lastquerypath')})
        return HttpResponse(template_name.render(context))


{'fraction_non_alphanumeric': 0.11383374689826303, 'fraction_numerical': 0.004032258064516129, 'mean_word_length': 3.1240409207161126, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5692963', 'n_tokens_mistral': 950, 'n_tokens_neox': 913, 'n_words': 134}