model-view-controller

Flask MVC with Circular Dependency (dependency injection?)

Flask MVC with Circular Dependency (dependency injection?) Question: I’m trying to create models to form the mvc in flask but it’s marked as a circular dependency (db in init), I even removed the models to test and put them in for the controllers to use the bank, but the result was the same, what could …

Total answers: 1

How to Create a Profile to an user

How to Create a Profile to an user Question: im relative new to django, before i only created simple applications that did not require any user stuff, now however i need to create a website with users, for now i created user register, log in and log out, but im struggling to create the profile …

Total answers: 1

Getting error: TypeError: module() takes at most 2 arguments (3 given)

Getting error: TypeError: module() takes at most 2 arguments (3 given) Question: I started learning the MVC pattern and started writing code according to this pattern but I don’t understand what is my mistake. When I try to run the program it shows me: line 143, in <module> class App(tkinter): TypeError: module() takes at most …

Total answers: 1

PyQt5 – Copy QObject child

PyQt5 – Copy QObject child Question: I have a pyqt5 app with an MVC structure similar to the one described here. When the model is edited, a pyqtSignal is emitted, after which the controller will update the view (and, of course, the other way around). To enable the use of pyqtSignals, the model class inherits …

Total answers: 1

Django 404 Error, views not found. Why? View is not show up or is not found

Django 404 Error, views not found. Why? View is not show up or is not found Question: I programmed in Ruby beforehand and am now moving to Django. I am trying to follow the article here. https://docs.djangoproject.com/en/4.0/intro/tutorial01/ #polls/url.py from django.urls import path from . import views urlpatterns = [ path(”, views.index, name=’index’), ] # mysite …

Total answers: 3

Django "NameError: name 'Album' not defined"

Django "NameError: name 'Album' not defined" Question: I am trying to run see and manipulate a simple django database but the error from the Django Shell is saying one of my models isn’t defined. Most of the questions with errors similar to mine are due to people referencing a model before declaring it. However, I’m …

Total answers: 4

Django: access the model meta class value

Django: access the model meta class value Question: I have some model classes defined: class ModelA(models.Model): class Meta: abstract = True class ModelB(ModelA): class Meta: abstract = False So, now I have a class object, I want to check if it is abstract, is there any way to do this? For example, I want something …

Total answers: 2

MVC the simplest example

MVC the simplest example Question: I’m struggling to understand the MVC pattern. I’ve been working with MVC frameworks like ASP.NET MVC and Django, but project structure there is pretty much forced, so it really didn’t help to understand how to build my own apps based on this pattern. To clear things up i decided to …

Total answers: 2

MVC design with Qt Designer and PyQt / PySide

MVC design with Qt Designer and PyQt / PySide Question: Python newbie coming from Java (+SWT/Windowbuilder) and am having difficulty working out how to properly code a large desktop app in Python/Qt4(QtDesigner)/PySide. I would like to keep any view logic in a controller class outside the .ui file (and it’s .py conversion). Firstly as then …

Total answers: 1

Separation of business logic and data access in django

Separation of business logic and data access in django Question: I am writing a project in Django and I see that 80% of the code is in the file models.py. This code is confusing and, after a certain time, I cease to understand what is really happening. Here is what bothers me: I find it …

Total answers: 10