コード例 #1
0
ファイル: views.py プロジェクト: 465060874/screenbird
def create_channel(request):
    """
    Creates a group.
    
    """
    if request.method == 'POST':
        form = ChannelForm(request.POST)
        if form.is_valid():
            channel = form.save(commit=False)
            channel.owner = request.user
            channel.channel_slug = generate_channel_slug(settings.CHANNEL_SLUG_LENGTH)
            channel.api_link = generate_api_key(API_KEY_LEN)
            channel.save()
            channel.owner.userprofile.channels.add(channel.id)
            return redirect(reverse('update_channel', args=[channel.id,]))
        else:
            context = {'form': form}
    else:
        form = ChannelForm()
        context = {'form': form}
    return render(request, 'create_channel.html', context)
コード例 #2
0
ファイル: views.py プロジェクト: thanhhoangila/screenbird
def create_channel(request):
    """
    Creates a group.
    
    """
    if request.method == 'POST':
        form = ChannelForm(request.POST)
        if form.is_valid():
            channel = form.save(commit=False)
            channel.owner = request.user
            channel.channel_slug = generate_channel_slug(
                settings.CHANNEL_SLUG_LENGTH)
            channel.api_link = generate_api_key(API_KEY_LEN)
            channel.save()
            channel.owner.userprofile.channels.add(channel.id)
            return redirect(reverse('update_channel', args=[
                channel.id,
            ]))
        else:
            context = {'form': form}
    else:
        form = ChannelForm()
        context = {'form': form}
    return render(request, 'create_channel.html', context)
コード例 #3
0
ファイル: admin.py プロジェクト: 465060874/screenbird
 def reset_slug(self, request, queryset):
     for q in queryset:
         channel_slug = generate_channel_slug(settings.CHANNEL_SLUG_LENGTH)
         q.channel_slug = channel_slug
         q.save()
コード例 #4
0
ファイル: admin.py プロジェクト: thanhhoangila/screenbird
 def reset_slug(self, request, queryset):
     for q in queryset:
         channel_slug = generate_channel_slug(settings.CHANNEL_SLUG_LENGTH)
         q.channel_slug = channel_slug
         q.save()