Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
ModuleNotFoundError: No module named 'push_notifications' I am getting this error after I've uninstalled the module django push notification
snap of error is here which I am getting while I am migrate -
translation not working in Django 1.5 even after compiling message
I'm using Django 1.5 I have to enable internationalization in my application. For that, I have added a few things to the settings.py file MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.common.CommonMiddleware', ... ) LANGUAGE_CODE = 'es' # List of languages available for translation ugettext = lambda s: s LANGUAGES = ( ('en', ugettext('English')), ('es', ugettext('Spanish')) ) LOCALE_PATHS = ( os.path.join(PROJECT_ROOT, 'locale/'), ) The LOCALE_PATHS has the location output as ('/media/path_to_project/workbench/workbench/settings/../locale/',) But on running ./manage.py makemessages -l es it generates *.po file in /media/path_to_project/workbench/workbench instead of /media/path_to_project/workbench/workbench/locale Also, the compiled language is not showing in the template. -
Cannot get last n elements from GraphQL with graphene_django
I was trying to implement GraphQL in existing Django REST Framework. I used graphene-django==2.2.0 It was successfully implemented. But cannot use 'last' keyword in the request query. I am adding the schema code. import graphene from graphene_django.types import DjangoObjectType from flowers.models import Flower class FlowerType(DjangoObjectType): class Meta: model = Flower class Query(graphene.ObjectType): flowers = graphene.List(FlowerType) def resolve_flowers(self, info, **kwargs): return Flower.objects.all() Query { flowers (last: 2){ id } } Result { "errors": [ { "locations": [ { "column": 12, "line": 2 } ], "message": "Unknown argument \"last\" on field \"flowers\" of type \"Query\"." } ] } Do I have to modify the code in Django project? How to resolve it? -
django select only specific fields from many to many field in serializer
My models: class RequisiteItem(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) enrollable = models.ForeignKey(Enrollable, on_delete=models.CASCADE) created_by = models.ForeignKey(ElsUser, on_delete=models.CASCADE) completed_within_days = models.IntegerField() date_completed_by = models.DateTimeField(default=now, editable=False) class Requisite(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) name = models.CharField(default=None, blank=True, null=True, max_length=255) description = models.CharField(default=None, blank=True, null=True, max_length=255) items = models.ManyToManyField(RequisiteItem, blank=True) enrolments = models.ManyToManyField(Enrollee, blank=True) created_by = models.ForeignKey(ElsUser, on_delete=models.CASCADE, related_name="requisites", default=None) timestamp = models.DateTimeField(default=now, editable=False) @property def created_by_user(self): return self.created_by.username Serializer class: class RequisiteSerializer(serializers.ModelSerializer): created_by = serializers.CharField(source='created_by_user') class Meta: model = Requisite fields = ('id', 'name', 'description', 'items', 'enrolments', 'created_by', 'timestamp') read_only_fields = ['id'] depth = 1 I have enrolments ,created by,requisite items which are foreign keys and manytomany fields etc .In my list API i want only specific fileds from the foreign key to be displayed. For example in the created by field, Elsuser is a custom user inheriting from AbstractUser . I want only the username and email fields from this model and not the entire fields. Similar case for the manyto many fields . How do i implement this? -
How to add parameters in a url in render method - Django?
How to add parameters in a url in render method - Django? I'm having difficulty adding pagination to a search result. On the first page the result is shown perfectly, but from the second page onwards, the search parameter no longer exists. thank you. def get(self, request): clientes = Cliente.objects.filter( Q(nome__icontains=request.GET['nome'])) formPesquisa = FormPesquisaCliente() paginator = Paginator(clientes, 40) page = request.GET.get('page') clientes = paginator.get_page(page) response = render(request, 'cliente/index.html', { 'clientes': clientes, 'formPesquisa': formPesquisa}) response['Location'] += '?nome=' +request.GET['nome'] return response -
DateTimeField use calendar input instead of text
I have a DateTimeField that users have to manually type the date and time (YYYY-MM-DD Hour:Minute am/pm) in. I want to be able to use the Django calendar input for users to select a date on that, instead of having to type it in. I believe this can be done through the DateTime form field type, but am not certain. I would greatly appreciate any help with this issue. forms.py class LessonForm(forms.ModelForm): lesson_instrument = forms.ChoiceField(choices=instrument_list, widget=forms.Select(attrs={'class' : 'form-control', 'required' : 'True'})) lesson_level1 = forms.ChoiceField(choices=level_list, widget=forms.Select(attrs={'class' : 'form-control', 'required' : 'True'})) lesson_level2 = forms.ChoiceField(choices=level_list, required=False, widget=forms.Select(attrs={'class' : 'form-control'})) lesson_level3 = forms.ChoiceField(choices=level_list, required=False, widget=forms.Select(attrs={'class' : 'form-control'})) lesson_length = forms.ChoiceField(choices=length_list, widget=forms.Select(attrs={'class' : 'form-control', 'required' : 'True'})) lesson_datetime_start = forms.DateTimeField(input_formats=['%Y-%m-%d %I:%M %p'], widget=forms.DateTimeInput(attrs={'class': 'form-control', 'placeholder':'YYYY-MM-DD Hour:Minute am/pm'})) lesson_datetime_end = forms.DateTimeField(input_formats=['%Y-%m-%d %I:%M %p'], required=False, widget=forms.DateTimeInput(attrs={'class': 'form-control', 'placeholder':'YYYY-MM-DD Hour:Minute am/pm'})) lesson_weekly = forms.BooleanField(required=False) class Meta: model = Lesson fields = ('lesson_instrument', 'lesson_level1', 'lesson_level2', 'lesson_level3', 'lesson_length', 'lesson_datetime_start', 'lesson_datetime_end', 'lesson_weekly') -
<zip object at 0x10101120> error using zip with literal_eval
I am making a movie recommendation app . But when i rate a movie this error comes up SyntaxError invalid syntax (, line 1). REQUEST INFORMATION :GET views.py def rate_movie(request): data = request.GET rate = data.get("vote") print(request.user.is_authenticated) movies = zip(*ast.literal_eval(data.get('movies'))) moviesindxs = zip(*ast.literal_eval(data.get('movies'))) movie = data.get("movie") movieindx = int(data.get("movieindx")) #save movie rate userprofile = None -
Django app working locally but not in Heroku: MarkdownX module cannot be found
To start, I have looked at every single stack overflow question related to this. From updating requirements.txt, pipfile.lock, pipfile, adding to installed apps, etc.. The package works flawlessly locally however crashes on Heroku. From the logs it looks like it is reading the the settings.py and when it gets to "markdownx" it cannot find a module by that name. Im guessing because it is listed as "django-markdownx" in pipfile.lock, requirements.txt, and in pipfile. However when I change the name to "markdownx" in those locations it fails locally. I have spent many hours looking all online to fix this and nothing has worked so any help would be very appreciated. Below are my files. Requirements.txt certifi==2018.11.29 chardet==3.0.4 Django==2.1 django-markdownx==2.0.28 gunicorn==19.9.0 idna==2.8 lxml==4.3.0 Markdown==3.0.1 Pillow==5.4.1 pytz==2018.9 PyYAML==3.13 requests==2.21.0 sorl-thumbnail==12.5.0 urllib3==1.24.1 Pipfile [[source]] name = "pypi" url = "https://pypi.org/simple" verify_ssl = true [dev-packages] django-markdownx = "*" [packages] django = "==2.1" gunicorn = "*" [requires] python_version = "3.7" pipfile.lock { "_meta": { "hash": { "sha256": "e45fc89d2502eac1be6bd0ea7e7189a78db18d760bb7fb386c78350de2271f88" }, "pipfile-spec": 6, "requires": { "python_version": "3.7" }, "sources": [ { "name": "pypi", "url": "https://pypi.org/simple", "verify_ssl": true } ] }, "default": { "django": { "hashes": [ "sha256:7f246078d5a546f63c28fc03ce71f4d7a23677ce42109219c24c9ffb28416137", "sha256:ea50d85709708621d956187c6b61d9f9ce155007b496dd914fdb35db8d790aec" ], "index": "pypi", "version": "==2.1" }, "gunicorn": { "hashes": [ … -
Check the results of one queryset against the results of another queryset django
In my django application I have three models, People, Reviews and File. class People(models.Model): firstname = models.charField(max_length=20) lastname = models.charField(max_length=20) class Reviews(models.Model): STATUSES = ( ('pending', 'Pending'), ('approved', 'Approved'), ('rejected', 'Rejected') ) person = models.OneToOneField(People, on_delete=models.CASCADE, primary_key=True) status = models.CharField(max_length=10, choices=STATUSES, default='pending') comment = models.TextField() class File(models.Model): owner = models.OneToOneField(Reviews, on_delete=models.CASCADE, primary_key=True) comment = models.TextField() issue_date = models.DateField(auto_now_add=True) See that OneToOneField on the File model? I need to be able to filter that dropdown, based on two conditions. It needs to only display records from the Reviews model that have a status of approved. Reviews.objects.filter(status="approved") The displayed results must not already exist in the File model's records. File.objects.all() And also, while creating an instance of the File model, when a value is selected from the dropdown, how could I automatically populate the comment field with the value from the Review model comment field? I can't quite figure it out. -
Django form validation inconsistent after reboot
The following problem is in regards to a codebase I inherited. So, please forgive any lack of details in my description. Please educate me on where I would need to look to begin to solve this issue. The following django message is displayed on a custom admin form. "Select a valid . is not one of the available choices". This bug begins to show 2 or 3 hours after rebooting the server. Meaning we make the bug go away by rebooting the server. I can perform a save on this admin form using the options in the list and values are saved to database and following processes are kicked off as they should be prior to 2 -3 hours after reboot. Then this message begins to appear. This bug shows up only in production. I'm thinking that this could have something to do with cached resources, but I really don't know. So I have a dropdown with choices seemingly populated from a ShipmentType defined in a shipping/constants.py. I've located the "def save()" that is being hit when The correct values are being passed over the wire, and are making it to the save method. There is no logic in the … -
Extending default user using Abstract User
I am trying to add some extra fields in default user model. But the new fields is not showing up in admin page. Here are the models of 'users' app. models.py from django.db import models from django.contrib.auth.models import AbstractUser class CustomUser(AbstractUser): q1 = models.TextField() q2 = models.TextField() forms.py from django import forms from django.contrib.auth.forms import UserCreationForm, UserChangeForm from .models import CustomUser class CustomUserCreation(UserCreationForm): class Meta(UserCreationForm.Meta): model = CustomUser fields = ('username', 'email', 'q1', 'q2') class CustomUserChange(UserChangeForm): class Meta: model = CustomUser fields = ('username', 'email', 'q1', 'q2') admin.py from django.contrib import admin from django.contrib.auth.admin import UserAdmin from .forms import CustomUserCreation, CustomUserChange from .models import CustomUser class CustomUserAdmin(UserAdmin): add_form = CustomUserCreation form = CustomUserChange list_display = ['email', 'username', 'password', 'q1', 'q2'] model = CustomUser admin.site.register(CustomUser, CustomUserAdmin) -
Django Form: Validate line by line
I'm creating a form where user input a bunch of email addresses. What I want to do is to validate the emails line by line in TextField. So what I need to do is to read the input line by line and apply email validator for each line. How could I do it? -
How can I establish a field as unique that is also involved in a relationship?
There is a situation, i need that every "Grade" must be unique in a determinated "Course" and a "Grade" must be unique by itself. I do not know how to do that. I have my models like this: class Grade(models.Model): name = models.CharField(max_length=50, verbose_name=_('Name')) Assignature = models.ManyToManyField(Assignature, verbose_name=_('Assignature')) def __str__(self): return '{}'.format(self.name) And the "Course" model: class Course(models.Model): TYPE_MORNING = 'M' TYPE_EVENING = 'T' TYPE_NIGHT = 'N' TYPE_CHOICES = ( (TYPE_MORNING, _('Morning')), (TYPE_EVENING, _('Evening')), (TYPE_NIGHT, _('Night')), ) type = models.CharField(max_length=1, choices=TYPE_CHOICES, verbose_name=_('Type')) grade = models.ManyToManyField(Grade, verbose_name=_('Grade')) professor = models.ManyToManyField(Professor, verbose_name=_('Professor')) registration = models.ManyToManyField(Registration, verbose_name=_('Registration')) def __str__(self): return '{}'.format(self.type) I would appreciate any kind of help!!! -
Django authentication always fail and return None
I'm using Django to implement registration and login, but meet with some problems here. My environment is Python3.7.2, Django 2.1.5 and Sqlite3. And I'm testing on localhost(127.0.0.1:8000). I tried to create a user with the default functionUser.objects.create_user() , crucial codes are as follows, where userRegID, userRegPassword and userRegEmail are the data got from the frontend: user = User.objects.create_user(username = userRegID, password = userRegPassword, email = userRegEmail) user.first_name = userRegFirstName user.last_name = userRegLastName user.is_active = False user.is_staff = False user.is_superuser = False user.save() The first problem is that the user data created can not be found in the table auth_user in sqlite but I can see it if I login as superuser on admin site. Another problem is that after registration I tried to login, auth.authenticate function always return None. I've confirmed that the user is active on admin site. And I'm sure that the password is correct using check_password. -
I am trying to build a django application that takes a twitter handle as input through a search form and displays the recent tweets
I am trying to build a django application that takes a twitter handle as input through a search form and displays the recent tweets. I managed to build the application, but it is not a single page application, there are two html files index.html and search.html index.html <div class="search"> <form method ="GET" action = "search.html/"> <input name = "q" placeholder = "search.." class="searchTerm"> <button class="searchButton" type = "submit">Search</button> </form> </div> search.html <div class = bg> <div align=center class = 'container'> {% if tweets_for_csv %} <div> <h1>Recent Post LIst For User Handle - {{ username }}</h1> </div> <ul class="w3-ul w3-card-4" style="width:100%"> {% for j in tweets_for_csv %} <li>{{ j }}</li> {% endfor %} </ul> {% else %} <p class = 'center'>No Posts To Display</p> {% endif %} </div> </div> views.py from django.shortcuts import render import tweepy def index(request): return render(request, 'twitter/index.html', {}) def search(request): consumer_key="####" consumer_secret="####" access_token="####" access_token_secret="####" auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_token, access_token_secret) api = tweepy.API(auth) number_of_tweets=200 username = request.GET.get('q') tweets = api.user_timeline(screen_name=username) tmp=[] tweets_for_csv = [tweet.text for tweet in tweets] res = tweets_for_csv[:10] context = { 'tweets_for_csv':res,'username':username, } return render(request, 'twitter/search.html', context) I need to make this a single page application ie. to restrict the page from refreshing and … -
block a button on my side bar until logged in
using django and html how can i block a button on my tab bar until someone is logged in my sidebar: <div id="mySidebar" class="sidebar"> <a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a> <a href="/">Home</a> <a href="/accounts/login">Login</a> <a href="#">Profile</a> <a href="/upload">Upload</a> <a href="/top_photos">Top Photos</a> <a href="/aboutus">About Us</a> <a href="/contact">Contact Us</a> </div> block statement: {% block content %} {% if user.is_authenticated %} <h1 style="text-align:right">Welcome {{ user.username }}!</h1> {% else %} <div class="c"> <p>You are not logged in, log in to recolor a photo</p> <a href="/upload"> {% endif %} {% endblock %} -
jQuery "error: can't read property of split of undefined"?
I have an HTML page that has <select> inputs that are dynamically made with Django Templates. I need to loop through these <select> elements with a $('.select_input).each loop, but I can't seem to get it to work. filters = [(0, 'foo'), ('1', 'a', '10'), ('2', 'b', '11') (0, 'bar'), (3, 'c', '12'), ('4', 'd', '13') ... ] myPage.html: <form method="POST" action="/" id="myform"> <input type="submit" id="search"> {% for f in filters %} {% if f.0 == 0 %} </select> <input type="hidden" id="{{'input_'|add:f.1 }}" name="{{ f.1 }}"> <select id="{{ select_|add.1 }}" class="selectpicker select_input" multiple data-selected-text-format="count" data-style="btn-info" title="{{ f.1 }}"> {% elif f.0 != 0 %} <option value="{{ f.2 }}">f.1</option> {% endif %} {% endfor %} </select> </form> myPage.js: When I try this, it seems to work: $(#search).on('click', function() { event.preventDefault(); $('.select_input').each(function() { var elem = $(this).attr('id'); console.log(elem);//prints select_foo }); }); But as soon as I try to do anything to the $('.select_input), other than console.log, it stops working. $(#search).on('click', function() { event.preventDefault(); $('.select_input').each(function() { var elem = $(this).attr('id'); //prints undefined console.log(elem); var t = elem.split('_'); //error: cannot read property split of undefined var t = elem.toString(); //error: cannot read property toString of undefined }); }); What am I missing here? Note: I … -
How do I checkpoint a django sqlite3 database?
I have a sqlite3 django database that is using WAL. In operation there are typically three files present: db.sqlite3, db.sqlite3-shm, db.sqlite3-wal. To conveniently back up the database (when the service is stopped), I'd like to create a management command to checkpoint the sqlite database in order to write all the changes into db.sqlite3 and delete the other two files. While sqlite3 has a checkpoint API, I don't know how to access this from django (or python's sqlite3 module) -
How do I have one address field in django?
I have shopping app that lists stores by address. Currently, user address is 5 fields: building number and street name, city, state, zip code and county. I’d like now to have one address field in the front end to be able to add auto complete feature. But store the address in the fields above. I am using react.js for front end. -
Comparing url path in Django 2 middleware
I am need to develop a Django middleware and created class like this: import re from django.conf import settings from django.shortcuts import redirect from django.contrib.auth import logout class LoginRequiredMiddleware: def __init__(self, get_response): self.get_response = get_response def __call__(self, request): response = self.get_response(request) return response def process_view(self, request, view_func, view_args, view_kwargs): assert hasattr(request, 'user') path = request.path_info print(path) p = path.lstrip('/') compiled_login_url = re.compile(settings.LOGIN_URL) if not request.user.is_authenticated: if path == '/': print("==============> INDEX PAGE") Now here, I want to compare the path of urls. I have to determine if path match with settings.LOGIN_URL or not. I have tried using regular expressions, but they did no help. Here are my urls urlpatterns = [ path('admin/', admin.site.urls), path('', views.index, name='index'), path('<slug:slug>/', include('app.urls')), path('<slug:slug>/accounts/login/', include('app.urls')), path('<slug:slug>/accounts/logout/', include('app.urls')), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) I want to exempt login and logout from being checked in middleware also I need slug. -
How to make a Django contact me form with send_mail?
I tried to use 6 different tutorials to get this done, but all of them gave different variations so I'm really frustrated at the pace I'm making... I think I'm nearing the last few steps but I need some help. Here is the code I have in my Django project: # -- settings.py-- EMAIL_BACKEND = 'django.core.mail.backends.stmp.EmailBackend' EMAIL_HOST = 'http://smtp.gmail.com/' EMAIL_HOST_USER = 'a spare Gmail I have' EMAIL_HOST_PASSWORD = 'the password' EMAIL_USE_TLS = False EMAIL_PORT = 465 .. # -- views.py -- # (assumed relevant imports are imported) class ContactView(FormView): template_name = 'CONTACT.html' form_class = ContactForm success_url = 'Success!' context_vars = { 'example_name_f': 'Adam', 'example_name_l': 'Smith', 'example_email': 'smith.a@gmail.com', 'example_subject': 'Sales proposal', 'example_text': 'Hi Mark, I have a sales proposal for you!', } def get(self, request): return render(request, 'CONTACT.html', ContactView.context_vars) def contact(self, request): if request.method == 'POST': form = self.form_class(data=request.POST) if form.is_valid(): time = request.POST.get('time', '') first_name = request.POST.get('first_name', '') last_name = request.POST.get('last_name', '') email_address = request.POST.get('email_address', '') subject = request.POST.get('subject', '') text = request.POST.get('text', '') send_mail(subject, text, email_address, ['999@outlook.com'], fail_silently=False) return redirect('CONTACT-done.html') # CONTACT-done is a temporary success screen return render(request, 'CONTACT.html', ContactView.context_vars) The relevant portion of HTML: <div class="container-fluid" style="width: 100%; height: 100%"> <form action="" method="post"> <label for="first-name">First Name</label> <input … -
Django Admin custom format field
Code snippets: class HighscoreAdmin(admin.ModelAdmin): list_display = ('name', 'score') ... and class Highscore(models.Model): name = models.CharField(max_length=128) score = models.PositiveIntegerField(default=0) ... Question: Let's say we have a score value of 100000. In Admin, it will display the score as 1000000, but what if I want a different format? How would you change the format to output -> 1,000,000? I heard that you could add a method to the Highscore class something like foo_display, where foo is the field in question: def score_display(self): """ returns scores with commas as thousands separators in the admin display """ return '{:,}'.format(self.score) -
How do I iterate through a dictionary in Django Templates?
I am trying to iterate through a dictionary in my django template and save the values to window.obj, but it is not working. views.py: def myView(req): ... myDict = {'foo':"[1,2]", 'bar':"[3,4]"} return render(req, 'myPage.html', {'myDict':myDict}) myPage.html: <script type="text/javascript"> window.obj = {} window.obj["foo"] = "{{ myDict.foo }}"; {% for key, value in myDict %} window.obj["{{ key }}"] = "{{ value }}"; {% endfor %} </script> ... <script> console.log(window.obj.foo); //prints {foo: "[1,2]"} console.log(window.obj.bar); //prints undefined </script> Note: I can't use myDict.foo on my actual project What am I missing here? -
Checkbox input selection using Python/Django
I am trying to get total number of votes based on user's input checkbox selection and pressing submit button. Votes should appear on "results-container" after votes being added up. I am not able to grab the list of names of the checkboxes being selected. Here is what I have so far: In models.py, class Submission(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) name = models.CharField(db_index=True, max_length=100, verbose_name="resource name", help_text=help_texts['name']) class Vote(models.Model): submission = models.ForeignKey('Submission', related_name='votes', on_delete=models.CASCADE, null=True) In Views.py, def Feedback_page(request): submissions = Submission.objects.all() selected_submission = None if request.method == 'POST': # Get the list of checked Submissions. selected_submission = request.POST.getlist('submission_id') print(selected_submission) submissions_by_vote_count = Submission.objects.filter(name).annotate(vote_count=Count('votes')).order_by('-vote_count') total_votes = submissions_by_vote_count.aggregate(Count('votes'))['votes__count'] print(total_votes) context = { 'submissions_by_vote_count': submissions_by_vote_count, 'total_votes': total_votes, 'submissions':submissions, 'selected_submission':selected_submission, } return render(request,'feedback_page.html', context) In html page, <div> <p class="feedback-question">Available tools ?</p> <form id="submission_form" method="POST"> <ul class="vertical"> {% for submission in submissions_by_vote_count %} <div class="submission_list"> <div class="submission_info"> <input class="submission_name" name="submission_id" type="checkbox" value="{{submission.id}}" id="{{submission.id}}" {% if submission.id in selected_submission %}checked{% endif %}> {{submission.name}} <br/> <span class="faq-t"></span> </div> <span class="submission_description">{{submission.credits|safe}}</span> <p class="submission_description">{{submission.description|safe}}</p> </div> {% endfor %} </ul> </form> </div> <div class="vote_button"> <input id="vote_send" type="submit" class="hollow button" value="Submit" /> </div> <br/> <div class="result-container" style="display:none;"> <h3 class="feedback_title">Tools</h3> <ul class="tool_list"> {% for submission in submissions_by_vote_count %} <li> <p> votes: … -
Non Boolean comparisons in flow.switch().case()
I have a standar viewflow flow process, in one of the states id want to split my proccess based on the text value that is introduced in one of the fields. I have defined my field of interest this way in models.py estado_de_aprobacion= models.CharField(max_length=15, choices=REVIEW_CHOICES) my choices: REVIEW_CHOICES = ( ('APROBACION_FINAL', 'Aprobar definitivamente'), ('APROBACION_NUEVO_REVISOR', 'Enviar a otro revisor'), ('DEVOLVER_EJECUTOR','Devolver al ejecutor') ) so basically what happens is that a drop list is displayed so the user can choose one of the options, and based on that I appliy the followinf split in the flow: split =( #If(lambda activation: activation.process.aprobacion_final) flow.Switch() .Case(this.end, cond=((lambda act: act.process.estado_de_aprobacion)=='APROBACION_FINAL')) .Case(this.revisor_check, cond=((lambda act: act.process.estado_de_aprobacion)=='APROBACION_NUEVO_REVISOR')) .Case(this.ejecutar, cond=((lambda act: act.process.estado_de_aprobacion)=='DEVOLVER_EJECUTOR')) ) I assume that the lamba expression returns the value contained in the specified proccess atributes but since the comparisson isn't working im thinking its wrong.