Tengo 2 ficheros y quiero importar el una función que tengo en este fichero
carga.py
class Command(BaseCommand):
def rango_fecha((self, anio: Optional[int], empieza: Optional[str], end: Optional[str]) -> Tuple[date, date]:):
print("lo que sea")
fichero2.py
from foro.management.commands.carga import Command as FechaCommand
class Command(BaseCommand):
def handle(self, *args, anio: Optional[int]=None, empieza: Optional[str]=None, end: Optional[str]=None, **options):
fecha_fin = FechaCommand().rango_fecha(anio, empieza, end) # esto da error por eso quiero usar el super
¿Cómo tendría que hacer el super?
mensaje de error:
File "C:\Users\james\entorno\myvenv\lib\site-packages\django\db\models\base.py", line 741, in save force_update=force_update, update_fields=update_fields) File "C:\Users\james\entorno\myvenv\lib\site-packages\django\db\models\base.py", line 779, in save_base force_update, using, update_fields, File "C:\Users\james\entorno\myvenv\lib\site-packages\django\db\models\base.py", line 870, in _save_table result = self.do_insert(cls.base_manager, using, fields, update_pk, raw) File "C:\Users\james\entorno\myvenv\lib\site-packages\django\db\models\base.py", line 908, in do_insert using=using, raw=raw) File "C:\Users\james\entorno\myvenv\lib\site-packages\django\db\models\manager.py", line 82, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "C:\Users\james\entorno\myvenv\lib\site-packages\django\db\models\query.py", line 1186, in insert return query.get_compiler(using=using).execute_sql(return_id) File "C:\Users\james\entorno\myvenv\lib\site-packages\django\db\models\sql\compiler.py", line 1374, in execute_sql for sql, params in self.as_sql(): File "C:\Users\james\entorno\myvenv\lib\site-packages\django\db\models\sql\compiler.py", line 1318, in as_sql for obj in self.query.objs File "C:\Users\james\entorno\myvenv\lib\site-packages\django\db\models\sql\compiler.py", line 1318, in for obj in self.query.objs File "C:\Users\james\entorno\myvenv\lib\site-packages\django\db\models\sql\compiler.py", line 1317, in [self.prepare_value(field, self.pre_save_val(field, obj)) for field in fields] File "C:\Usersjames\entorno\myvenv\lib\site-packages\django\db\models\sql\compiler.py", line 1258, in prepare_value value = field.get_db_prep_save(value, connection=self.connection) File "C:\Users\james\entorno\myvenv\lib\site-packages\django\db\models\fields_init.py", line 793, in get_db_prep_save return self.get_db_prep_value(value, connection=connection, prepared=False) File "C:\Users\james\entorno\myvenv\lib\site-packages\django\db\models\fields_init.py", line 1279, in get_db_prep_value value = self.get_prep_value(value) File "C:\Users\james\entorno\myvenv\lib\site-packages\django\db\models\fields_init.py", line 1274, in get_prep_value return self.to_python(value) File "C:\Users\james\entorno\myvenv\lib\site-packages\django\db\models\fields_init.py", line 1236, in to_python parsed = parse_date(value) File "C:\Users\james\entorno\myvenv\lib\site-packages\django\utils\dateparse.py", line 74, in parse_date match = date_re.match(value) TypeError: expected string or bytes-like object
Process finished with exit code 1