Re: Django Admin: object history not working

2021-06-22 Thread Ryan Kite

Thanks for the clarification, I didn't realize it only applied to changes 
administered directly from the Django Admin. 
Was interested in learning about an objects' change history, but in this 
case, the changes were not performed from the Django Admin. 


On Tuesday, June 22, 2021 at 5:50:10 AM UTC-7 christian...@gmail.com wrote:

> I am not sure what you are asking about.
> The history works out of the box, but only when you manipulate entries via 
> the django admin.
> When you change the model instance through your own views, you have to 
> explicitly create the log entry.
>
> On Tue, 22 Jun 2021 at 00:48, Ryan Kite  wrote:
>
>> Hello,
>>
>> The issue is when clicking the "History" button on an object from the 
>> Django admin site, it opens to the template but says "*This object 
>> doesn't have a change history. It probably wasn't added via this admin 
>> site."*
>>
>> From reading the docs it appears that: *history_view*() already exists 
>> (which is what I want)
>>
>> /// from the doc page: 
>> ModelAdmin.history_view(*request*, *object_id*, *extra_context=None*)
>> [source] 
>> <https://docs.djangoproject.com/en/1.11/_modules/django/contrib/admin/options/#ModelAdmin.history_view>
>> ¶ 
>> <https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#django.contrib.admin.ModelAdmin.history_view>
>>
>>  Django view for the page that shows the modification history for a 
>> given model instance.
>>
>> ///
>>
>> We can see the change history when doing:
>>
>>  python manage.shell
>>
>> import django.contrib.admin.models import LogEntry
>> from django.contrib.contenttypes.models import ContentType
>> from app import MyModel 
>>
>>  results = 
>> LogEntry.objects.filter(content_type=ContentType.objects.get_for_model(MyModel
>>  
>> ))
>>
>> print(vars(results[1])) 
>>
>> .. shows the change details
>>
>> Please tell me what I'm missing or need to add. 
>>
>>
>>
>> -- 
>> 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...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/f59bfb29-c5be-459b-a984-ff1492150f92n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/f59bfb29-c5be-459b-a984-ff1492150f92n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>
>
> -- 
> Best Regards,
>
> Christian Ledermann
>
> Dublin, IE
> Mobile : +353 (0) 899748838
>
> https://www.linkedin.com/in/christianledermann
> https://github.com/cleder/
>
>
> <*)))>{
>
> If you save the living environment, the biodiversity that we have left,
> you will also automatically save the physical environment, too. But If
> you only save the physical environment, you will ultimately lose both.
>
> 1) Don’t drive species to extinction
>
> 2) Don’t destroy a habitat that species rely on.
>
> 3) Don’t change the climate in ways that will result in the above.
>
> }<(((*>
>

-- 
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/cc8975e1-8b77-4316-92df-909eecaad98cn%40googlegroups.com.


Django Admin: object history not working

2021-06-21 Thread Ryan Kite
Hello,

The issue is when clicking the "History" button on an object from the 
Django admin site, it opens to the template but says "*This object doesn't 
have a change history. It probably wasn't added via this admin site."*

>From reading the docs it appears that: *history_view*() already exists 
(which is what I want)

/// from the doc page: 
ModelAdmin.history_view(*request*, *object_id*, *extra_context=None*)
[source] 


 Django view for the page that shows the modification history for a 
given model instance.

///

We can see the change history when doing:

 python manage.shell

import django.contrib.admin.models import LogEntry
from django.contrib.contenttypes.models import ContentType
from app import MyModel 

 results = 
LogEntry.objects.filter(content_type=ContentType.objects.get_for_model(MyModel 
))

print(vars(results[1])) 

.. shows the change details

Please tell me what I'm missing or need to add. 



-- 
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/f59bfb29-c5be-459b-a984-ff1492150f92n%40googlegroups.com.


Re: Tables missing in SQLite but viewable in admin (confusion)

2021-05-29 Thread Ryan Kite
Thanks, Antonis, you were correct. The app was not actually using the 
SQLite DB it was using a different one that was not on the local machine. 

On Saturday, May 29, 2021 at 2:59:44 AM UTC-7 Antonis Christofides wrote:

> The table name by default has the app name prepended; so the table for 
> PastSurgicalHistory will be named superhealth_pastsurgicalhistory (assuming 
> that your app is named superhealth).
>
> Other than that, I'd make absolutely sure that the database I'm examining 
> with the sqlite3 command (or whatever tool you have) is really the same as 
> the one that is being read by Django. E.g. move the database file somewhere 
> else (and restart Django) and make sure that the data in Django admin is 
> gone.
>
> Antonis Christofides+30-6979924665 <+30%20697%20992%204665> (mobile)
>
>
> On 29/05/2021 02.56, Ryan Kite wrote:
>
> Greetings! 
>
> Am very confused about why the local dev SQLite DB 'appears' to be missing 
> several tables.
>
> In the Django Admin they exist and have data. 
>
> I would be expecting to see the following tables in the DB but can't find 
> them.
> (These are the model names since I don't know what the table name look 
> like yet.) 
>
>- Model: Allergies | Table: ? 
>- Model: DoctorsAndProviders | Table: ? 
>- Model: FamilyContacts | Table: ? 
>- Model: PastSurgicalHistory | Table: ? 
>- Model: HealthProfile | Table: ? 
>
> But, I do see these two models with their tables in the DB
>
>- Model: Med | Table: meds 
>- Model: PastMedicalHistory  | Table: past_med_hx 
>
>
> The application seems to be working for the most part, we can still add 
> and remove objects. But was encountering errors when trying to build a 
> ForeignKey from the Allergies model to the HealthProfile Model that lives 
> under the Users app. The error said something along the lines about the ID 
> did not exist in the table? Which caused me to view the DB and notice this. 
>
> Any help appreciated :)
>
> screenshots attached.
>
>
> -- 
> 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...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/9f7fecd6-b152-4e6d-8a9e-d22508b9d975n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/9f7fecd6-b152-4e6d-8a9e-d22508b9d975n%40googlegroups.com?utm_medium=email_source=footer>
> .
>
>

-- 
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/8dd5d6e4-2f9d-473c-bd4e-d1617aef2a48n%40googlegroups.com.


integrate vue js with django

2019-07-15 Thread Ryan Kite

This article has a working code sample for getting Vue and Django to work, 
NOTE: use the Git repo linked at the very end. 

The code samples in the articles are just for reading.

https://medium.com/quick-code/crud-app-using-vue-js-and-django-516edf4e4217

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ba4ff5be-8bfb-4b84-8e56-d548d14032d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.