Re: access django admin got error 500

2015-09-11 Thread James Schneider
You'll need to provide more information. What do the apache logs state that
the error was? was there a traceback? Can you enable DEBUG temporarily to
pull down the traceback?

-James
On Sep 10, 2015 11:51 PM, "erik freaks"  wrote:

> Hi, I'm new in django, I had create simple website using django and deploy
> it to apache server, but when I try to access admin page I got error 500..
>
> please someone with experience with django+apache help me..
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAAG0MBoFus7EgFE2jzKm1zVNaL%3DJoJ%2BZYpS7YxCHFtYp0TdbaA%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciXO%3DRj7%3Dk34v6BsG-Y0qOiaKou31QhrZsxj%3DJqOt18kXA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: access django admin got error 500

2015-09-11 Thread Nihad Dizdarevic
https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/#admins-and-managers

I hope this helps you

Am Freitag, 11. September 2015 08:51:51 UTC+2 schrieb freaksnoid:
>
> Hi, I'm new in django, I had create simple website using django and deploy 
> it to apache server, but when I try to access admin page I got error 500..
>
> please someone with experience with django+apache help me..
> 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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9d3b5717-8763-4c75-a06e-bdf44d53c2a8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: access django admin got error 500

2015-09-11 Thread Nihad Dizdarevic
https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/#admins-and-managers

I hope this helps you

Am Freitag, 11. September 2015 08:51:51 UTC+2 schrieb freaksnoid:
>
> Hi, I'm new in django, I had create simple website using django and deploy 
> it to apache server, but when I try to access admin page I got error 500..
>
> please someone with experience with django+apache help me..
> 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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/410ecc62-96b9-4c07-8c96-6390adb58750%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: access django admin got error 500

2015-09-11 Thread Mike Dewhirst

On 11/09/2015 3:59 AM, erik freaks wrote:

Hi, I'm new in django, I had create simple website using django and
deploy it to apache server, but when I try to access admin page I got
error 500..


Try setting DEBUG = True so Django can report the actual error for you.

Doing this is normal in development but insecure in production or where 
the public might see the error detail.




please someone with experience with django+apache help me..
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CAAG0MBoFus7EgFE2jzKm1zVNaL%3DJoJ%2BZYpS7YxCHFtYp0TdbaA%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/55F27E79.2070805%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: access django admin got error 500

2015-09-11 Thread swaraj aryan
Try to use wsgi thing.also u have to install wsgi module and also mention
that in httpd.conf file about wsgi module.later make sure you are
mentioning right path in conf file directing towards right django code.
On 11 Sep 2015 12:21, "erik freaks"  wrote:

> Hi, I'm new in django, I had create simple website using django and deploy
> it to apache server, but when I try to access admin page I got error 500..
>
> please someone with experience with django+apache help me..
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAAG0MBoFus7EgFE2jzKm1zVNaL%3DJoJ%2BZYpS7YxCHFtYp0TdbaA%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEM0KbFWLHAf9ZVBXOJ%3DsGts8Nedhw-YCd%2BNsXi9%3DLFnbjOLuw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: access django admin got error 500

2015-09-11 Thread asarkar1...@gmail.com
Where are you hosting this web site ?

Sent from my HTC

- Reply message -
From: "erik freaks" 
To: 
Subject: access django admin got error 500
Date: Fri, Sep 11, 2015 8:29 AM
Hi, I'm new in django, I had create simple website using django and deploy it 
to apache server, but when I try to access admin page I got error 500..

please someone with experience with django+apache help me..
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAG0MBoFus7EgFE2jzKm1zVNaL%3DJoJ%2BZYpS7YxCHFtYp0TdbaA%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/55f288fa.89fb420a.31417.191b%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.


Generating a timeseries and aggregation/annotation using QuerySet.extra()

2015-09-11 Thread Wannabe Coder
Hello everyone!

I already created a ticket  
detailing my use case, and one of the developers pointed me to this 
discussion group. I am not quite satisfied with the response I got since 
the DateTransforms that will be released in Django 1.9 only appear to 
extract year/month/day/etc numbers and do not seem to be able to annotate 
based on generated time periods from a series of dates/datetimes. Basically 
what I can do with .extra() right now is generate a table like the ones 
shown in my screenshots.

I hope that behavior would be possible to customize or even include in 
Django 1.9 out of the box. 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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/796ec525-453e-4a04-892f-671744364fc5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Generating a timeseries and aggregation/annotation using QuerySet.extra()

2015-09-11 Thread 'Tom Evans' via Django users
On Fri, Sep 11, 2015 at 1:15 PM, Wannabe Coder  wrote:
> Hello everyone!
>
> I already created a ticket detailing my use case, and one of the developers
> pointed me to this discussion group. I am not quite satisfied with the
> response I got since the DateTransforms that will be released in Django 1.9
> only appear to extract year/month/day/etc numbers and do not seem to be able
> to annotate based on generated time periods from a series of
> dates/datetimes. Basically what I can do with .extra() right now is generate
> a table like the ones shown in my screenshots.
>
> I hope that behavior would be possible to customize or even include in
> Django 1.9 out of the box. Thanks!

I think you have slightly misunderstood. The Expressions and Transform
API allows *you* to create user defined expressions and
transformations. Yes, there are some new built in expressions and
transformations available, but the real power is allowing you to
define such a transformation in a reusable way, rather than hacking it
in to extra() like you currently have to do in each place you want to
use it.

So you want an expression that is like MonthTransform, but using
DATE_TRUNC() instead of MONTH()? Have at it! It's a documented API:

https://docs.djangoproject.com/en/dev/ref/models/lookups/#transform-reference

The DB backends operations class even support a datetime_trunc_sql()
(compare with the implementation of DateTransform, base class of
MonthTransform)

https://github.com/django/django/blob/master/django/db/models/fields/__init__.py#L2432

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1KfNPY2mHUR3A1WtsrQ1qfJxKYnVFJb%3DQBTSgt2Om%2B%3D%2BQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to "stop" validation when having errors (is_valid) for form?

2015-09-11 Thread 'Tom Evans' via Django users
On Fri, Sep 11, 2015 at 7:37 AM,   wrote:
> Example: I have 2  on a html page, which is a form (assume it is
> login form, with username and password, both are required and will do
> validation on this.).
>
> The behavior of is_valid I see is:
> When submit, the returned errors for the form are:
> This field is required (for username)
> This field is required (for password)
> We'll usually render these messages for the fields (example: {{ form }} will
> automatically do all these).
>
> Now, my question is, it seems like is_valid will trigger validation on both
> username and password every time? How to stop it in case one field cannot
> pass the validation? Does it make sense to validate all these always? I
> think in some of web pages, the behaviour we see is, when one field does not
> fulfill the requirements, it give an error message for this only, and when
> user submit again but the next field does not fulfill the requirement, it
> give error for this field.
>
> Current behaviour in django:
> user name: .(input box)
> password: (input box)
> Submit without any value, we get:
> user name: .(input box) This field is required
> password: (input box)This field is required
>
> I expect:
> user name: .(input box) This field is required
> password: (input box)(No error here)
>
> If username is entered and password is empty, submit again, we'll get:
> user name: what you enter here (input box)
> password: (input box)   This field is required
>
> Any idea how to achieve this?
>

"required" means "always required", but you wish to only have the
password required when the username is also provided.

Therefore, set password as not required, and add a check in clean()
that applies your special logic and assigns the error message to the
appropriate field.

Eg:

  def clean(self):
  data = super(MyForm, self).clean()
  user = data.get('username')
  password = data.get('password')
  if user and not password:
  self.add_error('password', 'This field is required')

See also:

https://docs.djangoproject.com/en/1.8/ref/forms/validation/#cleaning-and-validating-fields-that-depend-on-each-other

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1JXZNQ2Tw00yxb-hZiOCN6%3D5zm03AECSEj9jDBdVEOt2A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Any good tutorials for django-rest-framework and React.Js?

2015-09-11 Thread Derek
I am curious - in a previous thread, many respondents pointed out Angular 
as being a good framework to use, and one poster said "a quick Google 
search shows that React is barely supported yet (in terms of available 
Django apps)" - so why are you choosing that route?  Given you already said 
"I am an Javascript Beginner and I need to start it from scratch"  why not 
just pick a well-supported framework than struggle from the beginning?

On Thursday, 10 September 2015 16:00:18 UTC+2, ThomasTheDjangoFan wrote:
>
> Hi guys,
>
> I'm trying to get my head into how to use React.Js with Django.
>
> I did the tutorial http://facebook.github.io/react/docs/tutorial.html
> in combination with checking out 
> https://github.com/HorizonXP/react-tutorial-django,
> which is an implementation if it with running django 1.6.
>
> I'm having problems getting the connection to django-rest-framework 
> running for CRUD Stuff.
>
> Are there any more *tutorials* available on how to implement an 
> application 
> *with React.js and Django-Rest-Framework?*
>
> Kind 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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5fd16105-44f6-455f-9d71-a9abdfb06286%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django 1.8 , makemigrations throwing errors

2015-09-11 Thread John Emmatty
I ran makemigrations against my legacy, MySQL database and it created 
models.py file for me, I copied the file to my applications package 
directory and ran makemigrations again after adding a table to extend the 
default users table. Now makemigrations is throwing following errors . I 
created a fresh django project which had no reference to older versions.

SystemCheckError: System check identified some issues:

ERRORS:
djangogettrix.AuthGroupPermissions: (models.E012) 'unique_together' 
refers to the non-existent field 'group_id'.
djangogettrix.AuthGroupPermissions: (models.E012) 'unique_together' 
refers to the non-existent field 'permission_id'.
djangogettrix.AuthPermission: (models.E012) 'unique_together' refers to 
the non-existent field 'content_type_id'.
djangogettrix.AuthUserGroups: (models.E012) 'unique_together' refers to 
the non-existent field 'group_id'.
djangogettrix.AuthUserGroups: (models.E012) 'unique_together' refers to 
the non-existent field 'user_id'.
djangogettrix.AuthUserUserPermissions: (models.E012) 'unique_together' 
refers to the non-existent field 'permission_id'.
djangogettrix.AuthUserUserPermissions: (models.E012) 'unique_together' 
refers to the non-existent field 'user_id'.
djangogettrix.RolesUsers: (models.E012) 'unique_together' refers to the 
non-existent field 'role_id'.
djangogettrix.RolesUsers: (models.E012) 'unique_together' refers to the 
non-existent field 'user_id'.

Kindly help me by throwing some light on this.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f69f98af-d51a-4e4c-868b-b57fdc639a3a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Any good tutorials for django-rest-framework and React.Js?

2015-09-11 Thread ThomasTheDjangoFan
Hi Derek,

right now React.js is seems to be talked about everywhere. I actually 
listend to some podcasts talking about it - like I said the meteor 
community seems to be a big fan and meteor even has core support for it. 
And even LincolnLoop say that they use react.

So when starting this threat I had react and angular and  on my final list 
to try out.

Today I actually had a look at angular and - after my current struggle with 
react.js - angular.js looks really nice.

So this threat right here is meant as a collection for react.js tutorials.

How about you - what framework are you using?

Kind regards
Thomas


Am Freitag, 11. September 2015 20:03:57 UTC+2 schrieb Derek:
>
> I am curious - in a previous thread, many respondents pointed out Angular 
> as being a good framework to use, and one poster said "a quick Google 
> search shows that React is barely supported yet (in terms of available 
> Django apps)" - so why are you choosing that route?  Given you already said 
> "I am an Javascript Beginner and I need to start it from scratch"  why not 
> just pick a well-supported framework than struggle from the beginning?
>
> On Thursday, 10 September 2015 16:00:18 UTC+2, ThomasTheDjangoFan wrote:
>>
>> Hi guys,
>>
>> I'm trying to get my head into how to use React.Js with Django.
>>
>> I did the tutorial http://facebook.github.io/react/docs/tutorial.html
>> in combination with checking out 
>> https://github.com/HorizonXP/react-tutorial-django,
>> which is an implementation if it with running django 1.6.
>>
>> I'm having problems getting the connection to django-rest-framework 
>> running for CRUD Stuff.
>>
>> Are there any more *tutorials* available on how to implement an 
>> application 
>> *with React.js and Django-Rest-Framework?*
>>
>> Kind 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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/358b261e-b4df-4bf5-9f81-87b8f55cdc11%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Angular.js advanced tutorials?

2015-09-11 Thread ThomasTheDjangoFan
Hi guys,

I am searching for an angular.js tutorial that shows me how to do some 
enhanced ui stuff:
1) What is best practise for have *multiple forms* (formsets with 
inline-forms, *for example multiple adresses for a contact* as an 
inline-form) on one page with angularjs and connect it to a model *via the 
rest-framework*? How do I do *DRY form-validation* for the formset, so that 
each field can show an error that was validaded on the server? How do I 
implement *custom field/model validations*?
2) How do I implement a *filterable and sortable list-view (*for example a 
contact-model) and edit the single contact via a detail-update-view placed 
in a bootstrap *modal-window*? Something like django_tables2 and 
django_filters but in angular? How do I make the list-detail-data update 
after an edit of an item in the modal window?
3) What is best practise for authorisation?

Here is the *my current list of tutorials* that I want to have a deeper 
look at next week:
1) free 
http://blog.kevinastone.com/getting-started-with-django-rest-framework-and-angularjs.html
2) 19$ https://thinkster.io/django-angularjs-tutorial/
Both of the above tutorials seem to have quite simple use cases.

*Are there any more advanced tutorials ** you can also recon?*

Kind 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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0c12a7b0-9e24-4f9f-bfb4-0a6682b10a9e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What frontend-tools to use for a new CRM project? Shall I use Django OR switch to Meteor.js?

2015-09-11 Thread ThomasTheDjangoFan
Hi guys,

I started checking out angular.js - it looks really good. It seems like it 
has a lot of great tools build in - just like you have said.

In search for more advanded and detailed angular-tutorials I opened this 
new topic: 
https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!topic/django-users/zH90eCGbDbQ

Thanks a lot for your help so far!

Kind regards
Thomas

Am Donnerstag, 10. September 2015 16:03:37 UTC+2 schrieb ThomasTheDjangoFan:
>
> Hi guys,
>
> on my journey to picking my js-framework I am now trying out React.js and 
> I opened this thread in search for good tutorials 
> https://groups.google.com/forum/#!topic/django-users/NxDOYhqqQJw .
> I guess I'll also have a look at the angular stuff.
>
> This really is about having good tutorials - I need a good tutorial to get 
> me started. 
> It's a real pity that there seems to be nothing available for React.js ...
>
> Thanks a lot for your help so far!
>
> Kind 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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/353995c1-235f-4525-a027-9fe1d0dba943%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Angular.js advanced tutorials?

2015-09-11 Thread Javier Guerra Giraldez
On Fri, Sep 11, 2015 at 5:03 PM, ThomasTheDjangoFan
 wrote:
> I am searching for an angular.js tutorial that shows me how to do some
> enhanced ui stuff:


i think both angular and react are oriented primarily not to "enhanced
ui", but to whole frontend applications.  with that in mind, you'll
find that most examples and tutorials treat the server either as an
API provider (typically REST), or tightly cohesioned with the frontend
(as is with meteor and some other JS frameworks)

of course it _is_ possible to use either for enhanced ui, just don't
be surprised for the lack of examples, and the feeling that you're
killing flies by swinging a big couch.

-- 
Javier

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFkDaoQg9Mm41LMCmvmb%3D0BfK8By5r8sLnrqaLEqGDSO6y44oA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Downsides of calling Model.clean() from Model.save()?

2015-09-11 Thread TheBeardedTemplar
Hey all,

I have a model with some fairly strict rules on what is or isn't allowed 
and I'd like to perform some validation. The model is created via various 
forms, other functions, and via api calls and so validating the data before 
the model is created would be quite complicated. Reading on Stack Overflow, 
people seem to caution against overriding the Model.save() function to call 
a clean function which checks for these issues. However all the posts I've 
seen on it were from Django 1.2 or 1.3 and I'm not certain if they're still 
relevant. So Is there a reason not to do it this way? If so, what would a 
good solution be.

Example Code:
class MyModel:

def save(self, *args, **kwargs):
"""
Override the save function to provide some validation on the model.
"""
self.clean()
super(MyModel, self).save(*args, **kwargs)


def clean(self):
if badThing == True:

raise ValidationError("This data is bad and you should feel bad"
)
   

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b992f985-d640-4247-a291-f0932cd7ade8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Self-referential User relationship

2015-09-11 Thread thinkwell
Hello,

I have to do a bit of a code rewrite and I want to measure twice and cut 
once with this. 

I need to store use extra information about each user, so I'm creating a 
profile. And each user can follow other users, so I create a ManyToMany 
field referencing the User model, and not "self" correct?

Like so:

 class Profile(models.Model):
   """Storing extra info about user"""
   name = models.OneToOneField(User, related_name='profile')
   moreinfo = models.TextField()
 
   friends = models.ManyToManyField(User, blank=True, through='Relationship',
   symmetrical=False,
   related_name='relationship')
 
 
 class Relationship(models.Model):
   from_user = models.ForeignKey(User, related_name='from_user')
   to_user = models.ForeignKey(User, related_name='to_user')
   rtype = models.TextField()
   moreinfo = models.TextField(null=True, blank=True)
 
 class Meta:
   unique_together = ('from_user', 'to_user')




*Rather than like so:*


 class Profile(models.Model):
   """Storing extra info about user"""
   name = models.OneToOneField(User, related_name='profile')
   moreinfo = models.TextField()
 
   friends = models.ManyToManyField(self, blank=True, through='Relationship',
   symmetrical=False,
   related_name='relationship')
 
 
 class Relationship(models.Model):
   from_user = models.ForeignKey(Profile, related_name='from_user')
   to_user = models.ForeignKey(Profile, related_name='to_user')
   rtype = models.TextField()
   moreinfo = models.TextField(null=True, blank=True)
 
 class Meta:
   unique_together = ('from_user', 'to_user')

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/efbefe7d-2d05-421a-a8b0-b64821a40750%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: CSRF cookie not set issue

2015-09-11 Thread Kevin Anyanwu
Can anyone help ?

On Thu, Sep 10, 2015 at 8:34 PM, Kevin Anyanwu 
wrote:

> base_1.html
>
> 
> 
>   
> 
> 
> goals
> 
> 
>
> 
> 
> 
>
>   
>   
>
> 
> 
> Cirriculmn
> Notes
> Collaborte
> 
>
>
>   
>  charset="utf-8">
> 
> 
> 
>   
> 
>
> On Thu, Sep 10, 2015 at 8:49 AM, monoBOT  wrote:
>
>> show us the base_1.html
>>
>> 2015-09-10 16:18 GMT+01:00 :
>>
>>> By the way, I am using Django 1.8.3 (final)
>>>
>>>
>>> On Thursday, September 10, 2015 at 8:16:11 AM UTC-7,
>>> kany...@fonality.com wrote:

 First of all I have done my research and found no reasonable
 explanation for my issue. I have a site on heroku that works fine on the
 first page, but when I click a button that I have programmed to go to
 another page, I obtain the infamous CSRF error. The reason for this error
 is CSRF cookie is not set. Here is a description of the background work
 done on the dev side:

 1. Settings.py

 MIDDLEWARE_CLASSES = (
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 #'django.middleware.security.SecurityMiddleware',
  'django.middleware.csrf.CsrfViewMiddleware',
 )

 2. base.py

 >>> "/menu/">
 {% csrf_token %}

 
 
 
 
 
   >>> placeholder="Password" type="text">
 
 
 

 Log In

 

   

 3. views.py

 def menu(request):

 return render_to_response('home/base_1.html', context_instance =
 RequestContext(request, {}) )

 4. javascript for the function logIn() that is executed when the button
 is clicked from (2)


 function logIn ()
 {
 alert('Form has been submitted');
 document.getElementById('loginform').submit();
 }

 I am seriously bewildered and cannot understand why the base_1.html
 site is not being rendered and I am getting this CSRF error ! Please help
 me,





 --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/14ec3bc1-c7ff-4d3e-8065-9eae959720fc%40googlegroups.com
>>> 
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> *monoBOT*
>> Visite mi sitio(Visit my site): monobotsoft.es/blog/
>>
>> --
>> 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/scpBffl8s3A/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 http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CA%2BxOsGCqOXSCs7dFDTNNfgEgKHk2vsbXNEmFN4LpkgNabgjVNA%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAE1x1E12Yg%3DJWs9Q1vgnVwgJkBLOxU9CKjij5POzQUXFERDkEw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Generating a timeseries and aggregation/annotation using QuerySet.extra()

2015-09-11 Thread Wannabe Coder
Alright I get it now! Thanks for the clarification! From the looks of it, 
being able to manipulate lhs and rhs can cover a lot of possible SQL 
statements in a very reusable way, though it will still be nice to have 
that kind of transform/expression available out-of-the-box, since I think 
it is a common use case. Any idea if the Django team will include that?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e2183b64-0cac-4e01-94f7-3ca2c4f266ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Generating a timeseries and aggregation/annotation using QuerySet.extra()

2015-09-11 Thread Wannabe Coder
Alright I get it now! Thanks for the clarification! From the looks of it, 
being able to manipulate lhs and rhs can cover a lot of possible SQL 
statements in a very reusable way, though it will still be nice to have 
that kind of transform/expression available out-of-the-box, since I think 
it is a common use case. Any idea if the Django team will include that?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6dc140e2-1e48-40c2-857a-cfc7ae25fcac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Angular.js advanced tutorials?

2015-09-11 Thread ThomasTheDjangoFan
Hi Javier,

yeah it seems like angular is gonna take over the whole page (though it 
depends on which dom element you target it).

Right now I am planning to only use it for certain use-cases and stick to 
standard django-templates for the easy stuff.
But I guess you end up having REST-APIs for a lot of models - even if you 
use angular in just one interactive use case.

Anyways: Aren't complex UIs part of frontend applications?

*Example (this list-view / edit-view):*
*List-View: *Let's talk about the example of having a list-view of a 
contacts to display them. We want the user to see all contacts in a list 
and to be able to sort and filter the contacts within the list table (right 
now I am using Django-CBV and django_tables2/django_filters).
*Edit-View: *Plus we want the user to be able to edit a single contact in a 
*modal* edit-window (in standard django we would use a 
create-update-django-CBV).
*Connecting **List-View&**Edit-View via Javascript: *Now after editing a 
single contact we could automatically update the underlying listview with 
the new contact-data (while keeping it in sync with the django-model via 
the rest framework).

*How do we do that with angular? There must be a tutorial... or not?*

Kind regards
Thomas



Am Samstag, 12. September 2015 00:15:14 UTC+2 schrieb Javier Guerra:
>
> On Fri, Sep 11, 2015 at 5:03 PM, ThomasTheDjangoFan 
> > wrote: 
> > I am searching for an angular.js tutorial that shows me how to do some 
> > enhanced ui stuff: 
>
>
> i think both angular and react are oriented primarily not to "enhanced 
> ui", but to whole frontend applications.  with that in mind, you'll 
> find that most examples and tutorials treat the server either as an 
> API provider (typically REST), or tightly cohesioned with the frontend 
> (as is with meteor and some other JS frameworks) 
>
> of course it _is_ possible to use either for enhanced ui, just don't 
> be surprised for the lack of examples, and the feeling that you're 
> killing flies by swinging a big couch. 
>
> -- 
> Javier 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6470268f-c91e-4c9b-a9eb-3300b8a5e26a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.