Can I test for count of a many to many field, in a Q query, along with other filters?

2018-01-16 Thread Mark London
If I'm creating a query using Q, can I make one of Q tests, be a count of a 
manytomany field?I.e., one of the Q filters, should test to see if a 
specific manytomany field, has a count greater than 5,   I know that I can 
use annotate to test for count.   But can annotate be specified within a Q 
query?   

If not, can I make 2 separate queries, and combine them, and eliminate 
duplicates?

Thanks! - Mark 

-- 
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/198c6f85-ba4c-4f38-844f-cb8cc4d67772%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django module for a tag input field on a user form, with autocomplete & automatic adding new tags?

2017-02-25 Thread Mark London


I want to have a django form that has a field that allows inputting tags, 
with autocomplete functionality, and the ability to automatically add new 
tags. I was using django-tagulous for this, until I discovered that pasting 
a series of 3 or more comma delimited strings, would cause the browser to 
hang.


I have looked at the alternatives, but either they are mainly designed to 
be used by the admin module, or the documentation for implementation is 
very sparse, without a real hardcoded demo, which is included with the 
tagulous package. Can anyone help me out? Thanks very much!


Mark London

-- 
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/f01d0fab-7368-4994-bbc6-be5e830f8262%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Need example of how to use a select2 widget for a manytomanyfield in django.

2015-11-10 Thread Mark London
I just discovered django-select2-forms.  It does exactly what I want, very 
simple to implement.

On Tuesday, November 10, 2015 at 5:08:46 PM UTC-5, Mark London wrote:
>
> I want to use a select2 widget to a manytomanyfield in django.  There are 
> several django-select2 modules, but the documentation on all of them is 
> confusing.   Can someone point me to a simple example of how to use a 
> select2 widget for a manytomanyfield?  Thanks. - Mark 
>
>
>

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/72a75a99-75ef-4a22-ac4b-1d9382bb2312%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Need example of how to use a select2 widget for a manytomanyfield in django.

2015-11-10 Thread Mark London
I want to use a select2 widget to a manytomanyfield in django.  There are 
several django-select2 modules, but the documentation on all of them is 
confusing.   Can someone point me to a simple example of how to use a 
select2 widget for a manytomanyfield?  Thanks. - Mark 


-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/86bf48b6-72b9-47e5-8912-28599a871f9a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django, Bootstrap Tags input, and Typeahead?

2015-10-13 Thread Mark London


What is the easiest way to implement a django field with bootstrap and 
typeahead?  I found a module calleddjango-bootstrap-typeahead 
 
that looks exactly 
what I want. The instructions say to simply use "TypeaheadField" or 
"MultipleTypeaheadField" in n the django form.   I'm interested in using 
the MultipleTypeheadField feature, so that I can have the classic 
feature of being able to input tags, with typeahead.

I installed this boostrap/typeahead module, and then tried the 
test_project demo. See images. When I enter 2 tags into the 
"MultipleTypeaheadField", and then click submit, the first tag 
disappears, and only the 2nd tag is displayed by the code in views.py:

|messages.success(request,'MultipleTypeahead: %s'  %  
form.cleaned_data['multi_typeahead']|

See this page for image of the output from the demo:
http://stackoverflow.com/questions/32739556/best-method-to-implement-twitter-bootstrap-with-typeahead-in-django

Either I don't understand how the module is supposed to work, or the 
demo was not properly designed to show the list of all the inputted tags.

Should I use a different method?   Has anyone used this module?  Thanks. 
- Mark


-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f582428d-b552-481f-b8cc-92f827377731%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Adding manytomany field, like "days of the week".

2013-04-09 Thread Mark London
Thanks for the response.  I had read about fixtures, but then people were 
saying that fixtures wasn't the best way to initialize the model, but they 
didn't give the alternative!   Next time, I won't listen to opinions, but 
will use code that actually works. - Mark 

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Adding manytomany field, like "days of the week".

2013-04-09 Thread Mark London
Hi - I'm a django newbie, so sorry if I'm doing something stupid (I did try 
to read the documentation.

I want to have a model, that has a manytomany field that stores days of the 
week, selected via a checkbox widget.  I read on the web, that I could put 
something like this in the model.

DAYS_OF_WEEK = (('1', 'Monday'),('2', 'Tuesday'),('3', 'Wednesday'),('4', 
'Thursday'),('5', 'Friday'),('6', 'Saturday'),('7', 'Sunday'),)
class Days(models.Model):
days = models.CharField(max_length=1, choices=DAYS_OF_WEEK)

The part of the model that references the days:

class Preferences(models.Model):
mail_days = models.ManyToManyField(Days)

The part of the form where the days are selected, is here:

DAYS_OF_WEEK = (
('1', 'Monday'),
('2', 'Tuesday'),
('3', 'Wednesday'),
('4', 'Thursday'),
('5', 'Friday'),
('6', 'Saturday'),
('7', 'Sunday'),
)

mail_days = forms.MultipleChoiceField(required=False,
widget=CheckboxSelectMultiple, choices=DAYS_OF_WEEK)

The form displays correctly, i.e. checkboxes for the days of the week 
appear. When I select the boxes, and hit submit, everything looks ok. But 
if I redisplay the form , the checkboxes are all empty.  But changes to the 
other form fields, that I made, get saved properly (As an aside, I'm using 
form.save(), not using commit=False).  So why do my checkboxes selections 
disappear?

Here's the SQL database table, that gets created for the days model. It's 
empty. It's not populated with anything. Shouldn't it be?

CREATE TABLE `myapp_days` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`days` varchar(1) NOT NULL,
PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;

LOCK TABLES `todo_days` WRITE;
UNLOCK TABLES;

The selected days are getting saved into a table called 
myapp_preferences_my_days. So something is being saved.  Is this a model 
problem, or form problem?  Thanks.- Mark 

CREATE TABLE `myapp_preferences_mail_days` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `preferences_id` int(11) NOT NULL,
  `days_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `preferences_id` (`preferences_id`,`days_id`),
  KEY `myapp_preferences_mail_days_2d9474d5` (`preferences_id`),
  KEY `myapp_preferences_mail_days_96c2dc77` (`days_id`)
  ) ENGINE=MyISAM AUTO_INCREMENT=16 DEFAULT CHARSET=latin1;

LOCK TABLES `myapp_preferences_mail_days` WRITE;
INSERT INTO `myapp_preferences_mail_days` VALUES (15,1,6),(14,1,4),(13,1,5);
UNLOCK TABLES;

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: I need a form that allows users to select from a list of choices, or add a new choice.

2013-02-28 Thread Mark London
Great.  Thanks very much!

On Wednesday, February 27, 2013 6:13:05 PM UTC-5, Rainy wrote:
>
>
>
>
> On Wednesday, February 27, 2013 11:28:50 AM UTC-5, Mark London wrote:
>>
>> I need a widget or a method that allows users to select items from a list 
>> of choices, or add a new choice.   Someone on stackoverflow asked the same 
>> question, and got a kludgy answer:
>>
>>
>> http://stackoverflow.com/questions/14802167/how-do-i-make-a-django-choicefield-accept-both-preset-choices-and-the-addition-
>>
>> There should be a better way than this.  Thanks.
>>
>> - Mark 
>>
>
>
>
> Take a look at SelectOrCreateField (and its widget) here:
>
> http://lightbird.net/dbe2/issues.html#selectorcreatefield
>
>
> The screenshot is here:
>
> http://lightbird.net/dbe2/issues.html#addissues-template
>
>
>  -ak 
>

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




I need a form that allows users to select from a list of choices, or add a new choice.

2013-02-27 Thread Mark London
I need a widget or a method that allows users to select items from a list 
of choices, or add a new choice.   Someone on stackoverflow asked the same 
question, and got a kludgy answer:

http://stackoverflow.com/questions/14802167/how-do-i-make-a-django-choicefield-accept-both-preset-choices-and-the-addition-

There should be a better way than this.  Thanks.

- Mark 

-- 
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 http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Task/project management open source django application?

2012-12-28 Thread Mark London
Hi - I'm looking for an open source project/task management system, based 
on django.  Something like this one:

http://birdhouse.org/software/2008/09/django-todo/

Are there any others out there like this?  Thanks. 

- Mark 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/A1kZL3c8nckJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.