Re: Privacy settings like Facebook in Django.

2017-03-01 Thread C. Kirby
I would create an abstract class to hold the share values, extend from that 
for your n shared fields, use those as OneToOne in your user profile, and 
then have methods in the userprofile to determine if the field should be 
shown. Something like this (assumes you have the code to figure out if a 
user is public, fof, friend, or friend list)

class SharedField(models.Model):
share_with = models.IntegerField(choices=((1,'Public'),(2,'FoF'),(3,
'Friend'),(4,'Friend List')))

   class Meta:
   abstract = True


class Email(SharedField):
email = models.EmailField()


class UserProfile(models.Model):
email = models.OneToOne(Email)

def get_relationship_level(self, request_user):
   if request_user in self.friend_list:
return 4
   elif request_user in self.friends:
   return 3
   elif request.user in self.fof:
   return 2
   else:
   return 1

def get _email_for_user(self, request_user):
   friend_level = self.get_relationship_level(request_user)
   if friend_level >= self.email.share_with:
   return self.email.email
   return None 



On Wednesday, February 22, 2017 at 2:14:48 PM UTC+2, Alex Richards wrote:
>
> I want to implement privacy settings on my extended UserProfile Model 
> where the user can decide who can see his field (say email for now).
> The options looks something like this,
>
> *public* - any one can view his email
> *friends_of_friends* - only friends and friends of friends can view his 
> email
> *friends* - only his friends can view his email
> *friend_list* - only a list of friends (pre defined) can view his email.
>
> I want to implement the same for n fields in the Model (phone number, 
> work, education, etc..).
>
> I don't need code but some directions to solve it. Code examples won't 
> hurt. 
>
>

-- 
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/3de44eec-3087-42dc-988b-995464397fb0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


good 404 vs bad 404

2017-03-01 Thread guettli
In systems which are accessed only via intranet we used to monitor http 404 
responses.

Every time a 404 happens, an issue in our monitoring gets created.

This worked well in the past.

Now we have cases where a 404 is valid or should be ignored. No issue in 
the monitoring should be visible.

You could apply "separation of concerns" and keep on reporting all 404 
responses
and do the filtering in the monitoring area.

But on the other hand the code knows more. I have places where I know that
this 404 should be ignored.

I am biased where the problem should get solved:
 
 - inside django app
 - inside monitoring


What do you think?

Does anybody make a differenence between "good 404 vs bad 404"?

Regards,
  Thomas

-- 
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/fb152b91-ee44-42aa-8304-fb43eba43be1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: good 404 vs bad 404

2017-03-01 Thread Andreas Kuhne
I think you should always report a 404 as a 404 regardless of the
situation.

The application shouldn't have to know if it is a valid 404 or an "invalid"
- because from the applications point of view, the page (or item) couldn't
be found.

Just my 2 cents.

Regards,

Andréas

2017-03-01 10:25 GMT+01:00 guettli :

> In systems which are accessed only via intranet we used to monitor http
> 404 responses.
>
> Every time a 404 happens, an issue in our monitoring gets created.
>
> This worked well in the past.
>
> Now we have cases where a 404 is valid or should be ignored. No issue in
> the monitoring should be visible.
>
> You could apply "separation of concerns" and keep on reporting all 404
> responses
> and do the filtering in the monitoring area.
>
> But on the other hand the code knows more. I have places where I know that
> this 404 should be ignored.
>
> I am biased where the problem should get solved:
>
>  - inside django app
>  - inside monitoring
>
>
> What do you think?
>
> Does anybody make a differenence between "good 404 vs bad 404"?
>
> Regards,
>   Thomas
>
> --
> 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/fb152b91-ee44-42aa-8304-fb43eba43be1%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/CALXYUbkcs%2BEqkNPLNhctqtEzB7Zd3oPKVoJUMNi8yzcXgON7bQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: good 404 vs bad 404

2017-03-01 Thread Antonis Christofides
My gut feeling says you should treat this in monitoring, however here are some
questions:

1) Why do you monitor 404s at all?

2) Could you give some examples of 404s that are valid or should be ignored?

Regards,

Antonis

Antonis Christofides
http://djangodeployment.com

On 03/01/2017 11:42 AM, Andreas Kuhne wrote:
> I think you should always report a 404 as a 404 regardless of the situation. 
>
> The application shouldn't have to know if it is a valid 404 or an "invalid" -
> because from the applications point of view, the page (or item) couldn't be
> found. 
>
> Just my 2 cents.
>
> Regards,
>
> Andréas 
>
> 2017-03-01 10:25 GMT+01:00 guettli  >:
>
> In systems which are accessed only via intranet we used to monitor http
> 404 responses.
>
> Every time a 404 happens, an issue in our monitoring gets created.
>
> This worked well in the past.
>
> Now we have cases where a 404 is valid or should be ignored. No issue in
> the monitoring should be visible.
>
> You could apply "separation of concerns" and keep on reporting all 404
> responses
> and do the filtering in the monitoring area.
>
> But on the other hand the code knows more. I have places where I know that
> this 404 should be ignored.
>
> I am biased where the problem should get solved:
>  
>  - inside django app
>  - inside monitoring
>
>
> What do you think?
>
> Does anybody make a differenence between "good 404 vs bad 404"?
>
> Regards,
>   Thomas
>
> -- 
> 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/fb152b91-ee44-42aa-8304-fb43eba43be1%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/CALXYUbkcs%2BEqkNPLNhctqtEzB7Zd3oPKVoJUMNi8yzcXgON7bQ%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/32a6faf0-a248-b983-2ad3-6dbc2d833927%40djangodeployment.com.
For more options, visit https://groups.google.com/d/optout.


Re: attribute required and error XML

2017-03-01 Thread ludovic coues
I can't answer on your issue exactly, but  is not an XML
doctype. It's the html5 doctype which as far as I know is SGML and not XML.

Try removing the line starting with  wrote:

Hi all,
I have  an problem. When I use the django library  form, It create an
attribute "required" for an input. But when I look on my explorer (firefox
or chrome or IE) i have a XML error.

"XML parsing error: malformed".

this is my code :
"
class LoginForm(forms.Form):
email = forms.EmailField(label='Courriel :')
password = forms.CharField(label='Mot de passe :',
widget = forms.PasswordInput)
def clean(self):
cleaned_data = super (LoginForm,self).clean()
email = cleaned_data.get("email")
password = cleaned_data.get("password")
if email and password:
if password != 'bob' or email != 'b...@bob.fr' :
raise forms.ValidationError("Adresse de courriel ou
mot de passe erroné.")
return cleaned_data
"

this is my déclaration for XML and doctype :
"



http://www.w3.org/1999/xhtml"; xml:lang="fr"> "

I can put "required=False" and it's OK, but I want that my input is
required (required=True it's not OK)
XML don't accept that required  attribute is alone, whithout "= someting".

If someone has had this problem?

Django 1.10
Firefox last update

-- 
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/8cb6a10b-fc89-4f9a-814e-a905ea9eef6b%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/CAEuG%2BTZpLqvRqkWXCCxN4P4fwOwedQkRuKEOd4VG0s9vaR0uRw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: good 404 vs bad 404

2017-03-01 Thread ludovic coues
I would tag the 404 in django and let the monitoring app do most of the
work.
The tag would simply be an extra header, x-reason for example. It would
take values like "no mapping for url" or "object not found".

This way, your django app is still doing no more than its job, indicating
the ressources is unavailable, and this monitoring app have enough data to
decide if the 404 should be logged or not.

On 1 Mar 2017 10:54 a.m., "Antonis Christofides" <
anto...@djangodeployment.com> wrote:

> My gut feeling says you should treat this in monitoring, however here are
> some questions:
>
> 1) Why do you monitor 404s at all?
>
> 2) Could you give some examples of 404s that are valid or should be
> ignored?
>
> Regards,
>
> Antonis
>
> Antonis Christofideshttp://djangodeployment.com
>
> On 03/01/2017 11:42 AM, Andreas Kuhne wrote:
>
> I think you should always report a 404 as a 404 regardless of the
> situation.
>
> The application shouldn't have to know if it is a valid 404 or an
> "invalid" - because from the applications point of view, the page (or item)
> couldn't be found.
>
> Just my 2 cents.
>
> Regards,
>
> Andréas
>
> 2017-03-01 10:25 GMT+01:00 guettli :
>
>> In systems which are accessed only via intranet we used to monitor http
>> 404 responses.
>>
>> Every time a 404 happens, an issue in our monitoring gets created.
>>
>> This worked well in the past.
>>
>> Now we have cases where a 404 is valid or should be ignored. No issue in
>> the monitoring should be visible.
>>
>> You could apply "separation of concerns" and keep on reporting all 404
>> responses
>> and do the filtering in the monitoring area.
>>
>> But on the other hand the code knows more. I have places where I know that
>> this 404 should be ignored.
>>
>> I am biased where the problem should get solved:
>>
>>  - inside django app
>>  - inside monitoring
>>
>>
>> What do you think?
>>
>> Does anybody make a differenence between "good 404 vs bad 404"?
>>
>> Regards,
>>   Thomas
>>
>> --
>> 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/ms
>> gid/django-users/fb152b91-ee44-42aa-8304-fb43eba43be1%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/CALXYUbkcs%2BEqkNPLNhctqtEzB7Zd3oPKVoJUMN
> i8yzcXgON7bQ%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/32a6faf0-a248-b983-2ad3-6dbc2d833927%
> 40djangodeployment.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/CAEuG%2BTaqg6M3z-VhQ_GfRTYDWxF7yB59cRUni9%3Dh8pp2_4zumg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: database update after paypal payment

2017-03-01 Thread Melvyn Sopacua
On Tuesday 28 February 2017 21:13:39 agoulouzego...@gmail.com wrote:
> hello! I am trying to update my database after paypal has received 
> the payment from customer. The problem is that I don't really know to
> do it. This is what I am doing now

This code is all irrelevant. This is the important URL:
>  name="return" type="hidden" value="http://www.example.com/thank-you";>

Wouldn't name it "thank-you" either. That would be the final page, but the flow 
is:

- Submit to PayPal
- At above return_url, receive data from PayPal:
- Check for success / failure
- If success:
set paid to True, redirect to /thank-you
- else:
display error and cart

-- 
Melvyn Sopacua

-- 
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/3452662.H3dCPjKHmD%40devstation.
For more options, visit https://groups.google.com/d/optout.


Hello

2017-03-01 Thread METRO DIARIES
I am new to Django and I shall we very glad to receive all sorts of help 
fro all of you in tackling problems while using Django.

-- 
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/15e3fa5e-a4a1-4eb6-9e32-49301cb85a68%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Store Tabular Form Data to Database

2017-03-01 Thread Aditya Khaund
Hello,

In one of my application I have a form in tabular format. I have following 
questions 

1) How can I add a row dynamically in my form?
2) While submitting how can I process multiple tables rows in view code and 
insert all of them to the database via model?

-- 
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/5164d816-c4ee-4bdd-b5cd-55f103e4d499%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Store Tabular Form Data to Database

2017-03-01 Thread Omar Abou Mrad
On Wed, Mar 1, 2017 at 1:52 PM, Aditya Khaund 
wrote:

> Hello,
>
> In one of my application I have a form in tabular format. I have following
> questions
>
> 1) How can I add a row dynamically in my form?
> 2) While submitting how can I process multiple tables rows in view code
> and insert all of them to the database via model?
>

Have a look at FormSets, they do exactly what you require:
https://docs.djangoproject.com/en/1.10/topics/forms/formsets/

Regards,

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


Re: group by 3 fields

2017-03-01 Thread Larry Martell
On Mon, Feb 27, 2017 at 3:41 AM,   wrote:
>
>
> On Monday, February 27, 2017 at 3:52:38 AM UTC+1, larry@gmail.com wrote:
>>
>> [SQL] That is a language I
>> have worked in for over 20 years, and when I see a querying need that
>> is how I think, and then I see how can I do that with the ORM.
>
>
> So I shouldn't give advices for you. We have similar experience, I think.

No, I will always take advice. Because you don't know what you don't know.

> With Django you may play with .aggregate() and .annotate() functions.
> You should be able to do grouping you need Just tell a ORM about aggregates
> you want to use, and it will automagically add group by.
>
> Let's try group by col1, col2:
>
>> from django.db.models import Count
>> from django.contrib.auth.models import User
>
>> print User.objects.values('is_staff',
>> 'is_superuser').annotate(cnt=Count('*')).query
> SELECT `auth_user`.`is_staff`, `auth_user`.`is_superuser`, COUNT(*) AS `cnt`
> FROM `auth_user` GROUP BY `auth_user`.`is_staff`, `auth_user`.`is_superuser`
> ORDER BY NULL
>
> You must tell Django that you need some aggregate, and then ask for
> selecting other values explicitely. These columns will be added to a group
> by.
> Please note that as a result you will get iterable of dicts instead of model
> instances, which is pretty reasonable.

As is so often the case, the requirements changed. Now what I had to
do, if I was doing it in SQL would have been:

(CASE
 WHEN TRIM(IFNULL(roiname, '')) IN ('', 'None') THEN CONCAT_WS('.',
CONVERT(roi_type_id, CHAR), roi_id)
 WHEN CONCAT_WS('.', CONVERT(roi_type_id, CHAR), roi_id) = roiname THEN roiname
 ELSE CONCAT_WS('.', CONVERT(roi_type_id, CHAR), roi_id, roiname)
 END) REGEXP '%s'

But the table I am selecting from has 600,000 rows or more, and that
query would cause a table scan. So I did not add that to the existing
query, and instead iterated over the result set in python and did that
filtering.

-- 
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/CACwCsY5HPqPiogABwk1hrJgnwqaJ36VUR6tDF%3D%2Bde%3DXckqG%2BYQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: group by 3 fields

2017-03-01 Thread marcin . j . nowak


>
> As is so often the case, the requirements changed. Now what I had to 
> do, if I was doing it in SQL would have been: 
>
> (CASE 
>  WHEN TRIM(IFNULL(roiname, '')) IN ('', 'None') THEN CONCAT_WS('.', 
> CONVERT(roi_type_id, CHAR), roi_id) 
>  WHEN CONCAT_WS('.', CONVERT(roi_type_id, CHAR), roi_id) = roiname THEN 
> roiname 
>  ELSE CONCAT_WS('.', CONVERT(roi_type_id, CHAR), roi_id, roiname) 
>  END) REGEXP '%s' 
>
> But the table I am selecting from has 600,000 rows or more, and that 
> query would cause a table scan. So I did not add that to the existing 
> query, and instead iterated over the result set in python and did that 
> filtering. 
>

Queries like that aren't "compatible" with Django ;)
You may also consider creating a view and map it to a unmanaged django 
model, but do not forget to add on_delete/on_update=DO_NOTHING for FKs.
But I have no idea what Django migration system do with such mapped view - 
I kicked off builtin migrations completely and I am using Liquibase to 
manage dbs.

Marcin

-- 
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/e784-6a38-4bcc-9341-b2f6a59b97c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: group by 3 fields

2017-03-01 Thread Larry Martell
On Wed, Mar 1, 2017 at 8:01 AM,   wrote:
>
>>
>> As is so often the case, the requirements changed. Now what I had to
>> do, if I was doing it in SQL would have been:
>>
>> (CASE
>>  WHEN TRIM(IFNULL(roiname, '')) IN ('', 'None') THEN CONCAT_WS('.',
>> CONVERT(roi_type_id, CHAR), roi_id)
>>  WHEN CONCAT_WS('.', CONVERT(roi_type_id, CHAR), roi_id) = roiname THEN
>> roiname
>>  ELSE CONCAT_WS('.', CONVERT(roi_type_id, CHAR), roi_id, roiname)
>>  END) REGEXP '%s'
>>
>> But the table I am selecting from has 600,000 rows or more, and that
>> query would cause a table scan. So I did not add that to the existing
>> query, and instead iterated over the result set in python and did that
>> filtering.
>
>
> Queries like that aren't "compatible" with Django ;)
> You may also consider creating a view and map it to a unmanaged django
> model, but do not forget to add on_delete/on_update=DO_NOTHING for FKs.
> But I have no idea what Django migration system do with such mapped view - I
> kicked off builtin migrations completely and I am using Liquibase to manage
> dbs.

I had thought of using a view, but that would have been a lot of
overhead on such a large table. I also considered adding a column and
running a one time script to update the existing rows, and modifying
the script that loads data to populate the new column. But doing an
alter on such a large table takes longer then we can afford to have
the table locked for.

Also, we don't use django migrations on this project. We have found
them very hard to manage in an environment where you have 40
deployments, all with different versions of the code and database.

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


Re: group by 3 fields

2017-03-01 Thread marcin . j . nowak


On Wednesday, March 1, 2017 at 2:09:06 PM UTC+1, larry@gmail.com wrote:
>
>
> I had thought of using a view, but that would have been a lot of 
> overhead on such a large table. I also considered adding a column and 
> running a one time script to update the existing rows, and modifying 
> the script that loads data to populate the new column. But doing an 
> alter on such a large table takes longer then we can afford to have 
> the table locked for. 
>

It depends on your needs, of course. Your solution described earlier is 
widely adopted. 
 

> Also, we don't use django migrations on this project. We have found 
> them very hard to manage in an environment where you have 40 
> deployments, all with different versions of the code and database. 
>

Good decision. There are many other factors like unavailability of 
migrations after application's code changes (due to "freezing" class 
references).

BR,
Marcin

-- 
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/d1bfae54-202c-4c9f-9665-200292396642%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django context translations with dynamic variables

2017-03-01 Thread Gleb Tocarenco
Hello,

I am running in with an issue with Django translation tag in case context 
is present as a dynamic variable.

{% trans 'You have new message' context user.gender %}


In this case django.po files doesn't contains words related to gender 
context.

My question is if there is possibility to use context in translation tag as 
dynamic variable and generate django.po records based on it?

 

-- 
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/5c01a596-23a2-418f-9045-44a947efde0d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django-mongo-angularJs

2017-03-01 Thread mohamed shawky
am new in django and mongodb 
i want to develop a web app contain some
 feature like log in 
and log out and registration and,
 update profile and post a text and,
 make a comment for this post  
 ,, front end working with angularJs
please help me 
thank you in 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/2d485368-6723-4751-b552-6e3455ae572c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ANNOUNCE] Django bugfix release: 1.10.6

2017-03-01 Thread Tim Graham
Details are available on the Django project weblog:

https://www.djangoproject.com/weblog/2017/mar/01/bugfix-release/

-- 
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/0d0e8c89-790e-461b-970f-f2e480ef427d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django context translations with dynamic variables

2017-03-01 Thread Jani Tiainen
In theory you just define genders to your PO file with translations and 
it should work.


Not sure will that disable autogeneration and update for your PO file 
after that.


On 01.03.2017 14:59, Gleb Tocarenco wrote:

Hello,

I am running in with an issue with Django translation tag in case 
context is present as a dynamic variable.


{%trans 'You have new message' context user.gender %}

In this case django.po files doesn't contains words related to gender 
context.


My question is if there is possibility to use context in translation 
tag as dynamic variable and generate django.po records based on it?


--
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/5c01a596-23a2-418f-9045-44a947efde0d%40googlegroups.com 
.

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


--
Jani Tiainen

--
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/269918e9-6e13-5967-3b8b-fc3ec8028a4c%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Advice: django deploy vps error 502

2017-03-01 Thread carlos
Hello, Antonis i have debug = false, yes
uwsgi dont write anything in the log :/
When i see the syslog i see error but not understand!
i share this output

http://pastebin.com/69yvC8Tz

thak for you help

On Wed, Mar 1, 2017 at 12:58 AM, Antonis Christofides <
anto...@djangodeployment.com> wrote:

> Hello,
>
> 502 usually means the backend isn't running. After you finish the test,
> has the backend stopped running? Does it continue to throw 502s? If that is
> the case, I'm wildly guessing that processes might be growing and growing
> in memory and being eventually killed, but I don't really know. Do you have
> DEBUG = False? Does uwsgi write something in its log? Does the system write
> something in the syslog?
>
> Regards,
>
> Antonis
>
> Antonis Christofideshttp://djangodeployment.com
>
>
> On 02/28/2017 10:49 PM, carlos wrote:
>
> Hi, all
> i have one vps for one application,
>
>  vps description
>
> 16GB RAM
> 8 core processor
> 160 GB SSD
> 6TB Transfer
>
> ok, i am using, uwsgi(2.0.14), nginx(1.10), mysql(5.6 )and ubuntu 16.04 LTS
> this site working well when is visited or hits 1k even 6k, but when
> visited 10k or 12k
> raiser error 502,
>
> When I do a test of ab like these command line
> ab -k -c 350 -n 2 mydomain.com/
> again raiser the error 502 in almost pages
>
> these are configs all, wsgi, nginx
>
>  uwsgi script in /etc/uwsgi/app-availabre/website.ini -
> http://pastebin.com/vQW47WGb
>
>  nginx conf in /etc/nginx/nginx.conf  --
> http://pastebin.com/5BsWWaps
>
> - nginx vhost for my website mydpmain 
> http://pastebin.com/bMPvmrwR
>
> How can I do so that the site does not throw the error?
>
> Are the settings correct?
>
> How can i know the layer support the vps?
>
> In nginx how to stop the ab test, if many people do the test the web site
> throws the error 502 ngixn
>
> I would appreciate it if someone gave me an idea or advice to configure
> better when there is high traffic or are doing ab test or another
> benchmarking test
>
> cheers
>
> --
> att.
> Carlos Rocha
> --
> 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/CAM-7rO1u-ih5pd9b2AEEDLBJRL7DUvhVDs9hfZj
> pyGH_fHKJbQ%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/7624c177-e769-5fd6-496e-5ab07a927783%
> 40djangodeployment.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
att.
Carlos Rocha

-- 
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/CAM-7rO31bj6O8L_s-hoVn13zV11UFuV9Wtd4EbJBS9EcFz%3DDtg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: good 404 vs bad 404

2017-03-01 Thread guettli


Am Mittwoch, 1. März 2017 10:42:44 UTC+1 schrieb Andréas Kühne:
>
> I think you should always report a 404 as a 404 regardless of the 
> situation. 
>
> The application shouldn't have to know if it is a valid 404 or an 
> "invalid" - because from the applications point of view, the page (or item) 
> couldn't be found. 
>
>
If I always report the 404 the monitoring people would hate me because they 
get too many false issues. Or they would switch off thinking and
say ... "nice, I get paid for pushing the button 'ignore-this'. That's my 
job - relaxed and money monthly. What do I want more?"

This was a joke, I hope it does not offend anybody.

-- 
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/fa41980a-a496-48ae-8643-59465649fad4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: good 404 vs bad 404

2017-03-01 Thread guettli


Am Mittwoch, 1. März 2017 10:54:38 UTC+1 schrieb Antonis Christofides:
>
> My gut feeling says you should treat this in monitoring, however here are 
> some questions:
>
> 1) Why do you monitor 404s at all?
>
> 2) Could you give some examples of 404s that are valid or should be 
> ignored?
>
>
I monitor 404 since it this question is about an application which runs 
only in the intranet.

No robots or other strange request come in. 

99% of all requests are inside the application. 

If there is a 404, then it is very likely that our application creates 
broken links.

Since we use reverse() every this is very seldom.

Up to now monitoring 404 was nice to have.

But now there are some parts where too many 404 responses get returned.

Concrete example: we render HTML mails. They often contain broken links.
I don't want to report these.

Can you understand my use case now? If not, please ask.

-- 
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/74679d0f-aa42-4885-8702-c8f6caf6a6bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: good 404 vs bad 404

2017-03-01 Thread guettli
nice, I like this. Yes, an additional header ... Thank you.

Am Mittwoch, 1. März 2017 11:02:01 UTC+1 schrieb ludovic coues:
>
> I would tag the 404 in django and let the monitoring app do most of the 
> work.
> The tag would simply be an extra header, x-reason for example. It would 
> take values like "no mapping for url" or "object not found".
>
> This way, your django app is still doing no more than its job, indicating 
> the ressources is unavailable, and this monitoring app have enough data to 
> decide if the 404 should be logged or not.
>
> On 1 Mar 2017 10:54 a.m., "Antonis Christofides" <
> ant...@djangodeployment.com > wrote:
>
>> My gut feeling says you should treat this in monitoring, however here are 
>> some questions:
>>
>> 1) Why do you monitor 404s at all?
>>
>> 2) Could you give some examples of 404s that are valid or should be 
>> ignored?
>>
>> Regards,
>>
>> Antonis
>>
>> Antonis Christofideshttp://djangodeployment.com
>>
>> On 03/01/2017 11:42 AM, Andreas Kuhne wrote:
>>
>> I think you should always report a 404 as a 404 regardless of the 
>> situation.  
>>
>> The application shouldn't have to know if it is a valid 404 or an 
>> "invalid" - because from the applications point of view, the page (or item) 
>> couldn't be found. 
>>
>> Just my 2 cents.
>>
>> Regards,
>>
>> Andréas 
>>
>> 2017-03-01 10:25 GMT+01:00 guettli >:
>>
>>> In systems which are accessed only via intranet we used to monitor http 
>>> 404 responses.
>>>
>>> Every time a 404 happens, an issue in our monitoring gets created.
>>>
>>> This worked well in the past.
>>>
>>> Now we have cases where a 404 is valid or should be ignored. No issue in 
>>> the monitoring should be visible.
>>>
>>> You could apply "separation of concerns" and keep on reporting all 404 
>>> responses
>>> and do the filtering in the monitoring area.
>>>
>>> But on the other hand the code knows more. I have places where I know 
>>> that
>>> this 404 should be ignored.
>>>
>>> I am biased where the problem should get solved:
>>>  
>>>  - inside django app
>>>  - inside monitoring
>>>
>>>
>>> What do you think?
>>>
>>> Does anybody make a differenence between "good 404 vs bad 404"?
>>>
>>> Regards,
>>>   Thomas
>>>
>>> -- 
>>> 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/fb152b91-ee44-42aa-8304-fb43eba43be1%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...@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/CALXYUbkcs%2BEqkNPLNhctqtEzB7Zd3oPKVoJUMNi8yzcXgON7bQ%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...@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/32a6faf0-a248-b983-2ad3-6dbc2d833927%40djangodeployment.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/384ce09d-f185-4213-9770-c14cd75d9

Re: good 404 vs bad 404

2017-03-01 Thread C. Kirby
There are lots of other status codes - perhaps your "good" or expected not 
found should be a 3xx code (Redirection) or a 4xx that isn't 404

https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
 

On Wednesday, March 1, 2017 at 6:22:27 PM UTC+2, guettli wrote:
>
> nice, I like this. Yes, an additional header ... Thank you.
>
> Am Mittwoch, 1. März 2017 11:02:01 UTC+1 schrieb ludovic coues:
>>
>> I would tag the 404 in django and let the monitoring app do most of the 
>> work.
>> The tag would simply be an extra header, x-reason for example. It would 
>> take values like "no mapping for url" or "object not found".
>>
>> This way, your django app is still doing no more than its job, indicating 
>> the ressources is unavailable, and this monitoring app have enough data to 
>> decide if the 404 should be logged or not.
>>
>> On 1 Mar 2017 10:54 a.m., "Antonis Christofides" <
>> ant...@djangodeployment.com> wrote:
>>
>>> My gut feeling says you should treat this in monitoring, however here 
>>> are some questions:
>>>
>>> 1) Why do you monitor 404s at all?
>>>
>>> 2) Could you give some examples of 404s that are valid or should be 
>>> ignored?
>>>
>>> Regards,
>>>
>>> Antonis
>>>
>>> Antonis Christofideshttp://djangodeployment.com
>>>
>>> On 03/01/2017 11:42 AM, Andreas Kuhne wrote:
>>>
>>> I think you should always report a 404 as a 404 regardless of the 
>>> situation.  
>>>
>>> The application shouldn't have to know if it is a valid 404 or an 
>>> "invalid" - because from the applications point of view, the page (or item) 
>>> couldn't be found. 
>>>
>>> Just my 2 cents.
>>>
>>> Regards,
>>>
>>> Andréas 
>>>
>>> 2017-03-01 10:25 GMT+01:00 guettli :
>>>
 In systems which are accessed only via intranet we used to monitor http 
 404 responses.

 Every time a 404 happens, an issue in our monitoring gets created.

 This worked well in the past.

 Now we have cases where a 404 is valid or should be ignored. No issue 
 in the monitoring should be visible.

 You could apply "separation of concerns" and keep on reporting all 404 
 responses
 and do the filtering in the monitoring area.

 But on the other hand the code knows more. I have places where I know 
 that
 this 404 should be ignored.

 I am biased where the problem should get solved:
  
  - inside django app
  - inside monitoring


 What do you think?

 Does anybody make a differenence between "good 404 vs bad 404"?

 Regards,
   Thomas

 -- 
 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/fb152b91-ee44-42aa-8304-fb43eba43be1%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...@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/CALXYUbkcs%2BEqkNPLNhctqtEzB7Zd3oPKVoJUMNi8yzcXgON7bQ%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...@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/32a6faf0-a248-b983-2ad3-6dbc2d833927%40djangodeployment.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 unsubscri

Re: database update after paypal payment

2017-03-01 Thread Mario Gudelj
You should use Django-PayPal app. It has views for IPN and PDT, stores
transaction details in DB, does TX verification and it fires of a signal
when when a successful transaction comes in to your webhook.

All you have to do is specify some URLs and settings. It'll even render
that front end form for you using a Django form. It really is a bomb.

Cheers,

M



On Wed, 1 Mar 2017 at 11:10 pm, Melvyn Sopacua 
wrote:

> On Tuesday 28 February 2017 21:13:39 agoulouzego...@gmail.com wrote:
>
> > hello! I am trying to update my database after paypal has received
>
> > the payment from customer. The problem is that I don't really know to
>
> > do it. This is what I am doing now
>
>
>
> This code is all irrelevant. This is the important URL:
>
> > 
> > name="return" type="hidden" value="http://www.example.com/thank-you";>
>
>
>
> Wouldn't name it "thank-you" either. That would be the final page, but the
> flow is:
>
>
>
> - Submit to PayPal
>
> - At above return_url, receive data from PayPal:
>
> - Check for success / failure
>
> - If success:
>
> set paid to True, redirect to /thank-you
>
> - else:
>
> display error and cart
>
>
>
> --
>
> Melvyn Sopacua
>
> --
> 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/3452662.H3dCPjKHmD%40devstation
> 
> .
> 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/CAHqTbjmeT%3D8U0wPqLTPBcb6FxSPnECiaFR0Y99-%2B0ooZhKQK6Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: good 404 vs bad 404

2017-03-01 Thread Melvyn Sopacua
On Wednesday 01 March 2017 08:21:34 guettli wrote:
> Concrete example: we render HTML mails. They often contain 
broken
> links. I don't want to report these.

That depends if the rendering makes the link broken (for example 
you fold soft wraps in quoted-printable incorrectly).
A different approach would be to treat the notification mails the 
way you treat spam. Notifications that are "user errors" are 
"spam", notifications that are "application errors" are "ham".
Using baysian filtering, the number of "user errors" should 
deminish greatly over time.
-- 
Melvyn Sopacua

-- 
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/9392070.AyafR4hmKU%40devstation.
For more options, visit https://groups.google.com/d/optout.


Re: django-mongo-angularJs

2017-03-01 Thread ludovic coues
Can you explain why using mongodb would be better than any SQL database ?

Django have models, which make abstraction of the database. It's
really nice for most usage, saving plenty of time and trouble most of
the time.

These models have no support for mongodb and as far as I know, nothing
will happen soon. Using mongodb means you will have to take care of
the database layer by yourself.

If you are willing to drop the mongodb requirement, django provide a
user class which can login and log out:
https://docs.djangoproject.com/en/1.10/topics/auth/

Saving text from a user is super easy with generic class based biew:
https://docs.djangoproject.com/en/1.10/topics/class-based-views/generic-editing/#model-forms

Comments are a tiny bit harder, but the previous link give you a start
of an answer with model and request.user

If it's your first django project and you haven't done the tutorial, I
highly recommend it. It will give you all the basic

Don't hesitate to come back if you have more precise question.

2017-03-01 14:40 GMT+01:00 mohamed shawky :
> am new in django and mongodb
> i want to develop a web app contain some
>  feature like log in
> and log out and registration and,
>  update profile and post a text and,
>  make a comment for this post
>  ,, front end working with angularJs
> please help me
> thank you in 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/2d485368-6723-4751-b552-6e3455ae572c%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 

Cordialement, Coues Ludovic
+336 148 743 42

-- 
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/CAEuG%2BTZQAusvtJekkeeSn5Bxy%3D_dex4qsy3webPkamx-D7u7CA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Djnago User login

2017-03-01 Thread Hossein Torabi
is there any method that i have two kind of users that once log in with 
user name and password and other one login with just with user 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/a4d0763b-0a0f-46c7-a75a-bd7f15ca7761%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Migrations?

2017-03-01 Thread Ed Sutherland
I am a relatively new Django coder. I'm building a small custom CMS. Whenever I 
get deep into development, I run into a migration problem: an old error keeps 
halting newer migrations. I long ago fixed the original error, but the 
migration continues to stop due to a now non-existent error. I know I can 
rollback the migration to the last successful attempt, but how do I prevent 
this in the first place? 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/15a8b20a733.f97315d281257.942488383471437686%40tburgnews.com.
For more options, visit https://groups.google.com/d/optout.


Re: django-mongo-angularJs

2017-03-01 Thread mohamed shawky
am using mongodb which the project that i work on it deal with mongo  if 
you can help me thank ou in advance


بتاريخ الأربعاء، 1 مارس، 2017 3:43:47 م UTC+2، كتب mohamed shawky:
>
> am new in django and mongodb 
> i want to develop a web app contain some
>  feature like log in 
> and log out and registration and,
>  update profile and post a text and,
>  make a comment for this post  
>  ,, front end working with angularJs
> please help me 
> thank you in 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/55793627-f615-4073-b30b-7947bd5b5586%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Djnago User login

2017-03-01 Thread Constantine Covtushenko
Hi Hossein,

I am not sure that understood you correctly.

Are you asking about the way how to handle two types of authentication?
One by user name and password,
an other by just username?


On Wed, Mar 1, 2017 at 4:05 PM, Hossein Torabi  wrote:

> is there any method that i have two kind of users that once log in with
> user name and password and other one login with just with user 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/a4d0763b-0a0f-46c7-a75a-bd7f15ca7761%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/CAK52boXASTYMB6VdDP6iEiUANdpXSH7auf3kY8mdMGntd1X3sg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Migrations?

2017-03-01 Thread Melvyn Sopacua
On Wednesday 01 March 2017 13:27:37 Ed Sutherland wrote:
> I am a relatively new Django coder. I'm building a small custom 
CMS.
> Whenever I get deep into development, I run into a migration 
problem:
> an old error keeps halting newer migrations. I long ago fixed the
> original error, but the migration continues to stop due to a now
> non-existent error. I know I can rollback the migration to the last
> successful attempt, but how do I prevent this in the first place?

Rolling back is destructive, so never a solution for production. How 
you can eliminate the error is largely depending on the error.
-- 
Melvyn Sopacua

-- 
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/1571910.2OvDCcMPjQ%40devstation.
For more options, visit https://groups.google.com/d/optout.


Re: Djnago User login

2017-03-01 Thread Shawn Milochik
It takes a little fiddling, but you can log in a user however you want.

https://docs.djangoproject.com/en/1.10/topics/auth/default/#how-to-log-a-user-in

In short, you can call django.contrib.auth.login(request, user) and force a
login without any authentication if you really wanted to. Given that, you
can make your own auth backend (subclass the default one) that returns True
for certain usernames without checking the value of the password field.

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


Re: Django Migrations?

2017-03-01 Thread Ed Sutherland




The problem surrounded a textfield that had no default. I added the 
default string and migrate complained it was an int. I changed the string and 
migrate still complains of the int default that no longer exists. On Wed, 
01 Mar 2017 15:50:07 -0500  Melvyn Sopacua wrote  On 
Wednesday 01 March 2017 13:27:37 Ed Sutherland wrote: > I am a relatively new 
Django coder. I'm building a small custom CMS. > Whenever I get deep into 
development, I run into a migration problem: > an old error keeps halting newer 
migrations. I long ago fixed the > original error, but the migration continues 
to stop due to a now > non-existent error. I know I can rollback the migration 
to the last > successful attempt, but how do I prevent this in the first place? 
  Rolling back is destructive, so never a solution for production. How you can 
eliminate the error is largely depending on the error. --  Melvyn Sopacua-- 
 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/1571910.2OvDCcMPjQ%40devstation. 
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/15a8c7a865f.bbc68ab230650.7609245323262500789%40tburgnews.com.
For more options, visit https://groups.google.com/d/optout.


Re: good 404 vs bad 404

2017-03-01 Thread Vinicius Assef
See suggestion below.

On 1 March 2017 at 13:21, guettli  wrote:
>
> Concrete example: we render HTML mails. They often contain broken links.
> I don't want to report these.

I would add a query string in these links to track them. E.g.,
"?autogenerated=1".

So, links with this query string should be filtered by monitoring
service and not notified.

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


Re: database update after paypal payment

2017-03-01 Thread Agoulou Zegouna
Thanks all ! I tried to Use django-paypal. can you please give me a
concrete example after from step 5 to 6? I have no idea of what to do?
https://django-paypal.readthedocs.io/en/stable/standard/ipn.html


On Wed, Mar 1, 2017 at 1:46 PM, Mario Gudelj  wrote:

> You should use Django-PayPal app. It has views for IPN and PDT, stores
> transaction details in DB, does TX verification and it fires of a signal
> when when a successful transaction comes in to your webhook.
>
> All you have to do is specify some URLs and settings. It'll even render
> that front end form for you using a Django form. It really is a bomb.
>
> Cheers,
>
> M
>
>
>
> On Wed, 1 Mar 2017 at 11:10 pm, Melvyn Sopacua 
> wrote:
>
>> On Tuesday 28 February 2017 21:13:39 agoulouzego...@gmail.com wrote:
>>
>> > hello! I am trying to update my database after paypal has received
>>
>> > the payment from customer. The problem is that I don't really know to
>>
>> > do it. This is what I am doing now
>>
>>
>>
>> This code is all irrelevant. This is the important URL:
>>
>> > >
>> > name="return" type="hidden" value="http://www.example.com/thank-you";>
>>
>>
>>
>> Wouldn't name it "thank-you" either. That would be the final page, but
>> the flow is:
>>
>>
>>
>> - Submit to PayPal
>>
>> - At above return_url, receive data from PayPal:
>>
>> - Check for success / failure
>>
>> - If success:
>>
>> set paid to True, redirect to /thank-you
>>
>> - else:
>>
>> display error and cart
>>
>>
>>
>> --
>>
>> Melvyn Sopacua
>>
>> --
>> 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/3452662.H3dCPjKHmD%40devstation
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/ZUBd-vcyjrs/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CAHqTbjmeT%3D8U0wPqLTPBcb6FxSPnECiaFR0Y99
> -%2B0ooZhKQK6Q%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/CAJ-4E-OqY5PE65XDoGyM%3DvB%3DN2iGE2MGTPqFdD_8BGQOxGFpMQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Djnago User login

2017-03-01 Thread Constantine Covtushenko
+1 for CustomAuth Backend solution.

In runtime Django checks all set backends in the order so I would suggest
to put your backend at the beginning of backend's list.

On Thu, Mar 2, 2017 at 12:05 AM, Shawn Milochik 
wrote:

> It takes a little fiddling, but you can log in a user however you want.
>
> https://docs.djangoproject.com/en/1.10/topics/auth/
> default/#how-to-log-a-user-in
>
> In short, you can call django.contrib.auth.login(request, user) and force
> a login without any authentication if you really wanted to. Given that, you
> can make your own auth backend (subclass the default one) that returns True
> for certain usernames without checking the value of the password field.
>
>
> --
> 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/CAOzwKwGNmQ9XL6T0Btm%3DhS0iXOasw17YPzZbsgngcRqgSU4b
> %3DQ%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/CAK52boXUEmrP1-KrrW-8z0sDL1%3DCO6Ojneh5%3DWUS-Vk5XHsuqw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.