Re: How to get data from another function in view to show it on template ?

2023-04-04 Thread 'Kasper Laudrup' via Django users

On 03/04/2023 18.44, Ravindra Magar wrote:

How to get data from another function in view to show it on a template?



You call the function like you'd call any other function and pass the 
data in the context given to the template you want to render.


Kind regards.
Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b1c48f6f-5a54-796b-2ab0-d51b3da5ea11%40stacktrace.dk.


OpenPGP_0xE5D9CAC64AAA55EB.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: Django audio recording issue: receiving Bad Request error

2023-04-04 Thread Ahmed omar miladi
i have used it


On Tue, 4 Apr 2023 at 17:40, ritik sahoo  wrote:

> Have you used template inheritance?
>
>
>
>
> On Mon, 27 Mar, 2023, 9:27 pm Yong Zu Yi, <1208z...@gmail.com> wrote:
>
>> I am new to Django and also my first time building an application. I am
>> building an audio journaling application with Django.
>> What I am doing here is a recorder. When user press the recorder button,
>> it will direct to record.html with four buttons, Start, Pause, Resume and
>> Stop. When the user finished recording and hit the Stop button, it will
>> save a audio file (wav). However, I have receive a bad request error and
>> the audio file is not created.
>>
>> I have posted the code at stack overflow:
>> https://stackoverflow.com/q/75853749/21499403
>>
>> Can anyone help me please.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/4dd18add-5882-4864-ae99-4c079a17f347n%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJwehCtakRR7ZCEHykPY5wq1CFUjPVfTNOLt3PBoYZJdeHTv1A%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAE3Dc2MKiaJhYbYtzsBDfGCZrpxoM1UhdrqCppHYScbf5tSzZw%40mail.gmail.com.


Re: How to get data from another function in view to show it on template ?

2023-04-04 Thread Shailesh Yadav
You can open ChatGPT and type the above question. I'll tell you in
detail.Thanks.

Thanks & Regards
Shailesh Yadav
+91-9920886044

  [image: Linkedin] 



On Tue, Apr 4, 2023 at 10:13 PM Ravindra Magar  wrote:

> How to get data from another function in view to show it on a template?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHMymCCQdHaNrEbZdu2wVo-7-HXy91ohvHURKzVTZWBt8bHAVg%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMQ-AEWa2n%2B4xDR5PV%3Dd07aNebi-eOMmRg%2B9QdqGp146fasbgw%40mail.gmail.com.


Re: Django error while running

2023-04-04 Thread 'JOSE GONZALEZ SANCHEZ' via Django users
That worked for me
Thanks!

El lunes, 27 de marzo de 2023 a las 20:02:03 UTC+2, Makan Dianka escribió:

> Run this command> pip install -r requirements.txt
>
> Le mercredi 22 mars 2023 à 13:53:15 UTC+1, James Kalu a écrit :
>
>> I think it ushould be 'rest_framework' in settings.py under installed 
>> apps.
>>
>>
>> On Wednesday, March 22, 2023 at 4:50:30 AM UTC+3 David Nugent wrote:
>>
>>> Any traceback with this at the end:
>>>
>>>   _bootstrap._gcd_import(name[level..], package, level)
>>>
>>> Is almost always is due to a problem with your settings INSTALLED_APPS, 
>>> particularly if django\apps\registry.py Is further up the trace.
>>>
>>> A missing comma between items, perhaps?
>>>
>>> It would indeed be nice if Django would output a more sensible error 
>>> message for issues like this  
>>> Hmm, an idea for a useful PR right there. Seems to be common issue 
>>> (since the very next message I read in this mail list is exactly the same 
>>> thing).
>>>
>>> Regards,
>>> David
>>>
>>>
>>> "Chandresh . T"  writes
>>>
>>> Recently I was running a git clone (
>>> https://github.com/divanov11/StudyBud.git)
>>>
>>> after doing required steps like migrations, etc. I started to run it by 
>>> (python manage.py runserver) but I got this error.
>>>
>>> can anyone help me with this, please?
>>>
>>>
>>>
>>>
-- 


"Este mensaje está
dirigido de manera exclusiva a su destinatario y puede 
contener información
privada y confidencial. No lo reenvíe, copie o 
distribuya a terceros que no
deban conocer su contenido. En caso de haberlo 
recibido por error,  rogamos
lo notifique al remitente y proceda a su 
borrado, así como al de cualquier
documento que pudiera adjuntarse.



 Por 
favor tenga en cuenta que
los correos enviados vía Internet no permiten 
garantizar la confidencialidad de
los mensajes ni su transmisión de forma 
íntegra.



 Las opiniones expresadas en el
presente correo pertenecen 
únicamente al remitente y no representan
necesariamente la opinión del 
Grupo BBVA."



 "This
message is intended exclusively for the adressee and 
may contain privileged and
confidential information. Please, do not 
disseminate, copy or distribute it to
third parties who should not receive 
it. In case you have received it by
mistake, please inform the sender and 
delete the message and attachments from
your system.



 Please
keep in 
mind that e-mails sent by Internet do not allow to guarantee neither
the 
confidentiality or the integrity of the messages sent."

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2f9f092f-eec3-4606-b4fc-35a0699ac402n%40googlegroups.com.


Django Admin does not use `get_FOO_display`

2023-04-04 Thread 'Ibrahim Abou Elenein' via Django users
I had a model having a field that uses Choices 
status = FSMField(default=STATUSES.PENDING, choices=STATUSES, 
protected=True)

I did override  the `get_status_display ` and its effect was not applied in 
the Django admin  

I looked up Django code and found 
```
def display_for_field(value, field, empty_value_display): from 
django.contrib.admin.templatetags.admin_list import _boolean_icon if 
getattr(field, "flatchoices", None): return 
dict(field.flatchoices).get(value, empty_value_display)
``` I changed it to use get_FOO_display and it worked, 
my question is why does it have this behavior? and how in my application 
can I make use of this?

Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7dabd818-4b70-409e-8af3-482deb3an%40googlegroups.com.


Using the URLconf defined in iblogs.urls, Django tried these URL patterns, in this order:

2023-04-04 Thread Tanveer
0


I know this question has been asked before, but I haven't found an answer 
that solves my situation.

I'm looking at the Django tutorial, and I've set up the first URLs exactly 
as the tutorial has it, word for word, but when I go to 
http://127.0.0.1:8000/, it gives me this error: but when i go to 
http://127.0.0.1:8000/admin/ its working fine,where and what i am doing 
wrong? i am using python version 3.11.1 please let me know for any other 
info
urls.py

from django.contrib import admin
from django.urls import path, include
from django.conf.urls.static import static
from django.conf import settings
from .views import home
urlpatterns = [
path('admin/', admin.site.urls),
path('', home)
  ]

views.py
from django.http import HttpResponse
from django.shortcuts import render

# Create your views here.
def home(request):
return render(request,home.html,{})

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5ad2f1c6-101a-4c16-9eff-a886d9267805n%40googlegroups.com.


How to get data from another function in view to show it on template ?

2023-04-04 Thread Ravindra Magar
How to get data from another function in view to show it on a template?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHMymCCQdHaNrEbZdu2wVo-7-HXy91ohvHURKzVTZWBt8bHAVg%40mail.gmail.com.


Re: Django audio recording issue: receiving Bad Request error

2023-04-04 Thread ritik sahoo
Have you used template inheritance?




On Mon, 27 Mar, 2023, 9:27 pm Yong Zu Yi, <1208z...@gmail.com> wrote:

> I am new to Django and also my first time building an application. I am
> building an audio journaling application with Django.
> What I am doing here is a recorder. When user press the recorder button,
> it will direct to record.html with four buttons, Start, Pause, Resume and
> Stop. When the user finished recording and hit the Stop button, it will
> save a audio file (wav). However, I have receive a bad request error and
> the audio file is not created.
>
> I have posted the code at stack overflow:
> https://stackoverflow.com/q/75853749/21499403
>
> Can anyone help me please.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4dd18add-5882-4864-ae99-4c079a17f347n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJwehCtakRR7ZCEHykPY5wq1CFUjPVfTNOLt3PBoYZJdeHTv1A%40mail.gmail.com.


Re: Migration running in shell, but no change in DB

2023-04-04 Thread Jason
What specifically was the changeset occurring and what isn't?  Is the model 
being created in the db, or is it the field change that's not replicating?  
In your comments, you showed just one migration, but seems from additional 
comments you made, there are two or more?  What are they, specifically.  
And what is the model field change you're making?

As mentioned earlier,  django model field changes do not always equate to a 
migration for that model.  So django made a migration for your model, but 
might also be an empty/no op one for your field change
On Tuesday, April 4, 2023 at 2:53:22 AM UTC-4 Martin Heitmann wrote:

> Would you recommend using inspectdb?
>
> On Monday, April 3, 2023 at 1:58:55 PM UTC+2 Martin Heitmann wrote:
>
>> Dear Jason
>>
>> What could I do to get it back in sync? I tried several recommendations 
>> from the web, but perhaps the devil is in the details. If someone could 
>> tell me which steps I should take, I would gladly roll back the migrations 
>> and sync it again. And I would like to share the output. However, I have 
>> the existing database and may not loose the existing content.
>>
>> As it seems to me I wanted to change a field more than a year ago. 
>> Perhaps that did not work. I do not remember. And now I wanted to add a new 
>> model to the app.
>>
>> Best regards
>> Martin
>>
>> On Monday, April 3, 2023 at 12:59:50 PM UTC+2 Jason wrote:
>>
>>> this is all a pretty weird experience, I have to say.  One thing that is 
>>> suggesting to me that your migration history is.out of sync is that 
>>> migration you shared earlier is not what I would expect an addField 
>>> operation, not a CreateModel. 
>>>
>>> Also, django migrations are required when model changes, but not all 
>>> model changes require emitting SQL.  What exactly is the change you're 
>>> expecting to see? What field, what was it before, and what do you want it 
>>> to go to? 
>>>
>>> On Sunday, April 2, 2023 at 3:43:27 PM UTC-4 Martin Heitmann wrote:
>>>
 A little PS: I logged in via phpmyadmin and saw that my user has all 
 privileges. So this should not be the source of the problem.

 On Saturday, April 1, 2023 at 8:07:57 PM UTC+2 Martin Heitmann wrote:

> I have a little update, but not a solution. Adding the database to 
> sqlmigrate will give me the SQL command, but nothing more:
>
> python3 manage.py sqlmigrate ObjPLW2 0037 --database=db_obj_plw2
>
> --
> -- Create model Wartungsarbeit
> --
> CREATE TABLE `ObjPLW2_wartungsarbeit` (`id` integer AUTO_INCREMENT NOT 
> NULL PRIMARY KEY, `wa_titel` varchar(201) NOT NULL, `wa_beschreibung` 
> longtext NOT NULL, `wa_turnus` integer UNSIGNED NOT NULL CHECK 
> (`wa_turnus` 
> >= 0), `wa_startdatum` date NOT NULL, `wa_erstelldatum` datetime(6) NOT 
> NULL, `wa_bearbeitungsdatum` datetime(6) NOT NULL);
>
> --
> -- Alter field w_bezahlt on waeschepaket
> --
>
> And for whatever reason it includes only the table creation and not 
> the change in the other field.
> On Saturday, April 1, 2023 at 7:46:51 PM UTC+2 Martin Heitmann wrote:
>
>> Dear Jason
>>
>> I went two migration steps back, then again I did makemigrations and 
>> then I went for sqlmigrate. This was the output:
>> python3 manage.py sqlmigrate ObjPLW2 0037
>> --
>> -- Create model Wartungsarbeit
>> --
>> --
>> -- Alter field w_bezahlt on waeschepaket
>> --
>> It does not include any SQL.
>>
>> Does anyone know where this is no SQL in the output?
>>
>> On Saturday, April 1, 2023 at 3:46:41 PM UTC+2 Martin Heitmann wrote:
>>
>>> Dear Jason
>>> Thanks for your reply. I will gladly do that. This is the latest 
>>> migration file:
>>>
>>> # Generated by Django 3.2.10 on 2023-04-01 13:45
>>>
>>> from django.db import migrations, models
>>> import django.utils.timezone
>>>
>>>
>>> class Migration(migrations.Migration):
>>>
>>> dependencies = [
>>> ('ObjPLW2', '0037_alter_waeschepaket_w_bezahlt'),
>>> ]
>>>
>>> operations = [
>>> migrations.CreateModel(
>>> name='Wartungsarbeit',
>>> fields=[
>>> ('id', models.AutoField(auto_created=True, 
>>> primary_key=True, serialize=False, verbose_name='ID')),
>>> ('wa_titel', models.CharField(max_length=201)),
>>> ('wa_beschreibung', models.TextField()),
>>> ('wa_turnus', 
>>> models.PositiveIntegerField(default=1)),
>>> ('wa_startdatum', 
>>> models.DateField(default=django.utils.timezone.now)),
>>> ('wa_erstelldatum', 
>>> models.DateTimeField(auto_now_add=True)),
>>> ('wa_bearbeitungsdatum', 
>>> models.DateTimeField(auto_now=True)),
>>> ],
>>> ),
>>> ]
>>>