Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(19)  |  Call(13)  |  Derive(0)  |  Import(6)

src/m/a/manabi-HEAD/apps/flashcards/views/rest/__init__.py   manabi(Download)
        UserResource, DeckResource, CardResource)
from flashcards.views.decorators import has_card_query_filters
from flashcards.views.shortcuts import get_deck_or_404
 
 
    def get_object(self):
        deck = get_deck_or_404(self.request.user, self.kwargs.get('pk'))
 
        # If the user is already subscribed to this deck,
        # redirect to their subscribed copy.
    def get(self, request, **kwargs):
        deck = get_deck_or_404(request.user, kwargs.get('pk'))
        return self.render_to_response({'suspended': deck.suspended})
 
    def post(self, request, **kwargs):
        deck = get_deck_or_404(request.user, kwargs.get('pk'), must_own=True)
    def post(self, request, **kwargs):
        user = self.request.user
        deck = get_deck_or_404(user, self.kwargs.get('pk'))
 
        # Is it already this user's deck?

src/m/a/manabi-HEAD/apps/flashcards/views/api/__init__.py   manabi(Download)
                                         ApiException, has_card_query_filters,
                                         flashcard_api_with_dojo_data as api_dojo_data)
from flashcards.views.shortcuts import get_deck_or_404
from flashcards.signals import fact_deleted
 
def rest_deck_subscribe(request, deck_id):
    if request.method == 'POST':
        deck = get_deck_or_404(request.user, deck_id)
        new_deck = deck.subscribe(request.user)
 
def rest_deck(request, deck_id):
    deck = get_deck_or_404(request.user, deck_id)
 
    if request.method == 'DELETE':
        if deck.subscriber_decks.filter(active=True).exists(): 
def rest_deck_name(request, deck_id):
    deck = get_deck_or_404(request.user, deck_id)
 
    if request.method == 'GET':
        return deck.name
def rest_deck_description(request, deck_id):
    deck = get_deck_or_404(request.user, deck_id)
 
    if request.method == 'GET':
        return deck.description

src/m/a/manabi-HEAD/apps/books/views.py   manabi(Download)
 
from flashcards.forms import TextbookSourceForm
from flashcards.views.shortcuts import get_deck_or_404
from forms import TextbookForm
from models import Textbook
    Reusing a textbook takes precedence over creating a new one.
    '''
    deck = get_deck_or_404(request.user, deck_id, must_own=True)
 
    old_form = TextbookSourceForm(request.POST, instance=deck)

src/m/a/manabi-HEAD/apps/flashcards/views/crud.py   manabi(Download)
from flashcards.models import FieldContent, Card
from flashcards.forms import TextbookSourceForm
from flashcards.views.shortcuts import get_deck_or_404
from books.forms import TextbookForm
import usertagging
def deck_detail(request, deck_id=None):
    deck = get_deck_or_404(request.user, deck_id)
 
    if request.user.is_authenticated():
        # Redirect if the user is already subscribed to this deck.

src/m/a/manabi-HEAD/apps/popups/views.py   manabi(Download)
from flashcards.models import FactType, Fact, Deck, CardTemplate, FieldType
from flashcards.models import FieldContent, Card
from flashcards.views.shortcuts import get_deck_or_404
 
 
def fact_add_form(request, deck_id=None):
    '''Form for creating facts.'''
    deck = get_deck_or_404(request.user, deck_id)
 
    context = fact_add_form_context(request, deck=deck,

src/m/a/manabi-HEAD/apps/flashcards/views/decorators.py   manabi(Download)
from dojango.util import to_json_response, json_encode
from flashcards.models.decks import Deck
from flashcards.views.shortcuts import get_deck_or_404
from functools import wraps
import datetime
        deck_pk = request.GET.get('deck', '').strip()
        if deck_pk:
            deck = get_deck_or_404(request.user, deck_pk)
            kwargs['deck'] = deck