mvc – The right place for “app logic” in MVVM context

I hope this is the right place to ask.

I’m an experienced developer, and have used MVC for much time.
This question is in the context of iOS/macOS development for the most part, (SwiftUI).

Using MVC in iOS I always found the paradigm and architecture simple.

  • Views contained view related code (layout and reactive code)
  • Models were just stores
  • Controllers populated models, did all the business/app logic, held references to the the objects that did work (network handlers, data parsers, business logic)

In MVVM, (used in SwiftUI) I’m really struggling with where to put this code.

I see the right approach as:

  • Models are still stores they are dumb and get populated by the ViewModel
  • Views are pure in terms of their purpose, UI code only, declarative
  • ViewModels (I think) hold the logic, have references to objects that do the work, get results from these objects and populate the model, let the view know when things change.

Do I have this right, if not, where does the “controller code” go in MVVM?

magento2 – Magento 2 add custom field in checkout place order

Need to add new custom validation on the checkout page before place order.

enter image description here

The place order should work only when the calculation shown above is correct and also to show different values to sum.

I have override Magento_Checkout/view/frontend/web/templates/payment.html to show this field but I couldn’t add the validations

forms – How should I place 3 equally important CTA buttons?

This is an airport transfer quotation form I’ve created.

quotation form

The user will first select the pick up, destination and number of passengers.

Then, they will retrieve the type of vehicle, price and estimated time.

At this point and if the user desires, I ask the user to take the following actions:

  1. Add a return transportation or another transportation
  2. Enter they’re email address and get a 2 euro discount
  3. Continue with the booking

Since these actions are completely different from each other I’m not sure if it’s correct to place them on the bottom of the form. Are there any better practices for this kind of request? What is the best location for these?

A live example of this form can be found at www.simontaxi.com

pakistan – Karachi : any place I can visit with my wife in this lockdown?


Your privacy


By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.




Which module available in the place of Commerce coupon fixed amount in drupal 8

I have a website in drupal 7 where I am using module Commerce coupon fixed amount

Now I want to migrate my website into Drupal 8 but this module is not available in drupal8.

Which module I need to use in place of this module in Drupal 8

Favourite Fast-Food Place?

Mine are A&W, Valentine’s and McDonald’s. How about you?

sharepoint online – JSON column formatting “number” without decimal place and 1000 separator as “.”

I have a SharePoint list where a column contains numbers but those numbers are shown as:

Example: “1,181,180” instead of “1181180” (this is what I need).

I created the list importing from excel.

How can I format this column so I can see it without decimal places and 1000 separator as “.” using JSON?

django – TemplateView looks for the template in a different place than ListView / DetailView / CreateView?

So I’m trying to show the homepage template with templateView but it confused me a lot. Right now I have 3 apps (main, users, polls). With the following structure:

.
├── main
│   └── ...
├── (Project Folder)
│   └── ...
├── polls
│   └── ...
├── users
│   └── ...
└── templates
    ├── main
    │     └── ...
    ├── polls
    │     └── ...
    └── base.html (for extends)

I already have some views from polls working (CreateView, ListView, DetailView). I know that the templates for default are searched inside the app folder but I changed it to have it at the level of the apps as you can see above.

But with this new app (main) where I have the index view, it doesn’t work the same. The index.html is searched in templates/index.html and not in templates/main/index.html. Why with the polls app works by having a folder with the app name inside templates but with main don’t work like that?

Settings.py

TEMPLATES = (
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': (os.path.join(BASE_DIR, 'templates')),
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': (
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ),
        },
    },
)

main views.py

# Django imports
from django.views.generic import TemplateView

class Index(TemplateView):
    template_name = 'index.html'

main urls.py

from django.contrib import admin
from django.urls import path, include

urlpatterns = (
    path('admin/', admin.site.urls),
    path('', include('main.urls')),
    path('', include('users.urls')),
    path('', include('polls.urls')),
)

theme – Proper Place to Add CSS in Magento2 and Magento only Showing CSS Changes when Clearing Browser Cache?

I am trying to modify some CSS files in my Porto theme in Magento 2.3.5pt-2. When modifying the CSS in pub/media/porto/web/css/custom.css I am not seeing any changes. I am in developer mode, I have run static content deploy and cleared cached but nothing shows on frontend until I clear my browser cache. Is there a better way to modify CSS in Magento2 with out having to clear browser cache every time?

I am modifying the CSS in pub/media/porto/web/css/custom.css. Should I be modifying these theme CSS files somewhere else like in app/design/frontend/Smartwave/porto? Where is the best place to add CSS to modify your theme?

Trying to add this CSS

.sidebar .product-items .product-item-info .product-item-photo { width: 100%; }
.sidebar .product-items .product-item-info .product-item-photo img { max-width: 100% !important; width: 100%; }
.block.related .owl-stage, 
.block.related .owl-stage .owl-item { width: 100% !important; }

.products.list .product-item-photo a { display: block; }

.page-products .product-image-photo.default_image {
    width: 100% !important;
}

.category-image img  {
    width: 100% !important;
}

Change in my dev environment are only reflected until clearing browser cache. Any help would be much appreciated.

spain – Get invitation letter and then find a place to rent

We are making an invitation letter for a friend (from Tunisia) to stay with us (in Spain) while she works as an intern, we already have the invitation letter from the company, but we still lack one of the requirements for the student visa (more than 90 days), which is a place to stay. For the moment she’s gonna stay with us, but if she’s able to afford it, and get a place for her own during her stay, would that be possible?, do we have to notify the police department? Because the invitation letter states she’s gonna stay with us for that period. What kind of problems can we have? Thanks