Model Generation for CSV, XLS Files

2020-11-25 Thread Muskan Vaswan
Hi everyone,
I am Muskan and am very new to this community however not that new to 
django itself. Contributing to django is something I would really like to 
do, and I might also be participating in GSoc for the same. 

I have an vague idea of what I want to fix, because I myself have used 
django and just want to add things as a developer that I would've wanted as 
a user. So my question is understanding based around this idea of mine. 

*I want to know what functionality already exists that makes it easier to 
directly load a large data set into a django model from a CSV file (going 
with the simplest format or now).* When I had to do it as a user it took me 
quite a while and was a lot more complicated than I had expected, after 
being used to smooth transitions with load data. I could not find any 
better methods to do it, if there indeed exists no other methods, this is 
something I would like to work on So this is just to confirm if my 
research was thorough enough (very possibly wasn't).

Thank you! I'm excited to begin helping out!

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/a3946181-cd91-4b83-b9d6-d8d8f786b6acn%40googlegroups.com.


Re: Model Generation for CSV, XLS Files

2020-11-26 Thread Muskan Vaswan
Thank you all for your response, I really appreciate it. This seems to be a 
very active and helpful community already love django more!

On Thursday, 26 November 2020 at 21:25:30 UTC+5:30 shan...@gmail.com wrote:

> Hello!
> I'm also looking forward for GSOC'21. If you prefer we could try merging 
> this functionalities by submitting patches. 
> Regards
>
> On Thu, 26 Nov, 2020, 1:22 am Muskan Vaswan,  wrote:
>
>> Hi everyone,
>> I am Muskan and am very new to this community however not that new to 
>> django itself. Contributing to django is something I would really like to 
>> do, and I might also be participating in GSoc for the same. 
>>
>> I have an vague idea of what I want to fix, because I myself have used 
>> django and just want to add things as a developer that I would've wanted as 
>> a user. So my question is understanding based around this idea of mine. 
>>
>> *I want to know what functionality already exists that makes it easier to 
>> directly load a large data set into a django model from a CSV file (going 
>> with the simplest format or now).* When I had to do it as a user it took 
>> me quite a while and was a lot more complicated than I had expected, after 
>> being used to smooth transitions with load data. I could not find any 
>> better methods to do it, if there indeed exists no other methods, this is 
>> something I would like to work on So this is just to confirm if my 
>> research was thorough enough (very possibly wasn't).
>>
>> Thank you! I'm excited to begin helping out!
>>
>> -- 
>>
> You received this message because you are subscribed to the Google Groups 
>> "Django developers (Contributions to Django itself)" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-develop...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-developers/a3946181-cd91-4b83-b9d6-d8d8f786b6acn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-developers/a3946181-cd91-4b83-b9d6-d8d8f786b6acn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/2dc59790-fa5b-44de-9d12-ca656e317745n%40googlegroups.com.


Re: Model Generation for CSV, XLS Files

2020-11-26 Thread Muskan Vaswan
I would like to tackle this singularly first if possible, especially for
gsoc. Hope you understand I appreciate your offer


On Thu, 26 Nov, 2020, 9:25 pm Shoury Sharma,  wrote:

> Hello!
> I'm also looking forward for GSOC'21. If you prefer we could try merging
> this functionalities by submitting patches.
> Regards
>
> On Thu, 26 Nov, 2020, 1:22 am Muskan Vaswan, 
> wrote:
>
>> Hi everyone,
>> I am Muskan and am very new to this community however not that new to
>> django itself. Contributing to django is something I would really like to
>> do, and I might also be participating in GSoc for the same.
>>
>> I have an vague idea of what I want to fix, because I myself have used
>> django and just want to add things as a developer that I would've wanted as
>> a user. So my question is understanding based around this idea of mine.
>>
>> *I want to know what functionality already exists that makes it easier to
>> directly load a large data set into a django model from a CSV file (going
>> with the simplest format or now).* When I had to do it as a user it took
>> me quite a while and was a lot more complicated than I had expected, after
>> being used to smooth transitions with load data. I could not find any
>> better methods to do it, if there indeed exists no other methods, this is
>> something I would like to work on So this is just to confirm if my
>> research was thorough enough (very possibly wasn't).
>>
>> Thank you! I'm excited to begin helping out!
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django developers (Contributions to Django itself)" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-developers+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-developers/a3946181-cd91-4b83-b9d6-d8d8f786b6acn%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-developers/a3946181-cd91-4b83-b9d6-d8d8f786b6acn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/CAO3iMDH0-a59q-7S75cCv2dREqNYk_5vr1V2WTg9nFb3b4qrRQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-developers/CAO3iMDH0-a59q-7S75cCv2dREqNYk_5vr1V2WTg9nFb3b4qrRQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAOoM%2B4NyokLOnc-fgEGUUCyWK3eSeAV-%3DRN6oc0k7eZSQa_oUA%40mail.gmail.com.


Re: Model Generation for CSV, XLS Files

2020-11-26 Thread Muskan Vaswan
Django-import- export is along the lines of what I want to implement, this 
is how i eventually managed to import a csv file as a user there are 
drawbacks to the library, the biggest one being its not the easiest to use 
without admin integration, which isn't always possible in large projects... 
I wanted to implement something similar to loaddata, but for .csv files, or 
.xls files rather than just the dumpdata.json  

```python manage.py dumpdata > dumped_data.json```
and ```python manage.py loaddata < dumped_data.json``` do an Excellent job 
of taking data from existing django models and re using them, I was 
thinking about adding a similar functionality for datasets into models. 

So something like ```*python manage.py loaddata datast.csv .*```
Do you think this would be helpful?

P.S. I'm very new to this so I'm not sure how to go about making a proposal 
in the community etc, so if I'm doing this wrong, please point me to the 
correct direction

On Friday, 27 November 2020 at 00:39:13 UTC+5:30 jon.du...@gmail.com wrote:

> Is django-import-export at all along the lines of what you're looking for?
>
> https://github.com/django-import-export/django-import-export
>
> > django-import-export is a Django application and library for importing 
> and exporting data with included admin integration.
> > ...
> > support multiple formats (Excel, CSV, JSON, ...)
>
> On Wed, Nov 25, 2020 at 11:53 AM Muskan Vaswan  
> wrote:
>
>> Hi everyone,
>> I am Muskan and am very new to this community however not that new to 
>> django itself. Contributing to django is something I would really like to 
>> do, and I might also be participating in GSoc for the same. 
>>
>> I have an vague idea of what I want to fix, because I myself have used 
>> django and just want to add things as a developer that I would've wanted as 
>> a user. So my question is understanding based around this idea of mine. 
>>
>> *I want to know what functionality already exists that makes it easier to 
>> directly load a large data set into a django model from a CSV file (going 
>> with the simplest format or now).* When I had to do it as a user it took 
>> me quite a while and was a lot more complicated than I had expected, after 
>> being used to smooth transitions with load data. I could not find any 
>> better methods to do it, if there indeed exists no other methods, this is 
>> something I would like to work on So this is just to confirm if my 
>> research was thorough enough (very possibly wasn't).
>>
>> Thank you! I'm excited to begin helping out!
>>
>> -- 
>>
> You received this message because you are subscribed to the Google Groups 
>> "Django developers (Contributions to Django itself)" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-develop...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-developers/a3946181-cd91-4b83-b9d6-d8d8f786b6acn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-developers/a3946181-cd91-4b83-b9d6-d8d8f786b6acn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/10f21e35-9ff3-42c6-8798-dfd3cda0ecb7n%40googlegroups.com.


Re: Model Generation for CSV, XLS Files

2020-11-27 Thread Muskan Vaswan


Hi Markzus, 

 

Issue #5253  that you pointed 
me to was indeed very helpful. What I suggested is along the lines of what 
Adam suggested and tried to accomplish 12 years ago, which clearly shows 
that there has been space for its implementation for a very long time. 

 

At the same time, all of the points brought up by Russ also made sense but 
I do think that we can resolve those issues to some extent. Allow me to 
address the little details one by one.

 

Russ pointed out the need for a standardized format in csv files, and in 
turn Adam suggested that the first line begin the table name. I have a 
slightly different suggestion. It is a well known convention to put the 
column names as comma separated values in the first line of the csv file. I 
suggest we leave it at that. 

The column names of the first line will correspond to the fieldnames of the 
model created by the user, which instead of being referenced in the file 
itself can be referenced as a command line argument. 

This of course operates under the assumption that only one table of data 
will be in a single file. Which isn't a very bold assumption to make. I'll 
elaborate on why in just a bit.

 

I'm going to try and do a better job of explain the context of the addition 
I speak of. Say you get your data off of a random site on the internet in 
the form of an Excel sheet. Now if you want to use it in django as a model, 
then right now this is what you'll have to do: Convert it to CSV from 
Excel. Write a script somethink like the one 
https://groups.google.com/g/django-developers/c/o1dFA31YwOk/m/XchFFWjnBQAJ 
talks about (This views file is the code I'm referring to) 
In
 
which we read line by line and create the objects with a python script and 
make model objects with it. Creating a sub app to only be able to upload 
your dataset into your model seems like a stretch. This process could be 
made seem less if we just made this on the backend of django, which is 
going to take effort but I do think that it will be useful to the user. 

So the whole could simply boil down to `*python manage.py loaddata 
dataset.csv .*`

 

If you consider this then the assumption that one table will correspond to 
a single csv file really is pretty reasonable I think. 

 

So I'm not suggesting that we re-open the issue, I do however think that 
for django which is so user friendly and time efficient, uploading a csv 
file into a table really shouldn't be so long a process. 

 Let me know if I made any sense..

On Friday, 27 November 2020 at 10:55:24 UTC+5:30 Mariusz Felisiak wrote:

> Hi,
>
> Please take a look at existing ticket #5253 
>  which was rejected. We 
> should reach a strong consensus on the mailing list to reopen a closed 
> ticket (see triaging guidelines with regards to wontfix tickets 
> ),
>  
> but I think that Russ' comment 
>  is still valid.
>
> Best,
> Mariusz
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/fce8a7f9-ef07-4ca1-b32c-d5dbc3345209n%40googlegroups.com.


Re: Model Generation for CSV, XLS Files

2020-11-28 Thread Muskan Vaswan
Alright Mariusz, (sorry for messing up your name) then I think that puts an 
end to this particular conversation, I appreciate your feedback and help, 
same goes for everyone. I'll try to make myself useful in some other way 
then! 

On Saturday, 28 November 2020 at 14:12:29 UTC+5:30 Mariusz Felisiak wrote:

> Russ pointed out the need for a standardized format in csv files, and in 
>> turn Adam suggested that the first line begin the table name. I have a 
>> slightly different suggestion. It is a well known convention to put the 
>> column names as comma separated values in the first line of the csv file. I 
>> suggest we leave it at that.  
>>
>> *-1*
> I wouldn't call in a convention. I've imported thousands of CSV files in 
> dozens of different formats in my life. The lack of a standard is still a 
> strong argument against including it in Django. It's not something that we 
> want to maintain in Django. It sounds like a third-party package with a 
> custom serializer is the best way to proceed.
>
> Best,
> Mariusz
> *not Markzus ;)*
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/151f28cc-dd85-47f1-ad28-5f99aeea7539n%40googlegroups.com.


In reference to Ticket 15578

2020-11-29 Thread Muskan Vaswan
This is in reference to ticket #15578 
<https://code.djangoproject.com/ticket/15578>. 
Since I'm very new here, I am nervous to do anything by myself.
Trying to start small, I want to take up this documentation issue. Do let 
me know if What i suggested in comment 9 is an improvement. 
If what I suggested is in fact correct, I'd like to assign myself the 
ticket and fix this, if that's okay. If its incorrect, do tell me where I 
can improve, I'd still like to fix it..

Regards
Muskan Vaswan

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/dd6496f8-4bdf-47f9-b672-2ab3f80fa598n%40googlegroups.com.


Issues and Improvements to the The Django Administration

2020-12-15 Thread Muskan Vaswan
I have the following suggestions and issues with the Django site 
administration:

1. When deleting or adding items in Bulk (especially deleting), The Recent 
Actions should show “Deleted 15 Items” rather than every deleted item 
singularly which just occupies space and doesn't make a lot of sense and 
put bluntly is a waste of space. (ScreenShot attached). This could also be 
in the form of a dropdown which on click would show us every single one of 
the logs. Now I know this may not be a major change to the page but I do 
think it would improve the quality of the admin page. Do tell me if you 
agree or disagree 
After looking at the code for this, I realized that this wouldn’t be as 
easy it seems because (at least as far as I could understand) the context 
picks the action history from the LogEntry Model and passes it into the 
context. But a possible solution to this would be changing the query to 
give changes made on the same timestamp and tag as a list of actions and 
the final context could be the list of all such distinct timestamps.


2. The way the default index template can be overwritten by the user by 
specifying admin.index_template, I think it might be possible to give such 
an option for singular components of the admin site. For example, the 
entire header (Line 30 to 62 
<https://github.com/django/django/blob/master/django/contrib/admin/templates/admin/base.html>)
 
could be put inside a block and then use an 
*{% include header.html %}* which would contain the code for the entire 
header. And we could make this file default and give the option to 
overwrite this particular template. We ensure that the components hold 
their designated positions and leave the rest up to the user. We could also 
do this for other elements and components like the footer. I think this 
would increase ease of customization. Please give your views regarding the 
same.

3. Last and the least, The method for unregistering models form the admin 
site is not in the documentation. I only found it existed while going 
through the source code and on StackOverflow. Is there a reason for this or 
is this a lack of documentation that needs to be fixed? 

Regards
Muskan Vaswan

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/ef1ea40f-5da5-4ba6-b972-01e946e2b912n%40googlegroups.com.


Re: Issues and Improvements to the The Django Administration

2020-12-15 Thread Muskan Vaswan
[image: WhatsApp Image 2020-12-15 at 10.55.37 PM.jpeg]

On Wednesday, 16 December 2020 at 00:12:40 UTC+5:30 Muskan Vaswan wrote:

> I have the following suggestions and issues with the Django site 
> administration:
>
> 1. When deleting or adding items in Bulk (especially deleting), The Recent 
> Actions should show “Deleted 15 Items” rather than every deleted item 
> singularly which just occupies space and doesn't make a lot of sense and 
> put bluntly is a waste of space. (ScreenShot attached). This could also be 
> in the form of a dropdown which on click would show us every single one of 
> the logs. Now I know this may not be a major change to the page but I do 
> think it would improve the quality of the admin page. Do tell me if you 
> agree or disagree 
> After looking at the code for this, I realized that this wouldn’t be as 
> easy it seems because (at least as far as I could understand) the context 
> picks the action history from the LogEntry Model and passes it into the 
> context. But a possible solution to this would be changing the query to 
> give changes made on the same timestamp and tag as a list of actions and 
> the final context could be the list of all such distinct timestamps.
>
>
> 2. The way the default index template can be overwritten by the user by 
> specifying admin.index_template, I think it might be possible to give such 
> an option for singular components of the admin site. For example, the 
> entire header (Line 30 to 62 
> <https://github.com/django/django/blob/master/django/contrib/admin/templates/admin/base.html>)
>  
> could be put inside a block and then use an 
> *{% include header.html %}* which would contain the code for the entire 
> header. And we could make this file default and give the option to 
> overwrite this particular template. We ensure that the components hold 
> their designated positions and leave the rest up to the user. We could also 
> do this for other elements and components like the footer. I think this 
> would increase ease of customization. Please give your views regarding the 
> same.
>
> 3. Last and the least, The method for unregistering models form the admin 
> site is not in the documentation. I only found it existed while going 
> through the source code and on StackOverflow. Is there a reason for this or 
> is this a lack of documentation that needs to be fixed? 
>
> Regards
> Muskan Vaswan
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/58cf1866-a505-4ced-8ca2-c3aa449f57a3n%40googlegroups.com.


Re: Issues and Improvements to the The Django Administration

2020-12-15 Thread Muskan Vaswan
1. Agreeably this won’t be easy but I might have a way of doing this 
without having to make changes to the data model. We can leave the data 
model as it is but manipulate the context that we give to by changing the 
simple query (Line 16 
<https://github.com/django/django/blob/master/django/contrib/admin/templatetags/log.py>)
 to 
something slightly more complex. 
Like maybe 
#logs = LogEntry.objects.values('action_time', 'action_flag', 'user', 
'content_type').distinct()
#for l in logs:
#   e = LogEntry.objects.filter(Q(action_time=l['action_time']) 
&& Q(action_time=l['action_flag']))
#   if e.count() > 1:
#entry = Entry(l, e)
#entries.append(entry)
#   else:
#   entries.append(e) 
Where Entry() is a class (but not model) having necessary elements of 
LogEntry which are used in the templates already. Note that this is the 
most basic draft just to give an idea of what I’m trying to say. 
About having 1000 rows, you're right I guess we will have to reach a 
consensus to put an upper limit to the number of rows that can be 
encapsulated into one if we do decide to do this. I would suggest something 
like 50 or 100. Let me know what you think, and if I made any sense at all. 
There might be a point that this whole thing becomes an overkill, but as 
long as we don’t do something too major, I think it’ll be pleasing.

2. Yes that fits my use case quite well. I think adding just a couple more 
block elements will definitely do it.

3. Thank you! Glad I could contribute in some way.
 
Regards
Muskan Vaswan
On Wednesday, 16 December 2020 at 01:13:39 UTC+5:30 Adam Johnson wrote:

> 1. When deleting or adding items in Bulk (especially deleting), The Recent 
>> Actions should show “Deleted 15 Items”
>>
>
> This would be nice, but you've spotted the problem with querying the 
> LogEntry table. If a user deleted e.g. 1,000 items, we wouldn't want to 
> query for 1000 LogEntry objects only to accumulate them into a single row 
> for display. I'm not sure there's a neat solution without changing the data 
> model, and whether that would be worth it for most sites.
>
> 2. The way the default index template can be overwritten by the user by 
>> specifying admin.index_template, I think it might be possible to give such 
>> an option for singular components of the admin site. For example, the 
>> entire header (Line 30 to 62 
>> <https://github.com/django/django/blob/master/django/contrib/admin/templates/admin/base.html>)
>>  
>> could be put inside a block and then use an 
>>
>
> When overriding the base admin template I don't change those attributes, 
> but instead add a template file admin/base_site.html in my project's 
> templates that starts with "{% extends "admin/base_site.html" %}" , like: 
> https://docs.djangoproject.com/en/3.1/howto/overriding-templates/#extending-an-overridden-template
>   
> . Does this not support your use case?
>
> If so, I think adding a few more {% block %} declarations would be fine.
>
> 3. Last and the least, The method for unregistering models form the admin 
>> site is not in the documentation.
>>
>
> Thanks, this looks like an oversight. Several snippets in the docs 
> recommend using unregister(). I made a ticket: 
> https://code.djangoproject.com/ticket/32273#ticket
>
> On Tue, 15 Dec 2020 at 18:44, Muskan Vaswan  wrote:
>
>> [image: WhatsApp Image 2020-12-15 at 10.55.37 PM.jpeg]
>>
>> On Wednesday, 16 December 2020 at 00:12:40 UTC+5:30 Muskan Vaswan wrote:
>>
>>> I have the following suggestions and issues with the Django site 
>>> administration:
>>>
>>> 1. When deleting or adding items in Bulk (especially deleting), The 
>>> Recent Actions should show “Deleted 15 Items” rather than every deleted 
>>> item singularly which just occupies space and doesn't make a lot of sense 
>>> and put bluntly is a waste of space. (ScreenShot attached). This could also 
>>> be in the form of a dropdown which on click would show us every single one 
>>> of the logs. Now I know this may not be a major change to the page but I do 
>>> think it would improve the quality of the admin page. Do tell me if you 
>>> agree or disagree 
>>> After looking at the code for this, I realized that this wouldn’t be as 
>>> easy it seems because (at least as far as I could understand) the context 
>>> picks the action history from the LogEntry Model and passes it into the 
>>> context. But a possible solution to this would be changing the query to 
>>> 

Re: Issues and Improvements to the The Django Administration

2020-12-15 Thread Muskan Vaswan
1. Agreeably this won’t be easy but I might have a way of doing this
without having to make changes to the data model. We can leave the data
model as it is but manipulate the context that we give to by changing the
simple query (Line 16
<https://github.com/django/django/blob/master/django/contrib/admin/templatetags/log.py>)
to
something slightly more complex.
Like maybe
#logs = LogEntry.objects.values('action_time', 'action_flag', 'user',
'content_type').distinct()
#for l in logs:
#   e = LogEntry.objects.filter(Q(action_time=l['action_time'])
&& Q(action_time=l['action_flag']))
#   if e.count() > 1:
#entry = Entry(l, e)
#entries.append(entry)
#   else:
#   entries.append(e)
Where Entry() is a class (but not model) having necessary elements of
LogEntry which are used in the templates already. Note that this is the
most basic draft just to give an idea of what I’m trying to say. About
having 1000 rows, we will have to reach a consensus to put an upper limit
to the number of rows that can be encapsulated into one. I would suggest
something like 50 or 100. Let me know what you think, and if I made any
sense at all. There might be a point that this whole thing becomes an
overkill, but as long as we don’t do something too major, I think it’ll be
pleasing.

2. Yes that fits my use case quite well. I think adding just a couple more
block elements will definitely do it.

3. Thank you! Glad I could contribute in some way.

On Dec 16, 2020, at 1:12 AM, Adam Johnson  wrote:

1. When deleting or adding items in Bulk (especially deleting), The Recent
> Actions should show “Deleted 15 Items”
>

This would be nice, but you've spotted the problem with querying the
LogEntry table. If a user deleted e.g. 1,000 items, we wouldn't want to
query for 1000 LogEntry objects only to accumulate them into a single row
for display. I'm not sure there's a neat solution without changing the data
model, and whether that would be worth it for most sites.

2. The way the default index template can be overwritten by the user by
> specifying admin.index_template, I think it might be possible to give such
> an option for singular components of the admin site. For example, the
> entire header (Line 30 to 62
> <https://github.com/django/django/blob/master/django/contrib/admin/templates/admin/base.html>)
> could be put inside a block and then use an
>

When overriding the base admin template I don't change those attributes,
but instead add a template file admin/base_site.html in my project's
templates that starts with "{% extends "admin/base_site.html" %}" , like:
https://docs.djangoproject.com/en/3.1/howto/overriding-templates/#extending-an-overridden-template
. Does this not support your use case?

If so, I think adding a few more {% block %} declarations would be fine.

3. Last and the least, The method for unregistering models form the admin
> site is not in the documentation.
>

Thanks, this looks like an oversight. Several snippets in the docs
recommend using unregister(). I made a ticket:
https://code.djangoproject.com/ticket/32273#ticket

On Tue, 15 Dec 2020 at 18:44, Muskan Vaswan  wrote:

> 
>
> On Wednesday, 16 December 2020 at 00:12:40 UTC+5:30 Muskan Vaswan wrote:
>
>> I have the following suggestions and issues with the Django site
>> administration:
>>
>> 1. When deleting or adding items in Bulk (especially deleting), The
>> Recent Actions should show “Deleted 15 Items” rather than every deleted
>> item singularly which just occupies space and doesn't make a lot of sense
>> and put bluntly is a waste of space. (ScreenShot attached). This could also
>> be in the form of a dropdown which on click would show us every single one
>> of the logs. Now I know this may not be a major change to the page but I do
>> think it would improve the quality of the admin page. Do tell me if you
>> agree or disagree
>> After looking at the code for this, I realized that this wouldn’t be as
>> easy it seems because (at least as far as I could understand) the context
>> picks the action history from the LogEntry Model and passes it into the
>> context. But a possible solution to this would be changing the query to
>> give changes made on the same timestamp and tag as a list of actions and
>> the final context could be the list of all such distinct timestamps.
>>
>>
>> 2. The way the default index template can be overwritten by the user by
>> specifying admin.index_template, I think it might be possible to give such
>> an option for singular components of the admin site. For example, the
>> entire header (Line 30 to 62
>> <

Re: Issues and Improvements to the The Django Administration

2020-12-15 Thread Muskan Vaswan
The point is that there is a way, in fact multiple ways that this could be 
implemented without changing the models. A change to the method I suggested in 
my last mail would be to avoid looping over the query set at all or even the 
Entry() class and using values and the the Count() annotation in a single query 
and instead of showing the repr of the object deleted we could say something 
like “Deleted 1item” or “Deleted 10 items” which on click could show us the 
group of items being talked about. 

Akshat: I’m not sure how you plan on grouping the query set appropriately using 
javascript. I don’t think that is implementable. And even if it is, I don’t see 
how it would be more efficient.

Carles Pina I Estany: While I understand what you’re trying to do I don’t know 
why we are trying to avoid COUNT is there a best practice associated with this 
that I don’t know about?
However I do see a concern in adding a loop to the queryset right there in 
python. A slightly better solution would be simply saying 
Entries = 
LogEntry.objects.values(‘action_time’,’action_flag’,’user’).annotate(no_of_items
 = Count(‘id’)) and switching up things like 
{{ entry.object_repr }} in index.html to accommodate the dictionary that will 
be returned so that recent actions doesn’t deal directly with action objects at 
all.

Another proposal which would solve the problem of potentially encapsulating too 
much would be to add a view for a logs.html that shows very single query with 
pagination for the query set. This way the users who really want to see all the 
details of all of the logs, have a way to do it  (without having to make query 
to logEntry on their end) and the recent actions will have a lot cleaner look. 

I’m sure there are little details that can always be improved in every 
solution. I would really appreciate your inputs on the same

Adam: Let me know if this seems like a remotely satisfactory solutions or if 
there are other problems I should consider.

If this seems like a helpful proposal I would like to take this entire segment 
up for my GSoC Proposal in 2021.

Regards
Muskan Vaswan

> On Dec 16, 2020, at 7:41 AM, Akshat Sharma  wrote:
> 
> Hi
> 
> Well I am an webdevloper and pretty new to the django so
> 
> but If the issue is only to make log more efficient and useful then we can 
> implement javascript into the admin site
> 
> it can be resolved with pretty simple js and can be directly implemented into 
> HTML and can be a major advantage in scaling up
> 
> On Wed, Dec 16, 2020, 05:26 Carles Pina i Estany  <mailto:car...@pina.cat>> wrote:
> 
> Hi,
> 
> On Dec/16/2020, Muskan Vaswan wrote:
> 
> > LogEntry which are used in the templates already. Note that this is the
> > most basic draft just to give an idea of what I’m trying to say. About
> > having 1000 rows, we will have to reach a consensus to put an upper limit
> > to the number of rows that can be encapsulated into one. I would suggest
> 
> If this was done it would be nice to see something like:
> "Deleted 15 items"
> "Deleted 515 items"
> "Deleted more than 1000 items" (if it deleted more than 1000 if 1000 is
> the upper limit)
> 
> So it's informative, correct and should not be a database killer. I
> haven't checked recently the datamodel but to avoid the COUNT I think
> that it can be done with a query, slicing it to limit+1 (to force a
> LIMIT in the SQL) and if there are limit+1 elements then say "Deleted
> more than..." or probably some other way that I haven't thought now :-)
> 
> Cheers,
> 
> -- 
> Carles Pina i Estany
> https://carles.pina.cat <https://carles.pina.cat/>
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django developers  (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-developers+unsubscr...@googlegroups.com 
> <mailto:django-developers%2bunsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-developers/20201215235540.GE32607%40pina.cat
>  
> <https://groups.google.com/d/msgid/django-developers/20201215235540.GE32607%40pina.cat>.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-developers+unsubscr...@googlegroups.com 
> <mailto:django-developers+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-developers/CABt%3Dxpqb%2BPj8u%3D7vCNQDXoHe_6%2B4WbyExX0pwFdtVQjT0EEoXw%40mail.gmail.c

Re: Issues and Improvements to the The Django Administration

2020-12-16 Thread Muskan Vaswan
On Dec 16, 2020, at 2:17 PM, Carles Pina i Estany  wrote:

My message is
that it probably can be done without COUNT if need to be and show "more
than X rows" instead of the exact number of rows.


Well yes this makes sense to me now,
but only in the sense that we would first check whether some query exceeded
the limit or not and only count the exact amount of objects if it's under
the limit.
But even so if you consider the actual implementation, you'd have to make
two queries: one for all the distinct groups of timestamps and action tags
and run a loop on them and so on... This is difficult to explain in words
but basically it would add a lot more queries this way... at least the way
I visualize it happening here.

But also this is something I didn't know about so this was quite
educational, thank you.

Regards
Muskan Vaswan

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAOoM%2B4Nwhzkr2YxfO%3DMrykYKB9q6jHtiP7oFUz%3DEEX4_jseqeg%40mail.gmail.com.


Query regarding Google Summer Of Code

2021-03-16 Thread Muskan Vaswan
Hello again, I am Muskan and I have a few questions regarding GSoC 2021.

Are contributions to django/djangoproject (the tickets trac) considered in 
GSoC. While the dashboard itself is mentioned on the wiki page I was 
wondering if it extends to the issue tracker itself to. If so, then would 
fixing UI/UX bugs (large enough) be considered a valid contribution to 
GSoC? 
Besides this, regardless of GSoc, what is the process of approval for UI/UX 
fixes in any of the django projects/sub-projects? Does this process stay 
the same in consideration of a GSoC proposal?

Is there any mentor or such, that we as GSoC aspirants can get in tough 
with before the submissions of proposals so we can more more freely ask 
doubts specifically related to our potential proposals?

-
Regards
Muskan Vaswan

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/f1bf29ea-f7ce-421d-8c3d-b3af9c6d89c8n%40googlegroups.com.


Re: Query regarding Google Summer Of Code

2021-03-17 Thread Muskan Vaswan
Thank you so much, Ahmad. Heading your suggestion, I've put my question/ 
potential proposal up on the forum here 
<https://forum.djangoproject.com/t/gsoc-2021-potential-proposal-feedback/7083>
.


On Wednesday, 17 March 2021 at 09:51:48 UTC+5:30 Ahmad A. Hussein wrote:

> Hello Muskan,
>
> "We're still going to be strict with what we accept - you'll need to 
> provide a *strong use case* for your idea and show that it would be *useful 
> to a majority of developers* or *significantly improve* the development 
> of Django itself."
>
> This is from the wiki page 
> <https://code.djangoproject.com/wiki/SummerOfCode2021> for GSoC 2021. So 
> I believe you could submit a GSoC proposal for UI/UX but your proposal 
> would need to greatly impact a sizable amount of developers.
>
> As for UI/UX fixes, I believe the process is the same as normal tickets: 
> you submit a ticket on the issue tracker, people review it and establish 
> consensus, and then you submit a patch following said consensus.
>
> If you're looking to get feedback on your proposal, submit it on the 
> forums <https://forum.djangoproject.com/> under Mentorship. Plenty of 
> people will take a look at it and will help you get on the right track.
>
> On Tue, Mar 16, 2021 at 7:50 PM Muskan Vaswan  wrote:
>
>> Hello again, I am Muskan and I have a few questions regarding GSoC 2021.
>>
>> Are contributions to django/djangoproject (the tickets trac) considered 
>> in GSoC. While the dashboard itself is mentioned on the wiki page I was 
>> wondering if it extends to the issue tracker itself to. If so, then would 
>> fixing UI/UX bugs (large enough) be considered a valid contribution to 
>> GSoC? 
>> Besides this, regardless of GSoc, what is the process of approval for 
>> UI/UX fixes in any of the django projects/sub-projects? Does this process 
>> stay the same in consideration of a GSoC proposal?
>>
>> Is there any mentor or such, that we as GSoC aspirants can get in tough 
>> with before the submissions of proposals so we can more more freely ask 
>> doubts specifically related to our potential proposals?
>>
>> -
>> Regards
>> Muskan Vaswan
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django developers (Contributions to Django itself)" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-develop...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-developers/f1bf29ea-f7ce-421d-8c3d-b3af9c6d89c8n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-developers/f1bf29ea-f7ce-421d-8c3d-b3af9c6d89c8n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/f088322d-a32d-4c0f-90ec-391dcd7df18bn%40googlegroups.com.


#17193, Mass Templated Emails and support for mass EmailMessage (s)

2021-03-21 Thread Muskan Vaswan
I came across this issue #17193 which is quite old, that I'd like 
clarification/discussion on. 
To summarize the discussion that took place there 
<https://code.djangoproject.com/ticket/17193> as well as from an older 
discussion 
<https://groups.google.com/g/django-developers/c/RyjyDdgCPdk/m/zrBWquobWOUJ>
:
 The ticket was raised in hopes of allowing the sending of mail from a 
template without having to use the roundabout of the 'render_to_string' 
method before the "html_message" attribute was added to send_mail and 
EmailMessage. After this attribute was added, the discussion was that the 
use cases for this template format were even more reduced and that 
implementing it through a third-party package would perhaps be more elegant.

Consider the following use case: You have a student lifecycle management 
system in which you need to send the same circular to all students and 
parents fitting certain criteria, with only a few changes such as name, 
class, etc. 
In this particular scenario, you would send a  templated email to a lot of 
people, or, in other words, a mass templated email with only the context 
and recipient changing. While third party packages could accomplish this 
one way or another, it is my opinion that a more elegant solution could be 
provided by Django. 
Considering, that this sort of situation seems quite likely to arise, and 
the age of this ticket, I wonder if there has been any development in this 
area since, which I could not find in my own research on this issue. If so 
I would appreciate it if you could point me in the correct direction. 
If not, I would like to open discussion for potential solutions to this.
If this is finally deemed unnecessary, it becomes a simple matter of 
closing the ticket.


In relevance to this, even in the absence of support for TemplatedMails, it 
perhaps would be useful to allow sending mass emails while also allowing 
the usage of the EmailMessage format of more descriptive emails. This might 
be accomplished by allowing a list of EmailMessage objects in the helper 
function "send_mass_mail" or maybe by creating a new EmailMessages object 
to do this. 

Would appreciate your input on this.

Regards
Muskan Vaswan


-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/9e7d10ee-6492-4430-a963-7ceb632fe928n%40googlegroups.com.


Re: Django Project idea query

2021-03-26 Thread Muskan Vaswan
This is something that I find myself interested in too! Specifically in the 
part involving AVS.

Here is a little confusion I have:
So far, ASV hasn't been integrated into djangobench repo itself (If I'm not 
missing anything too crucial). So, most of the work that has been put in 
thus far has been on this repository 
<https://github.com/smithdc1/django-asv> by David Smith, right?
Would a task for GSoC be then, to migrate more of Django's benchmarks to 
ASV, and add them to this repository? Or would it be to add AVS to the 
django/djangobench repository itself? Basically, where would we be expected 
to contribute, in other words, to which of the repositories would it make 
more sense to contribute to?

*Khushi*, having a shared interest in this topic that has so many 
possibilities, it perhaps might be helpful for us to navigate the project 
together and help each other out! 

Regards
Muskan Vaswan


On Wednesday, 24 March 2021 at 16:38:39 UTC+5:30 khushik...@gmail.com wrote:

> Hello Carlton!
> Thank you for guiding me, I am looking into the bugs and will let you know 
> if I am stuck anywhere.
> I appreciate that you were able to give some suggestions on how to move 
> forward.
> Yours sincerely
> Khushi
>
> On Wednesday, 24 March 2021 at 14:24:29 UTC+5:30 carlton...@gmail.com 
> wrote:
>
>> Hi Khushi. 
>>
>> Thanks for the interest. This is a good topic. 
>>
>> Particularly with the async changes it's really important that we can 
>> profile changes. 
>> See https://github.com/django/django/pull/13651
>> This adds async signal dispatch, which would allow us a fully-async 
>> request-response pathway (assuming you didn't use sync components inside 
>> that)
>> *but *it's currently stalled for the performance concerns. 
>> That's just one example. 
>>
>> From https://github.com/django/djangobench/issues/38
>> First step I'd say is to see if you can set up the benchmarking (and ASV) 
>> locally, and get playing with it. 
>> Then I'd play a bit and comment with your first impressions (I'd say 
>> 'findings' but that might imply more than you really need — just get going)
>>
>> David has been pushing the effort there, in his free time, and I'm quite 
>> sure he'd welcome input. 
>> I know others are very keen in this area and will jump in as soon as you 
>> show progress. 
>>
>> Hopefully that gets you started. (Summary: Get up and running, then I'm 
>> sure you can get more feedback.) 
>>
>> Kind Regards,
>>
>> Carlton
>>
>>
>> On Tuesday, 23 March 2021 at 10:48:34 UTC+1 khushik...@gmail.com wrote:
>>
>>> Hello All!
>>> I am participating in GSOC 2021. I was looking at some of the project 
>>> lists and I am interested in the Django Benchmarking project idea. I would 
>>> like to know more about the tasks and operations involved in this project 
>>> idea. I am looking forward to contributing to the Django committee with my 
>>> work.
>>> Thank you
>>>
>>>  
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/e141e3c8-5962-4e74-97c7-09b2d9dbc33cn%40googlegroups.com.