Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to show a rating of Related Products
Learning Django with tutorial. On the page "Product" is displayed rating for this product. There are also Related Products and I can't understand the logic to show the rating of each Related Products. product-detail.html {% extends 'base.html' %} {% load static %} {% block content %} <main class="container my-4"> <h3 class="my-4 border-bottom pb-1">{{data.title}}</h3> <div class="row"> <!-- Images --> <div class="col-md-4"> <img id="zoom_01" data-zoom-image="/media/{{data.image}}" src="/media/{{data.image}}" class="card-img-top" alt="{{data.title}}"> </div> <div class="col-md-8"> <p>{{data.detail}}</p> <hr/> <table class="table table-bordered"> <tr> <h6>Цена</h6> <h6>$ <span class="product-price-{{data.id}}">{{data.price}}</span></h6> </tr> </table> <hr/> <div class="input-group my-3" style="width:30%;"> <input type="number" value="1" class="form-control product-qty-{{data.id}}" id="productQty" /> <div class="input-group-append"> <input type="hidden" class="product-id-{{data.id}}" value="{{data.id}}" /> <input type="hidden" class="product-title-{{data.id}}" value="{{data.title}}" /> <input type="hidden" class="product-image-{{data.id}}" value="{{data.image}}" /> <button class="btn btn-primary btn-sm add-to-cart" data-index="{{data.id}}" type="button" id="addToCartBtn"><i class="fa fa-shopping-cart"></i> Add to cart</button> </div> </div> </div> </div> <hr /> ..... <!-- Reviews --> <div class="col-md-6"> <h3 class="my-3">Reviews - <span class="avg-rating">{{avg_reviews.avg_rating}}</span>/5 <i class="fa fa-star text-warning"></i> {% if user.is_authenticated %} {% if canAdd %} <button type="button" data-toggle="modal" data-target="#productReview" class="btn btn-warning bt-sm float-right reviewBtn">Add review</button> {% endif %} {% endif %} </h3> <div class="card"> <div class="card-body review-list" style="max-height: 400px; overflow; auto;"> <!-- Detail --> {% if reviews %} {% for review in reviews %} <blockquote class="blockquote text-right"> <small>{{review.review_text}}</small> <footer class="blockquote-footer">{{review.user}} <cite title="Source Title"> … -
create custom audit table using django-auditlog library
So in our project we are already using auditlog library for auditing in silo project. A new requirement has came up where i have store audit of some tables in a different table than created by this library. I am not able to do so. I have tried multiple things but still stuck on this I tried making a Logentry which inherits Logentry and tried to register it but its not working. code: class ModelLogEntry(LogEntry): # objects = LogEntryManager() mymodel = models.ForeignKey(Followers, on_delete=models.CASCADE) class Meta(object): db_table = 'myapp_mymodellogentry' # f = Followers() auditlog.register(Followers,ModelLogEntry)``` In this code, I want to audit every update, create or delete functionality for followers table and that audit will be stored in myapp_mymodellogentry table -
Is there a nice one-liner to provide a default value if the variable is NoneType?
There is a possibility that I am searching under wrong keywords, but I can't find the answer to the question: Is there a nice one-liner to provide a default value if the variable is NoneType? def validate_quantity(self, value): instance = self.instance diff = value - instance.quantity results in error: unsupported operand type(s) for -: 'decimal.Decimal' and 'NoneType' I know get() attribute which works like that: smth.get('quantity', 200) but instance Object does not have this attribute. -
Why does PyCharm highlight the urlpatterns in Django?
pycharm_screenshot The Context Actions menu suggests nothing. I expect it to not highlight the routes "admin/" and "challenges/" -
Django hosted postgresql database requirements
I'm running a postgresql database on digital ocean for my multi-tenant django application and it's running incredibly slow. It's taking a good 5-8 seconds to changed views. I using quite a few requests before page, so I'm unsure on how powerful the postgresql server needs to be but currently the specs are. 2 GB RAM / 1vCPU / 25 GB Disk How much more RAM/CPU power do I need to see a decent increase in request speed? Note: I'm using async on all views that aren't Class Based (3-4) -
How do I Secure a `credential.json` file in a Production Server
I am connecting to a google service via a (downloaded)credential.json file, following is my snippet: from google.oauth2 import service_account GS_CREDENTIALS = service_account.Credentials.from_service_account_file( os.path.join(BASE_DIR, 'credential.json')) this is working perfectly, however I want to to use the file in my production server, but I know it is not a good practice to upload API file/key to a production server, I am using python-decouple package to store my other keys, and using it as environment variables in the production server. My question is how do I use a 'file' and its key contents securely in a production server? I tried using python-decouple package, it works perfectly on individual keys, but on files I cannot managed to make it work. -
How to prevent `bootstrap_field` from wrapping the field in a `div`?
Here's a form field: my_field = forms.CharField( max_length=255, widget=forms.TextInput( attrs={'placeholder': 'My field', 'class': 'form-control'} ), label='', ) here's how the template looks like: <form> {% csrf_token %} {% bootstrap_field form.my_field %} </form> which wraps the field in a mb-3 div. Here's how it's rendered: <form> <input type="hidden" name="csrfmiddlewaretoken" value="8SKOXF9pDtfhlTuuMf9NSGxISpakORHHh3sQdNH2Um9havzCUh8gZOKp248eKjRE"> <div class="mb-3"> <input type="text" name="my_field" placeholder="My field" class="form-control" maxlength="255" title="" required="" id="id_question"> </div> </form> This is how I want it to be: <form> <input type="hidden" name="csrfmiddlewaretoken" value="8SKOXF9pDtfhlTuuMf9NSGxISpakORHHh3sQdNH2Um9havzCUh8gZOKp248eKjRE"> <input type="text" name="my_field" placeholder="My field" class="form-control" maxlength="255" title="" required="" id="id_question"> </form> -
Django and SQL Q
What is the meaning of the following? This is a Django project sql = 'select * from tb_music where songlx = "{0}" ORDER BY RAND( ) limit 0,1'.format(key) What is the meaning of the following? This is a Django project -
Django date filter failing to execute right after midnight or 12am
I have a django project that allows a user to only create 8 objects per day and its filtering using __day but it seems between oo:oo and 01:59 the programs is allowing users to create unlimited objects. today = datetime.today() day = today.day task_limit_enabler = False task_limit = MyRate.objects.filter(user = request.user, date_created__day = day).count() if task_limit < 8: task_limit_enabler = True -
Django form is not saving into the db
I'm developing a django project where I need to collect data for a student pass application the view.py is as follows def BusPassForm(request): school = admindb.SchoolDetail.objects.all() place = Place.objects.all() subtime = SubTime.objects.all() if request.method == 'POST': name = request.POST.get("name") age = request.POST.get("age") dob = request.POST.get("dob") mobile = request.POST.get("mobile") adhaar_no = request.POST.get("adhaar_no") address = request.POST.get("address") school_name = request.POST.get("school_name") start_place = request.POST.get("start_place") end_place = request.POST.get("end_place") time_periode = request.POST.get("time_periode") profileimage = request.POST.get("profileimage") idimage = request.POST.get("idimage") adhaar_image = request.POST.get("adhaar_image") try: buspassform = PassForm(name=name, age=age, dob=dob, mobile=mobile, adhaar_no=adhaar_no, address=address, school_name=school_name, start_place=start_place, end_place=end_place, time_periode=time_periode, profileimage=profileimage, idimage=idimage, adhaar_image=adhaar_image) buspassform.save() messages.success(request, 'application submitted') return redirect('dash') except: messages.error(request, 'Error in submitting your appliction') return redirect('buspassform') print(form.error) return render(request, 'buspassform.html', {'school':school, 'place':place, 'subtime':subtime}) the models.py for the same as follows class PassForm(models.Model): name= models.CharField(max_length=100, default=None) time_periode = models.ForeignKey(SubTime, on_delete = models.CASCADE, default=True) school_name = models.ForeignKey(admindb.SchoolDetail, on_delete = models.CASCADE, default=True) start_place = models.ForeignKey(Place, null=True, blank=True, on_delete =models.CASCADE, related_name="pass_start") end_place = models.ForeignKey(Place, null=True, blank = True, on_delete = models.CASCADE, related_name = 'pass_end') age = models.IntegerField(blank=True, null=True, default=True) dob = models.DateField(default=datetime.date.today) address = models.TextField(max_length=100, blank=True, null=True) adhaar_no = models.CharField(max_length=200, null=True, blank=True) mobile = models.CharField(max_length=200, blank=True, default=None) idimage = models.ImageField(upload_to='static/ksrtcimage/idimage', null=True, default=None) adhaar_image = models.ImageField(upload_to='static/ksrtcimage/adhaar', null=True, default=None) profileimage = models.ImageField(upload_to='static/ksrtcimage/profileimage', null=True, default=None) the urls.py … -
Is it possible to add a Push/Refresh view to Browser#1 when order is placed on Browser#2 in Django?
I'm creating a kitchen app/order app. And I'm trying to make the kitchen browser page refresh when an order is placed from another browser. Is this even possible? I know Django can use Signals to track events, but can those events trigger a refresh on another browser? -
DJANGO: Create User in 'core' app when Contact created in 'other' app using Signals
I want to create a User in a separate app called 'core' when a Contact is created in an app called 'bookings'. I'm having trouble configuring the signal to handle this. Currently, using the signal I'm checking if the User exists and either assigning the existing User to the Contact instance OR creating a new User and assigning. I've tried setting the user attribute to allow null, and blank, etc. I keep getting the below warning: IntegrityError at /bookings/contacts/ null value in column "user_id" of relation "bookings_contact" violates not-null constraint DETAIL: Failing row contains (18, tesing@testing.com, 5555555, null). bookings.models.py from django.db import models from django.conf import settings from django.contrib import admin import datetime # Create your models here. class Contact(models.Model): email = models.EmailField(max_length=255, null=True, blank=True) phone = models.CharField(max_length=255, null=False, blank=True) user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, null=False, blank=True) def __str__(self): return f'{self.user.first_name} {self.user.last_name}' # Pulls "first_name" from User AUTH_USER_MODEL found in core.models.py # Adds ability to sort by first_name in admin panel @admin.display(ordering='user__first_name') def first_name(self): return self.user.first_name # Pulls "last_name" from User AUTH_USER_MODEL found in core.models.py # Adds ability to sort by last_name in admin panel @admin.display(ordering='user__last_name') def last_name(self): return self.user.last_name class Meta: ordering = ['user__first_name', 'user__last_name'] core.models.py from django.contrib.auth.models import AbstractUser … -
Css file is not linked to html in django app when deployed with Hostinger
I am a beginner in Django, I am building a web app that works good in local, but when I deploy to Hostinger with FileZilla, the css "stylee.css" is not well linked to the html. index.html <link rel="stylesheet" type="text/css" href="{% static 'css/stylee.css' %}"> I tried several combinations of paths, but it didn't work. Here is my file architecture : `/templates index.html /static /css stylee.css ` Thank you. I tried adding this to my settings.py file : ` STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static') STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'static_assets'), ) STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', )` I also tried changing the files permissions on Hostinger But it did not work. -
Django ValidationError not being raised, causing clean() to return None
I have the following form fields on a ModelForm subclass: forms.py class ProjectUpdateForm(ModelForm): start_date = DateField(...) due_date = DateField(label="Due Date", required=True, widget=CustomDatePicker(), validators=[validate_not_past]) def clean(self): super().clean() # Problem: this isn't this raising a ValidationError... start_date = self.cleaned_data.get('start_date') due_date = self.cleaned_data.get('due_date') if start_date > due_date: # ...instead getting a TypeError from this line! raise ValidationError("Project Start Date cannot be after Project End Date") validators.py def validate_not_past(value): today = datetime.date.today() if value and value < today: raise ValidationError('This date cannot be in the past.', code='invalid') Anytime that I enter a date in the past, the applications throws a TypeError: '>' not supported between instances of 'datetime.date' and 'NoneType' (see comments above for clarity). After attempting to troubleshoot, the POST data comes in fine from the form. The problem occurs because run_validators() is raising the ValidationError triggered by the validate_not_past, validator (above) as expected. However, rather than raising the ValidationError, the self.cleaned_data dictionary just doesn't get a due_date key. I can't figure out why I'm not getting a ValidationError raised. I can't find code elsewhere that catches it. Thanks in advance. -
How to use selenium on extracting data and adding them to django database?
I'm new to Django and have no idea how it works with all those files. Right now I'm trying to use selenium to extract some data from a website and adding them to the database created on my Django project. I used w3schools tutorial for Django (blame them if I don't understand anything :) ) and right now I'm at this stage: https://www.w3schools.com/django/django_insert_data.php But I want to use selenium and extract data from a website and add them to the database, but I have no idea how to do it. Anything can help. Please save me... -
Swifter error "AppRegistryNotReady: Apps aren't loaded yet." with Django models
I'm trying to populate a database with django models and I've used the Swifter structure to parallelize a pandas apply, like this: df.swifter.force_parallel(enable=True).apply(lambda row: migrate(row), axis = 1) When apply function loaded 1000 objects into database it gave me "AppRegistryNotReady: Apps aren't loaded yet." error. -
Django detailview in bootstrap modal
How i can get detail view in bootstrap5 modal? (Without jquery please). Modal opens from link(no from button). -
Django: create groups with permissions
I'm trying to create a UserRank model that have a field called group, group is related to a specific group with permissions. The Code models.py: # Create your models here. class UserRank(models.Model): rank_name= models.CharField(max_length=50, unique=True) group = models.OneToOneField(Group, blank=True, null=True, on_delete=models.SET_NULL) singals.py: @receiver(post_migrate) def create_rank_group(sender, **kwargs): # Create UserRank objects boss_rank, _ = UserRank.objects.get_or_create(role_name='boss') first_hand_role, _ = UserRank.objects.get_or_create(role_name='first hand') # Create Group objects for each UserRank boss_group, _ = Group.objects.get_or_create(name='boss') first_hand_group, _ = Group.objects.get_or_create(name='first hand') # Assign permissions to each Group boss_permissions = Permission.objects.filter(codename__in=['add_user','delete_user',]) first_hand_permissions = Permission.objects.filter(codename__in=['add_place', 'delete_place',]) # Set (connect) the permissions to each Group boss_group.permissions.set(boss_permissions) first_hand_group.permissions.set(first_hand_permissions) # Assign each Group to the appropriate UserRank boss_rank.group.set(boss_group) first_hand_role.group.set(first_hand_group) The Problem The error I got when I run the code: boss_role.group.set(boss_group) ^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'set' -
Why is this template not rendering when I have cripsy forms installed?
I'm having trouble rendering a template for a signup.html page in django. The error consists of: TemplateDoesNotExist at /accounts/create/ Error during template rendering In template [PATH_NAME]\cryptoProj\backend\templates\signup.html, error at line 21 bootstrap4/uni_form.html Line 21 is: <p>{{ form | crispy }}</p> The full file is: {% load static %} {% load crispy_forms_tags %} {% block metadescription %} Sign up to get a new account with us. The perfect solution to buy and sell your Cryptocurrencies. {% endblock %} {% block title %} Create a New Account - Crypto Dashboard {% endblock %} {% block content %} <div> {% if not form.is_valid %} <div class="mx-auto"> <br> <h1 class="my_title text-center">Create a new account</h1> <br> <div class="col-9 col-sm-9 col-md-6 col-lg-5 mx-auto bg-light"> <br> <p>Enter the following information to create a new account.</p> <form method="post"> <p>{{ form | crispy }}</p> {% csrf_token %} <button type="submit" class="btn btn-secondary">Register Account</button> </form> <br> </div> </div> {% else %} <div class="mx-auto"> <br> <h1 class="my_title text-center">Your account has been successfully created</h1> <br> <div> <p> Dear Customer, <br> <br> Your account has been created and it is ready to use. <br> </p> </div> </div> {% endif %} </div> <br> {% endblock %} I have crispy forms pip installed and added to installed_apps … -
Celery worker not handling streaming data properly
I am running a streaming task inside a celery worker which is giving me 1 minute candle stick data and then I'm converting that 1 minute incoming data to 5 minute data but this task always starts giving some wierd output after sometime but works fine when I run it on jupyter notebook separately. df = pd.DataFrame(columns=['time', 'open', 'high','low','close']) df.set_index('time', inplace=True) cache.set('df', df) df_5min=pd.DataFrame() cache.set('df_5min',df_5min) max_strategy_run=2 cache.set('max_strategy_run', max_strategy_run) @shared_task(name="strategy_1",queue='strategy_1_queue') def strategy_1(): client = easy_client( api_key='', redirect_uri='', token_path='') stream_client = StreamClient(client) strategy=Strategy.objects.filter(name="strategy_1").first() stock_symbol=strategy.stock.symbol async def read_stream(): await stream_client.login() await stream_client.quality_of_service(StreamClient.QOSLevel.FAST) async def print_message(message): #global df #global df_5min #global max_strategy_run #global place_order_data if message['service']=='CHART_EQUITY': df=cache.get('df') df_5min=cache.get('df_5min') max_strategy_run=cache.get('max_strategy_run') if max_strategy_run==0: await stream_client.chart_equity_unsubs([stock_symbol]) await stream_client.level_one_equity_unsubs([stock_symbol]) if df.shape[0]==0 and datetime.datetime.fromtimestamp(message['content'][0]['CHART_TIME']/1000).minute%5!=0: pass else: df = df.append({ 'time': datetime.datetime.fromtimestamp(message['content'][0]['CHART_TIME']/1000), 'open': message['content'][0]['OPEN_PRICE'], 'high': message['content'][0]['HIGH_PRICE'], 'low': message['content'][0]['LOW_PRICE'], 'close': message['content'][0]['CLOSE_PRICE'], },ignore_index=True) print(json.dumps(message, indent=4)) if df.shape[0]==5: df.set_index('time', inplace=True) df = df.resample('5T').agg({'open': 'first', 'high': 'max', 'low': 'min', 'close': 'last'}) df_5min=copy.deepcopy(df) print('New DataFrame (5 minute):\n', df_5min) if df_5min.loc[df_5min.index[0],'open']>df_5min.loc[df_5min.index[0],'close']: max_strategy_run=max_strategy_run-1 option=await getOptionSymbol(client,message['content'][0]['key']) print(option) place_order_data = await placeOrderDataStrategy1(option,df_5min) print(place_order_data) df.drop(index=df.index, inplace=True) await stream_client.chart_equity_unsubs([stock_symbol]) await stream_client.level_one_equity_subs([stock_symbol]) else: df.drop(index=df.index, inplace=True) cache.set('df',df) cache.set('df_5min',df_5min) cache.set('max_strategy_run', max_strategy_run) elif message['service']=='QUOTE': df=cache.get('df') max_strategy_run=cache.get('max_strategy_run') df_5min=cache.get('df_5min') print(message)w if max_strategy_run==0: message['content'][0]['LAST_PRICE']=12345678 if ((datetime.datetime.now() - df_5min.index[0]).total_seconds() / 60)<20: try: if message['content'][0]['LAST_PRICE']<df_5min.loc[df_5min.index[0],'low']: # here we'll place order … -
FactoryBoy related factory objects not available in post_generation
I have a factory for a Django model (Questionnaire) where I create a set of related items in a trait (Questions that have a foreign key pointing to the Questionnaire). The Questionnaire also has a many-to-many field pointing to a Dimension model. The factory, optionally, adds a set of Dimension objects to the Questionnaire in a post_generation method. Now, if questions have been added, I want to set the dimension field on each of them to a random choice from these dimensions. This is what I have: class QuestionnaireFactory(DjangoModelFactory): class Meta: model = models.Questionnaire class Params: with_questions = Trait( questions=RelatedFactoryList( QuestionFactory, "questionnaire", size=3, with_choices=True, ) ) # Add dimensions to the questionnaire. @factory.post_generation def dimensions(self, create, extracted, **kwargs): # First add the dimensions to the questionnaire. if create and extracted: self.dimensions.add(*extracted) # What I want to do: Add random dimension to each question (doesn't work) for question in self.question_set.all(): question.dimension = Faker("random_element", elements=extracted) question.save() Which I would call with: dimensions = factories.DimensionFactory.create_batch(3) questionnaire = factories.QuestionnaireFactory.create(with_questions=True, dimensions=dimensions) However, self.question_set.all() is empty in the post_generation hook. So, with the code as above, the dimension field is not being set on any question. It appears that the creation of the questions is happening … -
Django: maximum recursion depth exceeded in comparison - Postman works
I have a Django backend running as a service on an Ubuntu machine. After a while, I am getting this error when trying to execute my requests: maximum recursion depth exceeded in comparison I have attached to the process and found where the problem is occurring: response = requests.delete( apiUrlAddEntries, verify=False ) return response The debugger does not get inside the Delete call, it just trigger that exception. However, if I send the same delete call using Postman (on the same machine, toward the same server), all goes through fine. What do you think? Is it because the request lib? What cold make it run from Postman side and not from the request lib call? If I restart the service, it goes fine, for a while that is. -
ModuleNotFoundError: No module named 'apscheduler.schedulers'; 'apscheduler' is not a package
ModuleNotFoundError: No module named 'apscheduler.schedulers'; 'apscheduler' is not a package Errors like this occur. I have already installed the apscheduler library. Version used: python3.11.0 Framework in use: Django from apscheduler.schedulers.background import BackgroundScheduler from datetime import datetime, timedelta import pytz import requests import json from .models import Todo def notify_todo(): #現在の時刻を取得 now = datetime.now(pytz.timezone('Asia/Tokyo')) #締切が24時間以内のTODOリストを取得 todos = Todo.objects.filter(deadline__range=(now, now + timedelta(days=1))) for todo in todos: #LINE NotifyのAPIトークンを取得 api_token = 'xxxxxxxxxxxxxxxxxxxx' #通知メッセージの作成 message = f"【{todo.title}】\n締切時間:{todo.deadline.strftime('%Y/%m/%d %H:%M')}\n詳細:{todo.description}" #LINE Notifyに通知を送信 headers = {'Authorization': f'Bearer {api_token}'} payload = {'message': message} requests.post('xxxxxxxxxxxxxxxxxxxxxxx', headers=headers, data=payload) #BackgroundSchedulerの設定 scheduler = BackgroundScheduler(timezone='Asia/Tokyo') scheduler.add_job(notify_todo, 'interval', minutes=10)#10分ごとに実行 scheduler.start() -
How to create a DDOS protection for a webpage inside of the views
So recenty I have been working on a Django app for a school project, and some friends decided it would be funny to DDOS my webpage. I am currently looking for new friends and a way to protect against this. I am currently trying to use a decorator limits from the library. It does block when getting ddos attacked but the problem is it shuts down the whole website, giving the error RateLimitException, which i do not want, for obvious reasons. I want the program to be able to block that specific ip address sending the requests, how could i do this. Here is the imports in views with only the homepage. import ratelimit from ratelimit import limits @limits(calls=5, period=10) def home_page(request): request.session.get("user_id") if request.session.get('user_id') is not None: authorized=True return render(request,template_name="index.html",context={"authorize":authorized}) else: return render(request,template_name="index.html") . . . . . . . . . . . . -
One model for many views in django
Have a nice day! I just started to learn django framework and faced such problem. I'm making a small site where only one model is required, but this model is used to create pages through a slug, for example: domain.com/city/services domain.com/city/services/service-detail domain.com/city/services/service-detail-2 variables on the page change depending on the value of the slug "city". In all django tutorials, the class in the model is strongly associated with the target template. # appname/models.py from django.db import models from django.urls import reverse class City(models.Model): city = models.CharField(max_length=200, unique=True, db_index=True, verbose_name="Город на англ") slug = models.SlugField(max_length=200, unique=True, db_index=True, verbose_name="URL") phone1 = models.CharField(max_length=100, verbose_name="Основной телефон") gorod = models.CharField(max_length=200, verbose_name="Город") region = models.CharField(max_length=200, verbose_name="Область") def __str__(self): return self.gorod def get_absolute_url(self): return reverse('index', kwargs={'slug': self.slug}) In the view, too, binding to the model and a specific template # appname/views.py from django.views.generic import DetailView from .models import City class CityDetailView(DetailView): model = City template_name = 'index.html' And this is my URLS.py from django.urls import path from .views import CityDetailView urlpatterns = [ path('<slug:slug>', CityDetailView.as_view(), name='index'), ] How can I write a model so that I can use values in all templates dependent on the slug "city"? In laravel, I didn't use the database at all. To …