-
-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
64 additions
and
53 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
|
||
|
||
class ClippingConfig(AppConfig): | ||
name = 'clipping' | ||
name = "clipping" |
This file contains 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 |
---|---|---|
@@ -1,16 +1,17 @@ | ||
from django.forms import ModelForm | ||
from .models import Clipping | ||
from django import forms | ||
from django.conf import settings | ||
from django.forms import ModelForm | ||
|
||
from .models import Clipping | ||
|
||
|
||
class ClippingForm(ModelForm): | ||
category = forms.CharField(widget=forms.Select(choices=settings.CATEGORY_CHOICES), label='Categoria') | ||
date = forms.CharField(widget=forms.TextInput(attrs={'class':'datepicker'}),label='Data') | ||
author = forms.CharField(label='Autor') | ||
title = forms.CharField(label='Título') | ||
category = forms.CharField(widget=forms.Select(choices=settings.CATEGORY_CHOICES), label="Categoria") | ||
date = forms.CharField(widget=forms.TextInput(attrs={"class": "datepicker"}), label="Data") | ||
author = forms.CharField(label="Autor") | ||
title = forms.CharField(label="Título") | ||
|
||
class Meta: | ||
model = Clipping | ||
fields = '__all__' | ||
exclude = ['added_by', 'published'] | ||
fields = "__all__" | ||
exclude = ["added_by", "published"] |
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,3 +1 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,17 +1,18 @@ | ||
import json | ||
from django.http import HttpResponse | ||
from django.shortcuts import render # get_object_or_404, redirect | ||
|
||
from django.contrib.contenttypes.models import ContentType | ||
from .models import Clipping, ClippingRelation | ||
from django.http import HttpResponse | ||
|
||
from .models import ClippingRelation | ||
|
||
|
||
def get_contenttype_instances(request): | ||
pk = request.GET.get('id') | ||
result = list(ContentType.objects.get(id=pk).model_class().objects.filter().values('id', 'name')) | ||
pk = request.GET.get("id") | ||
result = list(ContentType.objects.get(id=pk).model_class().objects.filter().values("id", "name")) | ||
return HttpResponse(json.dumps(result), content_type="application/json") | ||
|
||
|
||
def get_current_selected_instance(request): | ||
pk = request.GET.get('id') | ||
pk = request.GET.get("id") | ||
result = ClippingRelation.objects.get(id=pk).object_id | ||
return HttpResponse(json.dumps(result), content_type="application/json") |
This file contains 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