mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #36311 -- Unified spelling of "hardcode" and its variants in docs.
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
This commit is contained in:
@@ -432,10 +432,10 @@ that is, when you retrieve data using QuerySet methods like ``get()``,
|
||||
Some database column types accept parameters, such as ``CHAR(25)``, where the
|
||||
parameter ``25`` represents the maximum column length. In cases like these,
|
||||
it's more flexible if the parameter is specified in the model rather than being
|
||||
hard-coded in the ``db_type()`` method. For example, it wouldn't make much
|
||||
sense to have a ``CharMaxlength25Field``, shown here::
|
||||
hardcoded in the ``db_type()`` method. For example, it wouldn't make much sense
|
||||
to have a ``CharMaxlength25Field``, shown here::
|
||||
|
||||
# This is a silly example of hard-coded parameters.
|
||||
# This is a silly example of hardcoded parameters.
|
||||
class CharMaxlength25Field(models.Field):
|
||||
def db_type(self, connection):
|
||||
return "char(25)"
|
||||
|
||||
@@ -904,7 +904,7 @@ Notes:
|
||||
any syntax error.
|
||||
|
||||
* The ``TemplateSyntaxError`` exceptions use the ``tag_name`` variable.
|
||||
Don't hard-code the tag's name in your error messages, because that
|
||||
Don't hardcode the tag's name in your error messages, because that
|
||||
couples the tag's name to your function. ``token.contents.split()[0]``
|
||||
will ''always'' be the name of your tag -- even when the tag has no
|
||||
arguments.
|
||||
@@ -1223,7 +1223,7 @@ Here's how you'd use this new version of the tag:
|
||||
with context in other blocks.
|
||||
|
||||
But, there's a problem with ``CurrentTimeNode2``: The variable name
|
||||
``current_time`` is hard-coded. This means you'll need to make sure your
|
||||
``current_time`` is hardcoded. This means you'll need to make sure your
|
||||
template doesn't use ``{{ current_time }}`` anywhere else, because the
|
||||
``{% current_time %}`` will blindly overwrite that variable's value. A cleaner
|
||||
solution is to make the template tag specify the name of the output variable,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
How to provide initial data for models
|
||||
======================================
|
||||
|
||||
It's sometimes useful to prepopulate your database with hard-coded data when
|
||||
It's sometimes useful to prepopulate your database with hardcoded data when
|
||||
you're first setting up an app. You can provide initial data with migrations or
|
||||
fixtures.
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ Here's an example, which generates the same CSV file as above::
|
||||
headers={"Content-Disposition": 'attachment; filename="somefilename.csv"'},
|
||||
)
|
||||
|
||||
# The data is hard-coded here, but you could load it from a database or
|
||||
# The data is hardcoded here, but you could load it from a database or
|
||||
# some other source.
|
||||
csv_data = (
|
||||
("First row", "Foo", "Bar", "Baz"),
|
||||
|
||||
Reference in New Issue
Block a user