Re: Simple to say but difficult in django?

2016-04-10 Thread Luca Brandi
You are right: these files should be downloadable only to authenticated 
users.. If not in the static folder, where should I store them and how to 
make them downloadable? thanks

Il giorno sabato 9 aprile 2016 19:13:12 UTC+2, Vijay Khemlani ha scritto:
>
> Your question seems to be incomplete
>
> considering you are using a login_required decorator then you also want to 
> limit access to the file
>
> If you put it in your static directory then it will be public if anyone 
> knows the URL to the file
>
> On Sat, Apr 9, 2016 at 1:56 PM, Luca Brandi  > wrote:
>
>> Hi,
>> I need to make something very simple but it seems all exmplesI found on 
>> the web, do not work, so I am sure this group will find the right solution 
>> (please consider I am a newbie so please be specific and detailed in your 
>> reply):
>> I just need to store a pdf file in my sytic files and have a link on a 
>> page which opens it. 
>> Best solution I found is not working...:
>> view.py:
>> @login_required
>> def pricelist (request):
>> template='pricelist.pdf'
>> return render (request, template ,{})
>>   
>> url.py:
>> url(r'^pricelist/$', 'aero.views.pricelist', name='pricelist'), 
>>
>> url link in the page: Download
>>
>>
>> anyone can help? thanks very much
>>
>> -- 
>> 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 post to this group, send email to django...@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/a0d7a435-1a46-4cee-9d04-0ade09363ae7%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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/62f0868b-5a4e-4e0a-9f67-2d09bc5f2323%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How, in django, using mock for mocking Image file and non-image file with creating real files?

2016-04-10 Thread Seti Volkylany
I do not want to pollute the system temporary files for testing, maybe 
someone knows how to create a mock object for testing field ImageField

-- 
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/480f9ee3-1f3e-4173-88fb-f61869f16406%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


In a new Model with a OneToOne(User) relationship, how to get the username?

2016-04-10 Thread Andrew Chiw
class Client(UserenaBaseProfile):
def __str__(self):
return self.name

user = models.OneToOneField(User,
unique=True,
verbose_name=_('Django Login'),
related_name='client')

name = models.CharField(max_length=100, unique=True, default=user.name)


The title says it all - this class is supposed to have a OneToOneField 
relationship with a Django User, and through django-toolbar I've seen that 
when a user signs up, the Django User is created first and then my Client 
class. But how do I get the Client class to have the same name as the 
Django User's name?

-- 
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/cadbc069-1cbd-49e7-996c-fdb94adb537a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


a question about redis cache

2016-04-10 Thread Xin Liu
Let's look at the following scenario:
A website has 1 player, to make question easier, I use mysql  storage 
player with just one table: "player_table"
--table here-
name string
score int

now, I want to show Top 100 of those players  by socre.
if only with mysql, I have to caculate Top 100 every time, so I choice 
Redis to storage Top 100 with sorted set data type.

But if one of those players' score chaning, what should I do, update Top 
100 every time?? 

Thanks for you advance

-- 
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/487b5298-d478-448a-b498-f9def7ec74f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


a design about cache(using redis) , and some problem about it

2016-04-10 Thread Xin Liu
Now, Let's look at the following scenario:
A website manage 10,000 students, and show top 100 of student's achievement.
I use mysql storage every student personal information(name email sex and 
achievement)
but I have to get every student achievement and caculate Top 100, so I use 
redis to solve this problem, cache the Top 100 with redis and storage it in 
sorted set data type.

But now, the problem is: if one student achievement is change, should I 
update the redis‘s Top 100 every time??

this case may be good, you can think it as a game score Top 100,
Thanks for advance, : )

-- 
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/337ce664-32ed-4c39-87a3-8b70d310ad53%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Pycharm and DJANGO_SETTINGS_MODULE

2016-04-10 Thread Avraham Serour
the run configuration is separate from the console environment


On Thu, Apr 7, 2016 at 7:59 PM, Dariusz Mysior 
wrote:

> Hi in linux console it's ok but in Pycharm in IPython console when I
> execute f.e. from django.contrib.auth.models import AbstractUser i have bug
> like below
>
>
> django.core.exceptions.ImproperlyConfigured: Requested setting CACHES, but
>> settings are not configured. You must either define the environment
>> variable DJANGO_SETTINGS_MODULE or call settings.configure() before
>> accessing settings.
>>
>>
> In Run Configuration in environment paramets I have DJANGO_SETTINGS_MODULE
> with mysite.settings, wsgi and manage also have this info, where can I
> check it else...
>
> --
> 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/6ac3b375-f97b-4b03-8429-2b36b95c6f48%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAFWa6tJHVaW8ZDJAvSD7ikNMLS4R8Hsp47hzVTZtgOkztvQ%2BRw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


In a new Model with a OneToOne(User) relationship, how to get the username?

2016-04-10 Thread jorrit787
I'm not sure you can use default the way you are using on the name field, but 
in case you can: the names of the fields in User are username, firstname, and 
lastname, so you can try user.username, user.firstname or user.lastname .

-- 
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/ceb10c25-a741-4c2f-a618-321bb4010328%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What Python/Django code checkers do you recommend?...

2016-04-10 Thread Avraham Serour
I use all, specially because they are free for open source


On Fri, Apr 8, 2016 at 7:00 PM, Fred Stluka  wrote:

> Python/Django programmers,
>
> What code review tools do you use?  Do you run them automatically
> when checking in new code?  Do you recommend them?
>
> Details:
>
> I'm working on a large Python/Django Web app (1,000 files, 200,000
> lines of code, 3.5 years) and spend a good chunk of my time reviewing
> code written by other team members.  I'd like to automate many of the
> checks that I currently do manually:
>
> - Coding standards violations
>   -- Lack of logging
>   -- Missing docstrings
>   -- Hardcoded literals instead of named constants or utility functions
>   -- Standard columns in all DB tables (create_user, create_date,
>update_user, update_date, status, etc.)
>   -- etc.
>
> - Architecture violations
>   -- Doing things in the UI layer vs the business logic layer
>   -- Respect the MVC boundaries
>   -- etc.
>
> - Logic errors
>
> - Defensive coding
>   -- Unchecked assumptions
>   -- Missing else clauses on if statements
>   -- Missing exception handlers
>   -- Exception handlers that suppress errors
>   -- etc.
>
> - Security and data validation
>   -- Vulnerability to injection attacks (SQL, JS, etc.)
>   -- Data validation and security enforcement in browser vs. server
>   -- etc.
>
> - Massive inefficiencies
>   -- Cursor loop vs more specific DB SELECT
>   -- Caching opportunities
>   -- etc.
>
> - Reuse opportunities
>
> - Lack of test cases
>
> - DB migration issues
>   -- Non-idempotent migrations
>   -- Edited migrations
>   -- Migrations that call non-migration code that might change
>
> - User experience
>   -- Show clear error messages in all cases of user error
>
> - etc.
>
> What tools do you recommend to automate such checks?  I'm currently
> most interested in Python/Django, as well as JavaScript/CSS/HTML.
>
> Some automation tools I've found include:
> - Gerrit
>   https://www.gerritcodereview.com/
> - BitBucket Server (was Stash)
>   https://www.atlassian.com/software/bitbucket/server/
>
> Such automation tools support a workflow of human interactions for
> manual code reviews (comments, replies, todos, etc.).  They also call
> code review tools like the following to scan the code automatically:
> - Sonar (multiple languages via plugins)
>http://www.sonarqube.org/
> - JSHint (JavaScript)
>http://jshint.com/
> - JSLint (JavaScript)
>http://www.jslint.com/
> - TSLint (TypeScript)
>https://palantir.github.io/tslint/
> - PMD (mostly Java/JS, some Python)
>https://pmd.github.io/
> - Checkstyle (Java, not Python)
>http://checkstyle.sourceforge.net/
> - FindBugs (Java, not Python)
>http://findbugs.sourceforge.net/
> - CodeNarc (Groovy and Java, not Python)
>http://codenarc.sourceforge.net/
>
> I've also done a quick Google for Python/Django-specific tools:
> - http://google.com/search?q=python+code+checkers
> - http://google.com/search?q=django+code+checkers
>
> and found:
> - code-checker
>https://pypi.python.org/pypi/code-checker/
> - PyChecker
>https://pypi.python.org/pypi/PyChecker
> - Pyflakes
>https://pypi.python.org/pypi/pyflakes
> - PyLint
>https://pypi.python.org/pypi/pylint
> - pep8
>https://pypi.python.org/pypi/pep8
> - Flake8 (wraps Pyflakes, pep8 and others)
>https://pypi.python.org/pypi/flake8
> - Django Lint
>https://chris-lamb.co.uk/projects/django-lint
> - QuantifiedCode
>https://www.quantifiedcode.com/
>
> My IDE is PyCharm, which has the ability to check some things, but
> I haven't yet investigated or configured it much.
>
> What do you recommend?  Any good or bad experiences to share?
>
> Thanks!
> --Fred
> --
> Fred Stluka -- mailto:f...@bristle.com  --
> http://bristle.com/~fred/
> Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
> Open Source: Without walls and fences, we need no Windows or Gates.
> --
>
> --
> 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/5707D5A0.8020408%40bristle.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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://group

Re: a question about redis cache

2016-04-10 Thread Avraham Serour
why do you want to use redis for this?, top is trivial to the database


On Sun, Apr 10, 2016 at 3:22 PM, Xin Liu 
wrote:

> Let's look at the following scenario:
> A website has 1 player, to make question easier, I use mysql  storage
> player with just one table: "player_table"
> --table here-
> name string
> score int
>
> now, I want to show Top 100 of those players  by socre.
> if only with mysql, I have to caculate Top 100 every time, so I choice
> Redis to storage Top 100 with sorted set data type.
>
> But if one of those players' score chaning, what should I do, update Top
> 100 every time??
>
> Thanks for you advance
>
> --
> 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/487b5298-d478-448a-b498-f9def7ec74f3%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAFWa6tKByepUcYju%3DkJ0piXd%3D3xzu0iuHN%2Bf7yxHvOzAk2wnFg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: a question about redis cache

2016-04-10 Thread Bob Gailer
Why not just use Redit?

On Apr 10, 2016 8:38 AM, "Xin Liu"  wrote:
>
> Let's look at the following scenario:
> A website has 1 player, to make question easier, I use mysql  storage
player with just one table: "player_table"
> --table here-
> name string
> score int
>
> now, I want to show Top 100 of those players  by socre.
> if only with mysql, I have to caculate Top 100 every time, so I choice
Redis to storage Top 100 with sorted set data type.
>
> But if one of those players' score chaning, what should I do, update Top
100 every time??
>
> Thanks for you advance
>
> --
> 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/487b5298-d478-448a-b498-f9def7ec74f3%40googlegroups.com
.
> For more options, visit https://groups.google.com/d/optout.

-- 
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/CAP1rxO7p%3Dd74hcLAAZTtZOfMjB-m7X_E9M5qv4QjxHyic0CgJw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Rendering Form Fields That Are Passed To Context Inside Of An Object

2016-04-10 Thread David McWilliams
I'm pretty sure that I have them correct -- it'd be weird if I'd managed to 
include a typo in all six fields of the real form -- but I'll double check 
it on Monday when I get back into the office.  And thanks, I'll look into 
Formsets too!

On Saturday, April 9, 2016 at 9:25:40 AM UTC-5, jorr...@gmail.com wrote:
>
> Are you sure you have the name of the fields correct? According to the 
> documentation {{ form.fieldname }} should do what you want. It sounds like 
> formsets would be more appropriate for what you're trying to achieve though.
>
> And yeah, if you're going to go that specific you might as well render all 
> the fields completely manually :)
>  
>
> On Saturday, April 9, 2016 at 12:21:24 AM UTC+2, David McWilliams wrote:
>>
>> tl:dr -- How do I explicitly render the fields in a form that's passed to 
>> the context dictionary within an object?
>>
>> I'm building a page right now that shows a list of documents to the user. 
>>  Each document has a type, a status, a list of images associated with it, 
>> and finally a document update form with a few fields in it.  Because all of 
>> these pieces of data belong together, I created a class to group them for 
>> display (this is a simplified version for example only):
>>
>> class Document:
>> def __init__(self, doc_type, doc_status):
>> self.doc_type = doc_type
>> self.doc_status = doc_status
>> self.update_form = DocUpdateForm()
>>
>> def doc_view(request):
>> # ... some other stuff to get the raw data ...
>>
>> documents = []
>>
>> for raw_doc in raw_document_data:
>> documents.append(Document(raw_doc.doc_type, raw_doc.doc_status))
>>
>> context['documents'] = documents
>>
>> return render_to_response('doc_list.html', context)
>>
>> This all worked fine, because then in my template I was able to do 
>> something nice and simple like this:
>>
>> ...
>> Documents
>> 
>>   Document TypeDocument StatusUpdate
>>   {% for doc in documents %}
>> 
>>   {{ doc.doc_type }}
>>   {{ doc.doc_status }}
>>   {{ doc.update_form }}
>> 
>>   {% endfor %}
>> 
>>
>> Piece of cake, right?
>>
>> Well, now we want to change the page so that some of the form fields are 
>> inside of one div, and some inside of another one so that they can be next 
>> to one another instead of oriented vertically.  I consulted the Django 
>> documentation here: 
>> https://docs.djangoproject.com/en/1.9/topics/forms/#rendering-fields-manually
>>  and 
>> decided to render each of the fields myself.  This resulted in something 
>> like:
>>
>> ...
>> Documents
>> 
>>   Document TypeDocument StatusUpdate
>>   {% for doc in documents %}
>> 
>>   {{ doc.doc_type }}
>>   {{ doc.doc_status }}
>>   {{ doc.update_form.field_1 }}
>> {{ doc.update_form.field_2 }}
>> 
>> 
>>   {% endfor %}
>> 
>>
>>
>> Unfortunately, all this does is render the text "doc.update_form.field_1" 
>> instead of the form field.  It's the same behavior that I see when I 
>> accidentally try to reference a key that doesn't exist in the context 
>> dictionary.
>>
>> I can, of course, just write the form fields HTML by hand . . . but 
>> goshdarnit, I'm a developer, and I want to know why the lazy way isn't 
>> working.  Do I need to reference the form fields differently than the 
>> documentation suggests?  Is it because I'm passing the forms to the context 
>> inside of another object?  Should I be learning how to use formsets and/or 
>> fieldsets?
>>
>> This app uses Django 1.8, in case that's important.
>>
>

-- 
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/bd03b73a-fe02-468c-ac47-5d40b59925cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: google/bing maps using django

2016-04-10 Thread Xristos Xristoou
@sergiy khohlov i try to follow this toturial 
 
http://fle.github.io/easy-webmapping-with-django-leaflet-and-django-geojson.html
but in my admin(administrator page) i cant to add points because dont show 
me the map,can you help me ?

Τη Σάββατο, 9 Απριλίου 2016 - 10:50:08 μ.μ. UTC+3, ο χρήστης Xristos 
Xristoou έγραψε:
>
> hello
>
>
> i want some toturial or examble to easy way ping and show one place in 
> google maps/bing maps with lat/log
> and can be dynamic because i have more places to show in my web site ?
>

-- 
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/6316956c-fdf7-40a4-b70b-7530c05da08f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Emails to users

2016-04-10 Thread Luca Brandi
Hi
I am wondering how the admin can communicate to his users...Is there a way 
for example to create email templates and then email them to user? THANKS

-- 
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/fe9e06c2-5785-482b-b296-bdb5e2f8371c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Emails to users

2016-04-10 Thread Avraham Serour
Of course there's, you'll need to create email templates and then email the
users

On Sun, Apr 10, 2016, 8:47 PM Luca Brandi  wrote:

> Hi
> I am wondering how the admin can communicate to his users...Is there a way
> for example to create email templates and then email them to user? THANKS
>
> --
> 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/fe9e06c2-5785-482b-b296-bdb5e2f8371c%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAFWa6tLWdqOCoJYR%2BqB7G_o09rORyv-NemAC5xu1DZ-vm_%3Dv7Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Trouble getting posted

2016-04-10 Thread Gary Roach
Actually James, I don't think that is true. I run a group for a project 
and have no trouble getting returns on my posts. This is a feature that 
can be turned on/off a I recall. I have no trouble getting my posts 
returned with this site but only with my debian-user site. I think the 
trouble is with that site and have informed them as such. I hope I have 
not misunderstood your statement, but Google Groups does return the 
original post. The original post essentially sets up a new topic to 
which others can append comments. For my own group, I found that setting 
up categories and forcing the participants to post by logging into the 
group works best. But that is a special case and would be a mess for a 
large users  group.


Gary R.

On 04/09/2016 03:47 PM, James Schneider wrote:


>
> I have tried to post a couple of things in the last few days with no 
results. My posts are  never returned to me. So this is another test.

>

Google Groups does not send the post back to the OP, which is 
annoying, confusing and non-intuitive, and not configurable AFAIK.


-James

--
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/CA%2Be%2BciVB2d8k0xBF7BpS8H7Yho-r5JvZcLOf-EuzQSK-AehgdQ%40mail.gmail.com 
.

For more options, visit https://groups.google.com/d/optout.


--
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/570A9D29.7010303%40verizon.net.
For more options, visit https://groups.google.com/d/optout.


[Sharing] a django app to apply filters on drf querysets using query params with validations using voluptuous.

2016-04-10 Thread Manjit Kumar
https://github.com/manjitkumar/drf-url-filters

*drf-url-filters* is a simple django app to apply filters on drf 
modelviewset's queryset in a clean, simple and configurable way. It also 
supports validations on incoming query params and their values. A beautiful 
python package voluptouos is being used for validations on the incoming 
query parameters. The best part about voluptouos is you can define your own 
validations as per your query params requirements.

I want you guys to have a look and need suggestions to make it better and 
more useful.



Thanks,

Manjit

-- 
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/7f76023c-958b-4cc0-88b3-d41c8245d5bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: In a new Model with a OneToOne(User) relationship, how to get the username?

2016-04-10 Thread Mike Dewhirst

On 10/04/2016 10:12 PM, Andrew Chiw wrote:

|
classClient(UserenaBaseProfile):
   def__str__(self):
       returnself.name

    user =models.OneToOneField(User,
                                unique=True,
                                verbose_name=_('Django
Login'),
                                related_name='client')

    name =models.CharField(max_length=100,unique=True,default=user.name)


In the save() method of the Client class you can populate Client.name 
from Client.user.firstname plus Client.user.lastname


def save(self, *args, **kwargs):
if self.id:
self.name = self.get_name()
super(Client, self).save(*args, **kwargs)

def get_name(self):
return "{0} {1}".format(self.user.firstname, self.user.lastname)


Alternatively, you could just create a name() method which does the same 
as get_name() and you wouldn't then bother with the name field.


Also, it is possible that the Django User class has a get_name() method 
which you can call as required. You need to check that.


Mike



|

The title says it all - this class is supposed to have a OneToOneField
relationship with a Django User, and through django-toolbar I've seen
that when a user signs up, the Django User is created first and then my
Client class. But how do I get the Client class to have the same name as
the Django User's name?

--
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/cadbc069-1cbd-49e7-996c-fdb94adb537a%40googlegroups.com
.
For more options, visit https://groups.google.com/d/optout.


--
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/570ADA29.2050305%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: Trouble getting posted

2016-04-10 Thread James Schneider
>
> Actually James, I don't think that is true. I run a group for a project
> and have no trouble getting returns on my posts. This is a feature that can
> be turned on/off a I recall. I have no trouble getting my posts returned
> with this site but only with my debian-user site. I think the trouble is
> with that site and have informed them as such. I hope I have not
> misunderstood your statement, but Google Groups does return the original
> post. The original post essentially sets up a new
>


W...it may "appear" that way if you are using the web or mobile
GMail email client (which I assume most people on this list do).
GMail/Google does some funny business with Google Groups integration to
make everything seem integrated and would have you believe that you are in
fact receiving a copy of the message (does it really matter if your
response just 'appears' in the right spot, though?). After a quick Google
to confirm my own sanity, it appears that the GMail clients will
automatically thread messages with the same Message-ID, even if they live
in different folders (and in this instance, it would be my Primary inbox,
and my Sent Items).

However, this account is also tied to an MS Outlook instance, and unless MS
is doing something funny with my replies to this group, I have no copies of
this response in my Inbox. I'm not claiming to be an Outlook wizard, but I
don't believe I have any rules set up for this account, so I doubt Outlook
is to blame.

You can also Google around to see others echoing concerns about the same
"odd" behavior that Google Groups uses. Personally I think it is a passive
attempt by Google to encourage you to use GMail, and also cuts down
(marginally) the amount of email they send out. It's certainly one of the
reasons I keep using the web interface and mobile app over my MS Outlook
client.

It may be configurable (perhaps only by the list admin), but I seem to
remember researching this same issue when I first posted to django-users,
and was confused when I didn't see my response come back (GMail's
integration was not as good at the time IIRC). I think I double-posted for
that exact reason.

Perhaps someone else can confirm the behavior I'm describing, or echo that
I'm crazy. I'm good either way.

topic to which others can append comments. For my own group, I found that
> setting up categories and forcing the participants to post by logging into
> the group works best. But that is a special case and would be a mess for a
> large users  group.
>
>
Not sure why logging in to a group interface would have any effect on mail
routing. I suppose it would be 'easier' to tie together threads that are
posted directly to a forum/thread form than trying to correlate a random
email address with the same subject line. Pure guess.

On a side note, you also mentioned an issue specifically with the Debian
Users list, which this list is not. Other than maybe a "me too" response,
I'm not exactly sure what the intention of the message to this list was
about. I'm sure many of us are on that list as well, though.

-James

-- 
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/CA%2Be%2BciW1O3ECV2AqaORPkM3Zngn%3DxkpzxtFr1gyB9%3D_PXMTx_w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.