Language App

language.forms

language.forms module contents

Created on Wed Nov 7 14:38:51 2018

@author: Paolo Cozzi <cozzi@ibba.cnr.it>

class language.forms.SpecieSynonymForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]

Bases: django.forms.models.ModelForm

class Meta[source]

Bases: object

fields = ('word', 'language', 'dictspecie')
model

alias of language.models.SpecieSynonym

base_fields = {'dictspecie': <django.forms.models.ModelChoiceField object>, 'language': <django.forms.models.ModelChoiceField object>, 'word': <django.forms.fields.CharField object>}
declared_fields = {'language': <django.forms.models.ModelChoiceField object>, 'word': <django.forms.fields.CharField object>}
property media

Return all media required to render the widgets on this form.

language.helpers

language.helpers module contents

Created on Fri Mar 22 15:17:14 2019

@author: Paolo Cozzi <cozzi@ibba.cnr.it>

language.helpers.check_species_synonyms(words, country, create=False)[source]

Check if every words is a synonym of a specie or not. If auto_create is true, this function will create a row in synonym table (with unkwnon relationship with species)

language.helpers.create_specie_synonym(word, country)[source]

add specie in speciesynonym table

language.models

language.models module contents

Created on Fri May 11 16:15:36 2018

@author: Paolo Cozzi <cozzi@ibba.cnr.it>

class language.models.Replace(*args, **kwargs)[source]

Bases: django.db.models.expressions.Func

function = 'REPLACE'
class language.models.SpecieSynonym(id, dictspecie, language, word)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

classmethod check_specie_by_synonym(word, country)[source]

Test for a word in supplied language or default one

classmethod check_synonyms(words, country)[source]

Map words to country language or default one

dictspecie

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

dictspecie_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

language

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

language_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
classmethod remove_spaces()[source]

Annotate objects by removing spaces in word and by returning a queryset

word

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

language.views

language.views module contents

Created on Mon Nov 5 14:31:14 2018

@author: Paolo Cozzi <cozzi@ibba.cnr.it>

class language.views.CountryMixin[source]

Bases: object

Read country label from request get (if present) and add to context

country = None
get_context_data(**kwargs)[source]

Add a dictcountry object to a context

get_queryset()[source]

Read country if requested using GET method

queryset
class language.views.ListSpeciesView(**kwargs)[source]

Bases: django.contrib.auth.mixins.LoginRequiredMixin, language.views.CountryMixin, django.views.generic.list.ListView

model

alias of language.models.SpecieSynonym

ordering = ['word']
paginate_by = 10
template_name = 'language/speciesynonym_list.html'
class language.views.UpdateSpeciesView(**kwargs)[source]

Bases: django.contrib.auth.mixins.LoginRequiredMixin, language.views.CountryMixin, django.views.generic.edit.UpdateView

form_class

alias of language.forms.SpecieSynonymForm

get_success_url()[source]

Redirect to page if form is valid

success_url
template_name = 'language/speciesynonym_form.html'