Weird issue with a form

2024-03-19 Thread 'Simon Connah' via Django users
I've been scratching my head over this one.

I have a user registration form but when I submit data on it and it always 
returns a 404 (it wants to go to the /users/accounts/ URL) but there are no 
URLs there. It initially went to /user/ but I created the view it was looking 
for but it just then moved to /user/accounts/.

I have added the get_success_url to point to the correct URL using reverse but 
even that doesn't work. Can someone help me out with this please?

Thank you.

Simon.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/DuQl41jFoSkfZGUn35r4DdcARH3iV1InUZ5sozg4Jg4EfJ1tQPYGcC7WVs0Pr8UzyLtYWDXp5TiS0rBzC2QCRjXbSoR3bWwLRIbnK7f8bqA%3D%40protonmail.com.


signature.asc
Description: OpenPGP digital signature


Registration form in template

2024-03-17 Thread 'Simon Connah' via Django users
I have a register user template with a form which works well but I have a 
problem where there is lots of other text next to the form elements such as 
password length and what characters need to go in a password. Is their a 
reasonable way to hide that text or do I need to do it with JavaScript?

Thank you.

Simon.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/xepYvHchH7kpHYeaYe7ByePm8VQYSjgIEzyGjSKDhOcAOhbh7j1vLmwSgLEgC5kkq-wYMOHjPM7--mLSu9w22I_BT9A-sQjZgTxVi9RR8IM%3D%40protonmail.com.


signature.asc
Description: OpenPGP digital signature


Strange bug with Firefox

2023-10-14 Thread 'Simon Connah' via Django users
Hi,

I have a strange issue that affects the latest stable version of Firefox and 
the latest Firefox Developer Edition as well. I'm making a custom user and am 
just setting all the forms up. I can login with the user and when I go to the 
password change form it is displayed correctly in Firefox but if I right click 
and click view source it shows a completely different form. On the other hand 
when I use Chrome and Chrome Developer Edition it shows the correct form and 
works exactly as intended. I've never seen anything like this before. I thought 
it was a problem with a browser extension so I removed them all (apart from 
Bitwarden) and completely cleared the history but none of that seems to have 
fixed the issue.

I'm at a loss. Can someone suggest what might be going on here? As I said it 
works fine in Chrome.

Simon.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/zT7ozAu9QZo4FQ9XwBRiSTIc2ZwYA3eknb3Z-NJpibp6KIw3I9HmI0vOjhwtoyUux2qIu_Zqa3dI3ecbdkQKWdHmT86PsXQ378hsYbrp3gw%3D%40protonmail.com.


signature.asc
Description: OpenPGP digital signature


Re: Unit test to make sure correct template is returned from a specific URL?

2023-09-25 Thread 'Simon Connah' via Django users
Thank you very much!


--- Original Message ---
On Monday, September 25th, 2023 at 14:07, Muhammad Juwaini Abdul Rahman 
 wrote:


> Use assertTemplateUsed.
> https://docs.djangoproject.com/en/dev/topics/testing/tools/#django.test.SimpleTestCase.assertTemplateUsed
> 

> On Sun, 24 Sept 2023 at 22:37, 'Simon Connah' via Django users 
>  wrote:
> 

> > I can write a unit test which checks say the title on a page and compares 
> > it to a string but that is really prone to breakage. What I want to do 
> > instead is to check that the template that is returned by the URL is the 
> > same one that is expected in the unit test. Is there an easy way to do 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 view this discussion on the web visit 
> > https://groups.google.com/d/msgid/django-users/MnCVU2YvJzLiFdMPPAVBwMY7SMosqS5wvqopbySnD05i7BTc375v_Bo5GB4VlUQSd5K2OwsiblAbxsfsz7in96L4_Ou4RTRm0jwVN3aMp54%3D%40protonmail.com.
> 

> --
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAFKhtoRiz4mr69ZLu7_wCxVFXgjnvmAW3JCoYdcDrx%2Bwu94vrw%40mail.gmail.com.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/O_3E4w3kT2FE_XgQrWGfQFM_DcKq_syuWJ0eEuZ0zJfIPnZ6rzbF80z28SORLG9r7rik-evYNQhGnchpIcEDOP9zqIX9n_xOntOTHDAbv4M%3D%40protonmail.com.


signature.asc
Description: OpenPGP digital signature


Unit test to make sure correct template is returned from a specific URL?

2023-09-24 Thread 'Simon Connah' via Django users
I can write a unit test which checks say the title on a page and compares it to 
a string but that is really prone to breakage. What I want to do instead is to 
check that the template that is returned by the URL is the same one that is 
expected in the unit test. Is there an easy way to do 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/MnCVU2YvJzLiFdMPPAVBwMY7SMosqS5wvqopbySnD05i7BTc375v_Bo5GB4VlUQSd5K2OwsiblAbxsfsz7in96L4_Ou4RTRm0jwVN3aMp54%3D%40protonmail.com.


signature.asc
Description: OpenPGP digital signature


Re: Splitting views.py and urls.py into a directory rather than single files

2023-09-18 Thread 'Simon Connah' via Django users
Thank you! That got it working!


--- Original Message ---
On Monday, September 18th, 2023 at 13:34, Asim Sulehria 
 wrote:


> You can just directly declare an array of URL Patterns in a separate file and 
> then import that file in the url files you want to make the main urls file
> 

> On Mon, Sep 18, 2023 at 5:28 PM 'Simon Connah' via Django users 
>  wrote:
> 

> > Hi,
> > 

> > I have an app which has a lot of views and URLs and keeping them in just 
> > one file makes it really hard to manage because it is so long. I'd like to 
> > make a views and URLs folder which will allow me to break up views and URLs 
> > into different categories but I'm not sure what the best way to go about 
> > doing that is.
> > 

> > Can someone point me in the right direction please?
> > 

> > Thank you!
> > 

> > Simon.
> > 

> > --
> > 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 view this discussion on the web visit 
> > https://groups.google.com/d/msgid/django-users/4svI0xN0uu53BvHzhG9Aa1qvI61v1qPlQOhkOLpaJPRXX1Jysfu-BOmrFlBsDOfHfKRHwTaXJNmKFApZ1W13jQLdpVvXQDEPdWq87T-ILR8%3D%40protonmail.com.
> 

> --
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAPz57eGK6EXPGObGH5-ej3OPGvEmox%2BkR34xW3Eg1weWQug%3Dcw%40mail.gmail.com.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d3_jwrhlaNWhn-_QfIOhopznbSi5o3e5tF5p-pF34iqaGFRRBVFScOg6PL95XWeJIBV6JpmQpXg0L0FcGNH9fjM5CItLGCZ8mIoJqNxEohU%3D%40protonmail.com.


signature.asc
Description: OpenPGP digital signature


Splitting views.py and urls.py into a directory rather than single files

2023-09-18 Thread 'Simon Connah' via Django users
Hi,

I have an app which has a lot of views and URLs and keeping them in just one 
file makes it really hard to manage because it is so long. I'd like to make a 
views and URLs folder which will allow me to break up views and URLs into 
different categories but I'm not sure what the best way to go about doing that 
is.

Can someone point me in the right direction please?

Thank you!

Simon.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4svI0xN0uu53BvHzhG9Aa1qvI61v1qPlQOhkOLpaJPRXX1Jysfu-BOmrFlBsDOfHfKRHwTaXJNmKFApZ1W13jQLdpVvXQDEPdWq87T-ILR8%3D%40protonmail.com.


signature.asc
Description: OpenPGP digital signature


Re: UpdateView and DeleteView

2023-08-27 Thread 'Simon Connah' via Django users
Will do! Thank you for your help.


--- Original Message ---
On Saturday, August 26th, 2023 at 19:30, Ruby  wrote:


> I'm glad it worked out,Consider using LoginRequiredMixin to ensure that 
> current user is authenticated before accessing the view.
> 

> 

> On Sat, Aug 26, 2023, 16:23 'Simon Connah' via Django users 
>  wrote:
> 

> > Thank you! That is very helpful.
> > 

> > 

> > --- Original Message ---
> > On Saturday, August 26th, 2023 at 14:07, Ruby  
> > wrote:
> > 

> > 

> > > You can simply set a test case using the built-in user passes test 
> > > (https://docs.djangoproject.com/en/4.2/topics/auth/default/#django.contrib.auth.decorators.user_passes_test)
> > > 

> > > On Sat, Aug 26, 2023, 11:20 'Simon Connah' via Django users 
> > >  wrote:
> > > 

> > > > I want to make sure that the only people who can update and delete an 
> > > > object are either superusers or the person that originally created them 
> > > > but I'm not sure how to go about doing it. Can someone point me in the 
> > > > right direction?
> > > > 

> > > > I'm not sure which method(s) to override.
> > > > 

> > > > Thank you.
> > > > 

> > > > 

> > 

> > --
> > 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 view this discussion on the web visit 
> > https://groups.google.com/d/msgid/django-users/iT1fh6Btk96LInLjgvQNNIOeqZTL6TMcV5IbsAmfVdnR1ujaNPCbV_zhJeXr5o7emCHzK_BHnYDtyxQ1ZJVu7oDGqyDRkJirWsaGto-5bbA%3D%40protonmail.com.
> 

> --
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAPUD46vM6PEJK4btLa-DCF8-VvExdnJ2OpzB0-Z6h03CVWvzOg%40mail.gmail.com.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/nMbslf1DnsTi42UmcaQZjvuHxoVVxPQapPAABp-aN5zswI1iBp61YS-J9IwUsRPyTb_87IJsY5rMktNRS9h6rY57zUjT_4fJzdSU8Dxuiec%3D%40protonmail.com.


signature.asc
Description: OpenPGP digital signature


Re: UpdateView and DeleteView

2023-08-26 Thread 'Simon Connah' via Django users
Thank you! That is very helpful.


--- Original Message ---
On Saturday, August 26th, 2023 at 14:07, Ruby  wrote:


> You can simply set a test case using the built-in user passes test 
> (https://docs.djangoproject.com/en/4.2/topics/auth/default/#django.contrib.auth.decorators.user_passes_test)
> 

> On Sat, Aug 26, 2023, 11:20 'Simon Connah' via Django users 
>  wrote:
> 

> > I want to make sure that the only people who can update and delete an 
> > object are either superusers or the person that originally created them but 
> > I'm not sure how to go about doing it. Can someone point me in the right 
> > direction?
> > 

> > I'm not sure which method(s) to override.
> > 

> > Thank you.
> > 

> > 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/iT1fh6Btk96LInLjgvQNNIOeqZTL6TMcV5IbsAmfVdnR1ujaNPCbV_zhJeXr5o7emCHzK_BHnYDtyxQ1ZJVu7oDGqyDRkJirWsaGto-5bbA%3D%40protonmail.com.


signature.asc
Description: OpenPGP digital signature


UpdateView and DeleteView

2023-08-26 Thread 'Simon Connah' via Django users
I want to make sure that the only people who can update and delete an object 
are either superusers or the person that originally created them but I'm not 
sure how to go about doing it. Can someone point me in the right direction?

I'm not sure which method(s) to override.

Thank you.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/RC50Lr8yv1j7M_cjvPHLpvLJ1RzHJP3QQaF5oQu4vAmfeijfMbprfVyyHGTIvg9udwKhe_-XcM9tYH9tRyaX-MDQauXKf3PiJbMOq2hEfj4%3D%40protonmail.com.


signature.asc
Description: OpenPGP digital signature


Building a modular app?

2023-04-02 Thread 'Simon Connah' via Django users
Hi,

I want to make a blogging platform and have a question about organising the 
project.

With my blog, I'll have the blog in one Django app and then have something like 
a forum in another app, along with additional functions in other apps. Also, 
I'd like to have a single-user system that uses AbstractUser (or 
AbstractBaseUser).

So how do all apps require my AbstractUser class for authentication, and then 
the other apps be added or removed based on what is needed for each site? I 
want to split auth from the rest project.

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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/Y-FsxPZKXSIkwB9-Hj599nnwPVu5XWMbDlfv0HEnIu9cLNeRU5b-1egUTZv8vUpHVLc4uq6oP8pVEXlxW9PqVDQQMud9BJBdBn6V6EI0hEM%3D%40protonmail.com.


signature.asc
Description: OpenPGP digital signature


Best way to structure this Django project

2018-12-02 Thread Simon Connah

Hi,

I have a bit of a problem with structuring a Django project. I have a 
UserProfile app which stores extra information about users using a 
OneToOneField to the Django auth user model.


I have a products app which has two models relating to two types of 
products and finally I have a payments app which contains all the code 
needed to integrate with the Stripe payment processor.


My problem is fairly simple. When someone buys a product I obviously 
want to take them to a payment page but if I carry on with my current 
structure that would require redirecting to a view in the payments app 
as it will contain code to work with the Stripe API but it would also 
require access to the product model(s) which would hard code a 
dependency between the payments app and the products app.


Is there anyway I can rearrange my project so I can avoid this hard 
coded dependency?


--
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/12030aa1-69ad-dc7f-c3be-72e8e2f9b50e%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Easiest front end JavaScript framework to integrate with a Django backend?

2018-11-27 Thread Simon Connah
I'm in the process of building a website in Django and need to make a 
specific part of my application dynamic. Because of that I'd like to use 
a JavaScript frontend framework to build this portion of the site.


I was wondering if anyone had any recommendations for which JavaScript 
framework I should use that integrates well with a Django backend?


If anyone is curious I am working on an auction style website.

Thank you for any help.

--
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/ee666748-f8c9-37c9-5c12-491ef61ab70d%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Passing Django Template Vars to JS

2018-06-11 Thread Simon Connah
Hi Vijay,

Thank you very much for the reply and sorry for the late reply.

You are completely right about not having multiple elements with the
same ID. I completely forgot that an ID was meant to be unique on a
page. I'll change it to a class.

I like the idea of the custom attribute. I'll do that then.

Simon.
On Mon, 11 Jun 2018 at 02:04, Vijay Khemlani  wrote:
>
> I'm not sure why your code does not work (maybe there is a "race condition" 
> between the JS click handlers), but that global variable is a bad idea in 
> general.
>
> You can add the comment ID as an attribute to your button, like
>
> 
>
> and in your event handler obtain the comment id
>
> $("#like_comment_button").click(function (event) {
>var comment_id = event.target.getAttribute('data-comment-id')
>// Call AJAX
> })
>
> That way you don't need the global variable or the other click handler
>
> Finally, it's a bad idea to have multiple elements with the same ID (all 
> comments will have a button with ID "like_comment_button") so it's better to 
> add it as a class rather than an id.
>
> Regards
>
>
>
>
>
> On Sun, Jun 10, 2018 at 11:19 AM Simon Connah  wrote:
>>
>> I know that the standard way to do this is to create a script tag with
>> a global JS variable in your Django template before you import your
>> other JS files but that won't work for my current situation.
>>
>> I have an article detail view which is a single model instance. But I
>> also have a list of comment objects that have a Foreign Key to the
>> article (because that is the article that is being commented on).
>>
>> I need to pass the comment_id to the JS files that I am loading. If
>> you want to see the code I am using then you can see it here:
>>
>> https://gitlab.com/glamorous-systems/seductive/blob/master/blog/templates/blog/article_detail.html
>>
>> I thought I'd use an onclick event on the Like / Dislike button to
>> call a JS function which then passes that value to this JS file:
>>
>> https://gitlab.com/glamorous-systems/seductive/blob/master/blog/static/js/pass_comment_id.js
>>
>> and then I'd just call the return_comment_id() function from my other
>> JS files to get the comment_id of the specific comment the user
>> clicked the Like / Dislike button for. I think the problem is that my
>> jQuery AJAX selectors are also looking for a click event, so they
>> happen in a strange order, but I'm not sure.
>>
>> I'm totally lost on what I should be doing here. Any help would be
>> very much appreciated :).
>>
>> --
>> 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/CADNsu1OksTqc2crvX%3DK%3D_Kf_Xz1fCfABTRV-q48htRUikiAtXA%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/CALn3ei0ZneJzKAbSyN958_1RCaS7kjQY6VszQb8a%3D-Mxgod-GQ%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/CADNsu1PL7dT%2BhXgMc8r9arVZY2pXYxP8hQWywn5u8OqSKaBLHw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Passing Django Template Vars to JS

2018-06-10 Thread Simon Connah
I know that the standard way to do this is to create a script tag with
a global JS variable in your Django template before you import your
other JS files but that won't work for my current situation.

I have an article detail view which is a single model instance. But I
also have a list of comment objects that have a Foreign Key to the
article (because that is the article that is being commented on).

I need to pass the comment_id to the JS files that I am loading. If
you want to see the code I am using then you can see it here:

https://gitlab.com/glamorous-systems/seductive/blob/master/blog/templates/blog/article_detail.html

I thought I'd use an onclick event on the Like / Dislike button to
call a JS function which then passes that value to this JS file:

https://gitlab.com/glamorous-systems/seductive/blob/master/blog/static/js/pass_comment_id.js

and then I'd just call the return_comment_id() function from my other
JS files to get the comment_id of the specific comment the user
clicked the Like / Dislike button for. I think the problem is that my
jQuery AJAX selectors are also looking for a click event, so they
happen in a strange order, but I'm not sure.

I'm totally lost on what I should be doing here. Any help would be
very much appreciated :).

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


Django and Visual Studio Code

2018-04-30 Thread Simon Connah
I've got most of Visual Studio Code configured for Django development
(I'm trying it out to see if I can ditch PyCharm and save some money)
and almost everything seems OK.

I set the Python path to be the one in the virtual environment, and if
Visual Studio Code needs to install any modules, they go into the
virtual environment.

The major problem is that when I open a terminal in Visual Studio
Code, it doesn't automatically activate the virtual environment, so I
have to source it manually.

In addition to that, I haven't managed to get debugging working even
after reading a few tutorials on the subject.

Has anyone got any tips for setting up these two things, please?

Thank you.

Simon.

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


Re: Creating a model instance using currently logged in user

2018-04-04 Thread 'Simon Connah' via Django users
Hi,

Sorry. When I wrote that message I wasn't thinking properly. After a sleep and 
a bit of Googling, I sorted the issue out. In the future, I'll be much more 
explicit about my problems. Just goes to show how important sleep is when 
programming :).

Thank you for your response though. At least it has confirmed to me that 
form_valid() is the correct location for things like this.

I seem to have a tendency to miss important details in the Django documentation 
for some reason.



On Wednesday, 4 April 2018, 19:16:50 BST, Daniel Roseman 
<dan...@roseman.org.uk> wrote: 

On Tuesday, 3 April 2018 22:17:34 UTC+1, Simon Connah wrote:
> Hi, 
> 
> Apologies as this is a newbie question. 
> 
> I have a Model, a CBV CreateView and a ModelForm. 
> 
> The ModelForm is set to use the model, and the model has a field called 
> author which is a ForeignKey to default Django auth User model. 
> 
> I have removed the author field from the ModelForm as if I allow it the form 
> widget shows a list of all of the registered users on the website. 
> 
> What I need to do is pre-populate the ModelForm with self.request.user from 
> the CreateView. I've tried doing it in the form_valid() method but can't seem 
> to get it working. As soon as a user creates an instance of the Model, I want 
> the author to always equal self.request.user. 
> 
> I have a feeling you filter the ModelForm only to show the logged in user but 
> I'm a bit stuck on that front. Perhaps you have to pre-populate the field in 
> the ModelForm and then use a HiddenInput for the author field in the 
> ModelForm? 
> 
> Any help would be appreciated. 
> 
> Thank you. 


No, the right approach is to do it in form_valid as you tried initially. This 
is explicitly documented: 
https://docs.djangoproject.com/en/2.0/topics/class-based-views/generic-editing/#models-and-request-user

If you're having trouble, you need to be more specific than "I can't get it 
working".
--
DR. 


-- 
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/4bcfdc2c-7e2f-42dd-9295-1a31d85317d5%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/331856020.1804157.1522893033506%40mail.yahoo.com.
For more options, visit https://groups.google.com/d/optout.


Creating a model instance using currently logged in user

2018-04-03 Thread 'Simon Connah' via Django users
Hi,

Apologies as this is a newbie question.

I have a Model, a CBV CreateView and a ModelForm.

The ModelForm is set to use the model, and the model has a field called author 
which is a ForeignKey to default Django auth User model.

I have removed the author field from the ModelForm as if I allow it the form 
widget shows a list of all of the registered users on the website.

What I need to do is pre-populate the ModelForm with self.request.user from the 
CreateView. I've tried doing it in the form_valid() method but can't seem to 
get it working. As soon as a user creates an instance of the Model, I want the 
author to always equal self.request.user.

I have a feeling you filter the ModelForm only to show the logged in user but 
I'm a bit stuck on that front. Perhaps you have to pre-populate the field in 
the ModelForm and then use a HiddenInput for the author field in the ModelForm?

Any help would be appreciated.

Thank you.

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


Re: Advertising a new Django open source project?

2018-03-26 Thread 'Simon Connah' via Django users
 Oh, good catch. I'll fix that tomorrow.
Thanks.
On Monday, 26 March 2018, 18:45:24 BST, Dylan Reinhold 
<dreinh...@gmail.com> wrote:  
 
 One thing I noticed.

In your Blog model you are saving your slug every time.

If you are using the slug as your URL this means if a title is changed the URL 
will change and anyone who had the original URL will get a 404. 
Probably not want you want.

Dylan

On Mon, Mar 26, 2018 at 10:33 AM, 'Simon Connah' via Django users 
<django-users@googlegroups.com> wrote:

 Well, I've opened up the repository if anyone is interested in taking a look. 
As I've said elsewhere, it is very early in development, but I have a couple of 
weeks where I should be able to dedicate a decent amount of time to get it 
working properly.
The main thing I'm a bit worried about is the design since I suck at that sort 
of thing.
The repo is here:
https://gitlab.com/glamorous- systems/seductive

On Sunday, 25 March 2018, 09:55:21 BST, Etienne Robillard 
<tkad...@yandex.com> wrote:  
 
  
Hi Simon,
 
You can also consider setting up a official website for your project. 
 
 
Regards,
 
Etienne
 
 
 Le 2018-03-24 à 15:13, 'Simon Connah' via Django users a écrit :
  
  Hi, 
  First of all, I am sorry because I know that this is off-topic but I couldn't 
think of a better place to ask the question. 
  I'm in the process of developing a cross between a blog, a media gallery and 
some essential e-commerce features which is designed for end users rather than 
other Django developers (much like Wordpress is although I am not saying my 
project is going to be anything like Wordpress). I want to advertise the 
project so that other people can help with its development and offer ideas on 
features as well as use it if they want to. 
  I have no idea where to advertise my open source project? Is there a decent 
place to make people aware of what I am doing? I'm fine doing all the backend 
tasks, but it would be great to have some help on the frontend design aspects. 
I can handle the JavaScript as well. I'm just not so hot on CSS. 
  Any help is appreciated. 
  Simon.  -- 
 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+unsubscribe@ 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/1400150805. 2759758.1521918783407%40mail. yahoo.com.
 For more options, visit https://groups.google.com/d/ optout.
 
 
 -- 
Etienne Robillard
tkad...@yandex.com
https://www.isotopesoftware. ca/ 

-- 
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+unsubscribe@ 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/d9f5e8ef- 826f-f5dc-1f4b-99e8f14fdb72% 40yandex.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+unsubscribe@ 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/228244104. 3602778.1522085598580%40mail. yahoo.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/CAHtg44AgvgLwvFu9MhmgtKvd8wxPR9T_VUWB9JnE3kKYxt-qrA%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

Re: Advertising a new Django open source project?

2018-03-26 Thread 'Simon Connah' via Django users
 Well, I've opened up the repository if anyone is interested in taking a look. 
As I've said elsewhere, it is very early in development, but I have a couple of 
weeks where I should be able to dedicate a decent amount of time to get it 
working properly.
The main thing I'm a bit worried about is the design since I suck at that sort 
of thing.
The repo is here:
https://gitlab.com/glamorous-systems/seductive

On Sunday, 25 March 2018, 09:55:21 BST, Etienne Robillard 
<tkad...@yandex.com> wrote:  
 
  
Hi Simon,
 
You can also consider setting up a official website for your project. 
 
 
Regards,
 
Etienne
 
 
 Le 2018-03-24 à 15:13, 'Simon Connah' via Django users a écrit :
  
  Hi, 
  First of all, I am sorry because I know that this is off-topic but I couldn't 
think of a better place to ask the question. 
  I'm in the process of developing a cross between a blog, a media gallery and 
some essential e-commerce features which is designed for end users rather than 
other Django developers (much like Wordpress is although I am not saying my 
project is going to be anything like Wordpress). I want to advertise the 
project so that other people can help with its development and offer ideas on 
features as well as use it if they want to. 
  I have no idea where to advertise my open source project? Is there a decent 
place to make people aware of what I am doing? I'm fine doing all the backend 
tasks, but it would be great to have some help on the frontend design aspects. 
I can handle the JavaScript as well. I'm just not so hot on CSS. 
  Any help is appreciated. 
  Simon.  -- 
 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/1400150805.2759758.1521918783407%40mail.yahoo.com.
 For more options, visit https://groups.google.com/d/optout.
 
 
 -- 
Etienne Robillard
tkad...@yandex.com
https://www.isotopesoftware.ca/ 

-- 
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/d9f5e8ef-826f-f5dc-1f4b-99e8f14fdb72%40yandex.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/228244104.3602778.1522085598580%40mail.yahoo.com.
For more options, visit https://groups.google.com/d/optout.


Re: Advertising a new Django open source project?

2018-03-24 Thread 'Simon Connah' via Django users
 Hi Egor,
Thank you for the reply. When I get a bit nearer to completion I'll certainly 
follow your advice.
Thanks for the links.
Simon.
On Saturday, 24 March 2018, 20:03:41 GMT, Egor Smolyakov 
<egors...@gmail.com> wrote:  
 
 Hello, Simon.

I had a similar question a few months ago when I advertised my project 
https://github.com/egorsmkv/simple-django-login-and-register

So, I posted the url of my project to these Reddit hubs:

- https://www.reddit.com/r/django/
- https://www.reddit.com/r/Python/

Also, I posted the url to the show's section of Hacker News: 
https://news.ycombinator.com/show
I think, it helps you.


On 24 March 2018 at 21:13, 'Simon Connah' via Django users 
<django-users@googlegroups.com> wrote:

Hi,
First of all, I am sorry because I know that this is off-topic but I couldn't 
think of a better place to ask the question.
I'm in the process of developing a cross between a blog, a media gallery and 
some essential e-commerce features which is designed for end users rather than 
other Django developers (much like Wordpress is although I am not saying my 
project is going to be anything like Wordpress). I want to advertise the 
project so that other people can help with its development and offer ideas on 
features as well as use it if they want to.
I have no idea where to advertise my open source project? Is there a decent 
place to make people aware of what I am doing? I'm fine doing all the backend 
tasks, but it would be great to have some help on the frontend design aspects. 
I can handle the JavaScript as well. I'm just not so hot on CSS.
Any help is appreciated.
Simon.

-- 
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+unsubscribe@ 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/1400150805. 2759758.1521918783407%40mail. yahoo.com.
For more options, visit https://groups.google.com/d/ optout.




-- 
Kind Regards, Yehor Smoliakov.





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


Advertising a new Django open source project?

2018-03-24 Thread 'Simon Connah' via Django users
Hi,
First of all, I am sorry because I know that this is off-topic but I couldn't 
think of a better place to ask the question.
I'm in the process of developing a cross between a blog, a media gallery and 
some essential e-commerce features which is designed for end users rather than 
other Django developers (much like Wordpress is although I am not saying my 
project is going to be anything like Wordpress). I want to advertise the 
project so that other people can help with its development and offer ideas on 
features as well as use it if they want to.
I have no idea where to advertise my open source project? Is there a decent 
place to make people aware of what I am doing? I'm fine doing all the backend 
tasks, but it would be great to have some help on the frontend design aspects. 
I can handle the JavaScript as well. I'm just not so hot on CSS.
Any help is appreciated.
Simon.

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


Re: Dealing with templates in an open source Django project?

2018-03-20 Thread 'Simon Connah' via Django users
 Hi Etienne,
Thank you for the reply. I think I get what you mean now. It would certainly 
solve a lot of issues so thank you for the idea. I'd have to rejig a few things 
to make sure it works correctly but I think once it is all configured it would 
be a much more stable system. I appreciate the help :).
Simon.
On Monday, 19 March 2018, 15:27:40 GMT, Etienne Robillard 
<tkad...@yandex.com> wrote:  
 
  
Hey man,
 
First of all you're definitely not stupid. :-)
 
 
Second, I think you're starting pretty well to understand what I'm trying to 
explain. 
 
 
I do admit however that I haven't myself experimented with this type of 
functionality, but I really think it should be possible to define some specific 
Django models to let the user customize the look and feel of your interface via 
the admin site. 
 
 
You could start progressively by letting the user choose from a list a custom 
CSS file to use for its blogging site. 
 
 
Then you could perhaps let the user choose a specific header and footer for his 
theme.
 
There's no limit in what you can do. 
 
 
Just let your imagination flows in and use your Django programming skills to 
let your users manage their blogging site the way they want.
 
You could even define some specific Javascript fields for allowing users to 
enable or disable some more advanced functionality...
 
Anyways, that's all I can think off right now... 
 
 
Have fun,
 
Etienne
 
 
 Le 2018-03-19 à 09:55, 'Simon Connah' via Django users a écrit :
  
  Hi Etienne, 
  Thank you for your reply. I have to apologise because I think I am a bit 
stupid. I'm not sure what you mean. 
  I think I might understand what you mean to a degree, but I'm not sure how to 
go about it. In effect, I should layout a basic template for general use and 
then create admin views which allow users to customise the specifics of the 
templates. Is that what you meant? 
  If it is, then it is indeed an interesting idea I hadn't considered. I'm not 
entirely sure how I would go about doing that at the moment. I'd have to think. 
  If you meant something else, then please let me know if I have misunderstood 
what you mean. 
  Simon.On Sunday, 18 March 2018, 23:39:47 GMT, Etienne Robillard 
<tkad...@yandex.com> wrote:  
  
 
Hi Simon,
 
I'll try to help you out with that.
 
Have you considered using Django models to allow end users to create, edit and 
customize templates within the Django admin?
 
This should be pretty easy to do. 
 
 
All you need is to define some models for your customized templates and then 
the user can configure the styling within the Django admin.
 
HTH,
 
Etienne
 
 
 Le 2018-03-18 à 18:21, 'Simon Connah' via Django users a écrit :
   
  Hi, 
  First of all apologies for posting two messages to this list in a couple of 
days but I've just got back into Django after a rather long break, and it is 
taking me a little time to get back in the swing of things. 
  I'm in the process of making a simple blogging platform which I intend to 
release as an open source project. It is not designed to be a reusable app used 
by other Django. Instead, it is intended to be an all in one blogging solution 
for end users to install and use much like they do with something like 
Wordpress. 
  There is one major problem though that I don't know the answer. As I am 
building the blogging platform, I am of course writing my templates to make 
sure that everything is working correctly. But a side issue with that is that 
the templates now contain phrases related to the website I intend to create 
when the blogging platform is at a reasonable stage  of development. 
  Now, when I open up the Git repository to the public, and people start using 
they are going to get the templates that I have already created. That will mean 
that they'll either need to go through them all individually (I doubt they will 
have heard of grep or similar tools) or just delete them all and start from 
scratch. 
  What I would like to see is people release their styles that can then be 
customised based on my model, form, view architecture and then they can do what 
they want with the templates. As long as I document the variables used in the 
templates that shouldn't cause too many problems. 
  In effect then I have two options. Distribute the code with my already 
existing templates or have a private repository with my  templates and a public 
repository with no templates and documentation on how to create the templates 
and either make some styles myself or hope that someone else does. 
  Ideally, I'd like it to work a little bit like Wordpress where you can 
install a style very easily I'm just not sure how to go about doing that. 
  How would you go about this problem? I am both trying to make a blogging 
platform for my use while at the same time keeping it  reasonably open so other 
people can use it as well. I'm probably missing something obvious here, but I'd 
appreciate some advice before I

Re: Dealing with templates in an open source Django project?

2018-03-19 Thread 'Simon Connah' via Django users
 Hi Etienne,
Thank you for your reply. I have to apologise because I think I am a bit 
stupid. I'm not sure what you mean.
I think I might understand what you mean to a degree, but I'm not sure how to 
go about it. In effect, I should layout a basic template for general use and 
then create admin views which allow users to customise the specifics of the 
templates. Is that what you meant?
If it is, then it is indeed an interesting idea I hadn't considered. I'm not 
entirely sure how I would go about doing that at the moment. I'd have to think.
If you meant something else, then please let me know if I have misunderstood 
what you mean.
Simon.On Sunday, 18 March 2018, 23:39:47 GMT, Etienne Robillard 
<tkad...@yandex.com> wrote:  
 
  
Hi Simon,
 
I'll try to help you out with that.
 
Have you considered using Django models to allow end users to create, edit and 
customize templates within the Django admin?
 
This should be pretty easy to do. 
 
 
All you need is to define some models for your customized templates and then 
the user can configure the styling within the Django admin.
 
HTH,
 
Etienne
 
 
 Le 2018-03-18 à 18:21, 'Simon Connah' via Django users a écrit :
  
  Hi, 
  First of all apologies for posting two messages to this list in a couple of 
days but I've just got back into Django after a rather long break, and it is 
taking me a little time to get back in the swing of things. 
  I'm in the process of making a simple blogging platform which I intend to 
release as an open source project. It is not designed to be a reusable app used 
by other Django. Instead, it is intended to be an all in one blogging solution 
for end users to install and use much like they do with something like 
Wordpress. 
  There is one major problem though that I don't know the answer. As I am 
building the blogging platform, I am of course writing my templates to make 
sure that everything is working correctly. But a side issue with that is that 
the templates now contain phrases related to the website I intend to create 
when the blogging platform is at a reasonable stage of development. 
  Now, when I open up the Git repository to the public, and people start using 
they are going to get the templates that I have already created. That will mean 
that they'll either need to go through them all individually (I doubt they will 
have heard of grep or similar tools) or just delete them all and start from 
scratch. 
  What I would like to see is people release their styles that can then be 
customised based on my model, form, view architecture and then they can do what 
they want with the templates. As long as I document the variables used in the 
templates that shouldn't cause too many problems. 
  In effect then I have two options. Distribute the code with my already 
existing templates or have a private repository with my templates and a public 
repository with no templates and documentation on how to create the templates 
and either make some styles myself or hope that someone else does. 
  Ideally, I'd like it to work a little bit like Wordpress where you can 
install a style very easily I'm just not sure how to go about doing that. 
  How would you go about this problem? I am both trying to make a blogging 
platform for my use while at the same time keeping it reasonably open so other 
people can use it as well. I'm probably missing something obvious here, but I'd 
appreciate some advice before I get too far into the project so any changes 
that need to be made will be smaller. 
  Thank you. 
  Simon.  -- 
 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/1385218970.2358644.1521411671572%40mail.yahoo.com.
 For more options, visit https://groups.google.com/d/optout.
 
 
 -- 
Etienne Robillard
tkad...@yandex.com
https://www.isotopesoftware.ca/ 

-- 
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/cda864be-eb13-57ba-b79b-6fb1c5be2c7f%40yandex.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 djang

Dealing with templates in an open source Django project?

2018-03-18 Thread 'Simon Connah' via Django users
Hi,
First of all apologies for posting two messages to this list in a couple of 
days but I've just got back into Django after a rather long break, and it is 
taking me a little time to get back in the swing of things.
I'm in the process of making a simple blogging platform which I intend to 
release as an open source project. It is not designed to be a reusable app used 
by other Django. Instead, it is intended to be an all in one blogging solution 
for end users to install and use much like they do with something like 
Wordpress.
There is one major problem though that I don't know the answer. As I am 
building the blogging platform, I am of course writing my templates to make 
sure that everything is working correctly. But a side issue with that is that 
the templates now contain phrases related to the website I intend to create 
when the blogging platform is at a reasonable stage of development.
Now, when I open up the Git repository to the public, and people start using 
they are going to get the templates that I have already created. That will mean 
that they'll either need to go through them all individually (I doubt they will 
have heard of grep or similar tools) or just delete them all and start from 
scratch.
What I would like to see is people release their styles that can then be 
customised based on my model, form, view architecture and then they can do what 
they want with the templates. As long as I document the variables used in the 
templates that shouldn't cause too many problems.
In effect then I have two options. Distribute the code with my already existing 
templates or have a private repository with my templates and a public 
repository with no templates and documentation on how to create the templates 
and either make some styles myself or hope that someone else does.
Ideally, I'd like it to work a little bit like Wordpress where you can install 
a style very easily I'm just not sure how to go about doing that.
How would you go about this problem? I am both trying to make a blogging 
platform for my use while at the same time keeping it reasonably open so other 
people can use it as well. I'm probably missing something obvious here, but I'd 
appreciate some advice before I get too far into the project so any changes 
that need to be made will be smaller.
Thank you.
Simon.

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


Showing only current user in Django admin

2018-03-17 Thread 'Simon Connah' via Django users
I'm just making my first Django app in a very long time, and I have forgotten 
most of what I learnt. I'm using the built-in admin panel for ease of use, and 
it seems to be working well, with one exception.
I have a BlogPost model with the usual things in it. One of the fields is a FK 
to the User object called Author. When I display that model in the admin panel, 
it shows a drop-down list where you can select which one of the currently 
registered users should be the author.
What I'd rather happen is that it only shows the currently logged in user, with 
no option to choose a different user.
On a slightly related noted I also have a CharField in the model and the admin 
centre this is displayed as a small HTML text field which isn't big enough (the 
CharField is max_length=512). I've done some Googling but can't find a 
reasonable way to easily change the admin panel widgets.
Sorry if these questions are stupid. It has been a very long time since I last 
used Django and if memory serves, I never used the built-in admin panel at all.
Thank you for any help.
Simon.

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


Re: Some newbie questions on CBVs and FBVs

2017-11-24 Thread 'Simon Connah' via Django users
 Hi,
First of all thank you very much for the reply. It was very useful. I'll 
re-read the documentation and see what I was missing out on.
The get_queryset() method was a very useful hint. That may well solve the issue 
I was having.
Simon.On Friday, 24 November 2017, 06:20:35 GMT, Matemática A3K 
<matematica@gmail.com> wrote:  
 
 

On Thu, Nov 23, 2017 at 8:49 PM, 'Simon Connah' via Django users 
<django-users@googlegroups.com> wrote:

Hi everyone,
First of all sorry for the newbie questions it has been a long time since I 
used Django and I think I have forgotten just about everything I once knew.
I'm working on a user app for a website. I can't use the built in user model as 
I need a little more flexibility and the ability to grow in the future if 
required.
Basically I have three problems.
1) I need some views to be limited to the user who created the view.

Users do no create Views, what you are meaning is the objects "created" by the 
user (or objects attributed or associated to the user if you want to be even 
more precise)
 
 For instance I have an UpdateUser view and I only want the currently logged in 
user to be able to change their own user model data. So say I have the username 
"djangouser" and I go to UpdateView the only row in the database that I can 
change on the database server is the one with the username "djangouser". I'm 
not sure what the best way to handle this problem is?

Set the queryset attribute of the UpdateView to 
User.objects.filter(name=self.request.user) or override the get_queryset() 
method in the view:def get_queryset(self):
base_qs = super(YourUpdateView, self).get_queryset()
return 
base_qs.filter(user=self.request.user)https://stackoverflow.com/questions/8594759/django-updateview-restrict-per-user
https://docs.djangoproject.com/en/1.11/ref/class-based-views/mixins-single-object/#django.views.generic.detail.SingleObjectMixin.get_queryset


I could do it manually in a function based view without any problem but I find 
CBVs to be really hard to customise when you want to do something that they 
were not specifically designed to do.

Overriding the queryset is a common pattern in CBV :)
 
 At that point I just end up writing a FBV instead and doing it all myself as 
it is quicker than trying to figure out all the mixins and all the methods of 
the class.


I must be missing something simple with CBVs. Any help would be appreciated 
with this :).
 You should read the whole topic:
https://docs.djangoproject.com/en/1.11/topics/class-based-views/intro/ 
and then read the 
reference:https://docs.djangoproject.com/en/1.11/ref/class-based-views/mixins/


2) In FBVs you get passed a variable to the function with the URL conf 
variables, for instance: (path('/blah//', view, name='blah') would 
result in the FBV recieving a username parameter. Where are these variables 
stored when using a CBV?

You should read the topic :)
 

3) Is it considered bad practice to use FBVs in Django?

IMO, no :)
 
 I just find them so much easier and quicker to write. I know that CBVs result 
in less code duplication but I find I constantly need the Django docs open to 
see what each CBV supports and which methods it has available. Where as with 
FBVs I just write the code and everything works.


CBV is a pattern, if you don't embrace it, it may get in your way :)
 
Anyway, thank you for any help :).
Simon.

-- 
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+unsubscribe@ 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/1609714478. 2477254.1511480996285%40mail. yahoo.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/CA%2BFDnh%2BYZfaoRPAvZCeGr3L2uz6W%3DTgcVChAwJV%3DCmhC4Y9%2BQA%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-user

Some newbie questions on CBVs and FBVs

2017-11-23 Thread 'Simon Connah' via Django users
Hi everyone,
First of all sorry for the newbie questions it has been a long time since I 
used Django and I think I have forgotten just about everything I once knew.
I'm working on a user app for a website. I can't use the built in user model as 
I need a little more flexibility and the ability to grow in the future if 
required.
Basically I have three problems.
1) I need some views to be limited to the user who created the view. For 
instance I have an UpdateUser view and I only want the currently logged in user 
to be able to change their own user model data. So say I have the username 
"djangouser" and I go to UpdateView the only row in the database that I can 
change on the database server is the one with the username "djangouser". I'm 
not sure what the best way to handle this problem is?
I could do it manually in a function based view without any problem but I find 
CBVs to be really hard to customise when you want to do something that they 
were not specifically designed to do. At that point I just end up writing a FBV 
instead and doing it all myself as it is quicker than trying to figure out all 
the mixins and all the methods of the class.
I must be missing something simple with CBVs. Any help would be appreciated 
with this :).
2) In FBVs you get passed a variable to the function with the URL conf 
variables, for instance: (path('/blah//', view, name='blah') would 
result in the FBV recieving a username parameter. Where are these variables 
stored when using a CBV?
3) Is it considered bad practice to use FBVs in Django? I just find them so 
much easier and quicker to write. I know that CBVs result in less code 
duplication but I find I constantly need the Django docs open to see what each 
CBV supports and which methods it has available. Where as with FBVs I just 
write the code and everything works.
Anyway, thank you for any help :).
Simon.

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


Re: Django field model for HTML parser?

2017-11-18 Thread 'Simon Connah' via Django users
 The error message is pretty obvious.
"You're using the staticfiles app without having set the STATIC_ROOT setting to 
a filesystem path."

Set the STATIC_ROOT setting in settings.py.
https://docs.djangoproject.com/en/1.11/ref/settings/#static-root

On Saturday, 18 November 2017, 20:12:52 GMT, drone4four 
 wrote:  
 
 
Thank you, Jason.  The WYSIWYG editor like ckeditor is precisely what I am 
looking for.  


I have set out to run ckeditor.  I am following along with the instructions on 
how to install it.


Inside my virtual environment I invoke pip install django-ckeditor.


Then I add ckeditor to INSTALLED_APPS in settings.py.


But then my shell is telling me that I have improperly configured static root 
in the files app even though my settings.py does include a line: STATIC_URL = 
'/static/'




The installation doc linked to above does refer to the official Django doc on 
how to manage static files, which I find to be helpful but isn’t really very 
applicable to my particular situation because I do not have any image files 
that I am working with in my case at this point.


When I run python3 dobbs_portal_blog/manage.py collectstatic, I get this error:


$ python3 dobbs_portal_blog/manage.py collectstatic


You have requested to collect static files at the destination

location as specified in your settings.


This will overwrite existing files!

Are you sure you want to do this?


Type 'yes' to continue, or 'no' to cancel: yes

Traceback (most recent call last):

  File "dobbs_portal_blog/manage.py", line 22, in 

    execute_from_command_line(sys.argv)

  File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/core/management/__init__.py",
 line 364, in execute_from_command_line

    utility.execute()

  File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/core/management/__init__.py",
 line 356, in execute

    self.fetch_command(subcommand).run_from_argv(self.argv)

  File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/core/management/base.py",
 line 283, in run_from_argv

    self.execute(*args, **cmd_options)

  File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/core/management/base.py",
 line 330, in execute

    output = self.handle(*args, **options)

  File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py",
 line 199, in handle

    collected = self.collect()

  File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py",
 line 124, in collect

    handler(path, prefixed_path, storage)

  File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py",
 line 354, in copy_file

    if not self.delete_file(path, prefixed_path, source_storage):

  File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py",
 line 260, in delete_file

    if self.storage.exists(prefixed_path):

  File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/core/files/storage.py",
 line 392, in exists

    return os.path.exists(self.path(name))

  File 
"/home/gnull/Dropbox/TECH/python/2017/django-experiment-with-nick/subgenius-blog-env/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py",
 line 50, in path

    raise ImproperlyConfigured("You're using the staticfiles app "

django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app 
without having set the STATIC_ROOT setting to a filesystem path.

(subgenius-blog-env) gnull at gnosis in 

$


On Saturday, November 18, 2017 at 7:46:21 AM UTC-5, Jason wrote:
What you're trying to look for is a WYSIWYG editor (What You See Is What You 
Get), and there are a number of third party packages you can look at 
https://djangopackages.org/ grids/g/wysiwyg/
ckeditor is one of the largest and most popular such projects, and has 
integration with django via https://github.com/django- ckeditor/django-ckeditor

On Friday, November 17, 2017 at 9:21:57 PM UTC-5, drone4four wrote:

I didn’t do a very good job explaining.  Let me try again.


If you take a look at this image of Blogger, the red arrow points to the 
formatting bar.  The formatting is a helpful feature in Blogger which allows 
blog posters to add an essay worth of content, and then alter the appearance of 
the Lorem 

Re: Dealing with misc parts of a project

2011-09-22 Thread Simon Connah

On 22/09/2011 19:50, DrBloodmoney wrote:

On Thu, Sep 22, 2011 at 12:30 PM, Micky Hulse<rgmi...@gmail.com>  wrote:

On Thu, Sep 22, 2011 at 8:54 AM, Simon Connah<simon.connah...@gmail.com>  wrote:

So do you just tend to create a new misc app to hold all these little bits and 
pieces or is there a convention for such things?

For a few projects at work, we use a "global" app that contains code
for use in other apps.


Very similar. I think that a lot of people use a 'core' app. It's what
I use and where I dump a lot of models and utilities/forms that cannot
be separated from the project itself. It's where I'll put profiles and
account routing, about pages, etc.

Ah good. At least I am following convention then with the only 
difference that I tend to put project specific stuff in an app called misc.


This is one of the areas that I think Django could do with improving on. 
You might not have enough functionality to justify turning it into a 
complete application but you still want to keep it clean and tidy somewhere.


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



Dealing with misc parts of a project

2011-09-22 Thread Simon Connah
When writing a project in Django it is a common occurrence that there are some 
small elements that must be shared between all applications in the project but 
that do not fit within the context of any of the apps as it would break 
encapsulation. I'm thinking about things such as terms and conditions pages 
(which admittedly could use the flat pages mechanism but that does not offer 
quite the same level of control as I am looking for) and privacy policies.

So do you just tend to create a new misc app to hold all these little bits and 
pieces or is there a convention for such things?

Thanks,
Simon.

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



Re: Problem with file upload!

2011-09-04 Thread Simon Connah

On 4 Sep 2011, at 11:25, Ludvig wrote:

> added a print statement after self.request.post == "POST" and it came
> out, so its a post.

You should use:

if request.method == 'POST':

instead. That is the correct method to determine whether a URL was requested 
using the POST method.

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



Re: Django Development environment

2011-08-28 Thread Simon Connah

On 28 Aug 2011, at 04:41, Sam Walters wrote:

> Debug client-side:
> firebug, yslow, a windows computer with ie7

Rather than using a separate computer with IE 7 I tend to just spin up an 
Amazon EC2 instance running Windows Server 2003 or Windows Server 2008 for a 
couple of hours. It makes everything so much easier when it comes to testing.

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



Re: Django Development environment

2011-08-27 Thread Simon Connah

On 27 Aug 2011, at 04:44, Steven Elliott Jr wrote:

>> On Fri, 2011-08-26 at 15:07 +0100, Simon Connah wrote:
>>> Mercurial or Git (depends on whether the project is open source or not)
> 
> Kenneth,
> 
> I think he means whether or not the repository will be public or private. 
> Github (git) does not offer private repos unless you pay whereas bitbucket 
> (mercurial) gives you 5 private ones for free as well as the option for 
> creating public ones. I personally am a big BitBucket fan as I find it much 
> much easier to manage and also a bit faster. 
> 
> Best,
> Steve

Correct. Although Bitbucket offers unlimited private repos. It just limits you 
to 5 users on the free account.

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



Re: what should be memory size memcached for Django on Ubuntu Os?

2011-08-27 Thread Simon Connah
On 27 Aug 2011, at 12:26, vikas ruhil wrote:

> A brief Description of system On i  need help for memcached size:- 
> 1)Cpu :- i7 intel , 16 Gb Ram , Internal SATA Hard-disk :640 Gb , External 
> Hardisk :-10 Tb, Os :- Ubuntu-32bit
> 2)Cpu- i2 intel core2duo , 4Gb Ram, Internal SATA Hard-disk: 320 Gb , 
> External Hard-disk :- 2 Tb , Os:-Ubuntu-32bit
> 3)Cpu- i2 intel core2duo , 4Gb Ram, Internal SATA Hard-disk: 320 Gb , 
> External Hard-disk :- 2 Tb , Os:-FreeBsd-7.0 (I am using FreeBsd with Lamson 
> for mailing system)
> 
> Using Command line  :- memcached -d -m  -l 127.0.0.1 -p 11222
> Anybody able to suggest memory size for Django, or for Dynamic python usage 
> for high Performance computing
> 
> Regards 
> Vikash Ruhil

Ooops sorry sent my other request as a reply to this so sorry if it screws up 
this thread.

As for how much memory you need for memcached that is something that is highly 
site dependant. Some sites can manage with a relatively low amount of RAM 
dedicated to memcache as they don't have a whole lot of data that needs to be 
cached at any one time. Others require huge amounts.

I would suggest you do some experimentation and see what the effect on your 
server load as you play around with memory amounts.

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



Historical Djangocon videos available for download in iTunes?

2011-08-27 Thread Simon Connah
Does anyone know of a source for previous Djangocon (both US and EU) videos 
that allow you to download them in iTunes? So far I've only seen them available 
on the schedule page of the EU Djangocon site and on Blip.tv. While I can 
certainly watch them there I prefer to have them on my hard drive for easy 
reference at a later date.

Thanks for any help.

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



Re: Django Development environment

2011-08-26 Thread Simon Connah
Mac OS X (soon to switch to Arch Linux).
Vim and numerous plugins.
SQLite for local database testing during development
Virtualenv
Mercurial or Git (depends on whether the project is open source or not)
Navicat
South
Selenium
Firebug

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



Re: extending the User profile - which way to go?

2011-08-21 Thread Simon Connah
On 21 Aug 2011, at 19:37, Shawn Milochik wrote:

> Using a OneToOne field does the same thing as a FK with unique set to true, 
> and simplifies queryset syntax.

Good point.

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



Re: extending the User profile - which way to go?

2011-08-21 Thread Simon Connah
My personal preference is to just create a new model class with a ForeignKey 
field pointing to the User model with unique=True set. That way you can extend 
the User object in as many different apps as you want. For instance in a forum 
app you could have a model tracking the number of posts a user made and in a 
blog app you could have a model tracking the number of comments the user has 
made.

The advantage of this method is that you can seperate all the data you store 
about a User into different apps rather than just having one site wide 
UserProfile model which would need to store lots of different types of data 
that would probably benefit from being stored in seperate models.

On 21 Aug 2011, at 14:52, Matt Schinckel wrote:

> You haven't really provided a reason why to 'do it the django way', rather 
> than inheriting from User.
> 
> You do make a valid point about the separate data being in a different table: 
> the difference would be that with using UserProfile, you need to either do 
> the .select_related() yourself, of have a second db query when you do a 
> .get_profile(). With the inheritance method, django will do the joins for you.
> 
> This may actually bite: there are some circumstances where a join is more 
> expensive than a second query. In either case, right now is probably not the 
> time to worry about it. Wait until it becomes a performance issue.

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



Re: Django Development Environments

2011-06-05 Thread Simon Connah

On 5 Jun 2011, at 16:11, Developr wrote:

> Hi!
> 
> I'm currently developing for Django using the following the setup:
> 
> Ubuntu 10.10
> PyCharm
> VirtualEnv
> Yolk
> Pip
> 
> For testing I generally just use the inbuilt dev server that Django
> provides.
> 
> For production I'm currently using nginx and FapWS3 - whilst it works
> great, with FapWS3 not running threaded I'm looking into other
> alternatives.
> 
> I'm curious to see what other developers are using for their
> projects!
> 
> Thanks.

For development:

Mac OS X
MacVim
Virtualenv (production also)
Pip (production also)
Mercurial and Bitbucket (used for deployment also)

For production:

Debian 6 / Ubuntu 10.04
Nginx + Flup (FastCGI configuration)
Daemontools
Soon to be integrating Fabric into production process too

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



Re: Is there an HTML editor that's Django-aware

2011-05-31 Thread Simon Connah
On 31 May 2011, at 00:20, AJ wrote:

> If I can give my $0.02, the content can live anywhere, but how about at least 
> a link to the content within the initial "setting up django environment' 
> section?
> 
> This way those who are just beginning programming and Django can know what do 
> they need to do and what are the pros and cons of an editor/ide upfront.

Agreed. An editor section at the start would be useful. I'm guessing that quite 
a few people who are new to Django are also new to Python as well (in the same 
way as many new Rails users are new to Ruby) so any help in getting them 
started with Python as a whole as well as in a Django specific way will be 
helpful.

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



Re: Is there an HTML editor that's Django-aware

2011-05-26 Thread Simon Connah
Vim has a "Command-T" plugin that is inspired from the Textmate functionality 
and should work in the same manner (to an extent).

http://www.vim.org/scripts/script.php?script_id=3025

(I don't use this plugin myself though as I find NERDtree more than capable and 
already has all the files in an easily accessible format).

As for projects I just use the mvim command line tool to invoke MacVim in the 
directory all my files are in. So assume I have a Django project at 
~/django-project I'd just do mvim ~/django-project and it would load all the 
files in NERDtree. Then you can just use Ctrl+w Ctrl+w to change windows from 
the main view to the NERDtree window and either i or s depending on whether you 
want to open the file in a vertical split or a horizontal split.

Simon.

On 26 May 2011, at 04:32, AJ wrote:

> Thanks a lot Simon. This is probably OT:
> 
> That was helpful but I thought I could dive in again with Vim and failed (at 
> least for now).
> 
> You see, I am now used to some of the things in textmate: 
> 
> * quick file switching. Textmate has Cmd+T and type the file name for quick 
> switching
> * a project. I found the project plugin but still could not figure out the 
> usage.
> 
> I am playing with NERDTree right now. I think there should be a plugin for 
> quick file switching. I do need to know some more shortcuts for NERDTree to 
> quickly open files and bookmark them.
> 
> I just installed the project-plugin too 
> http://www.vim.org/scripts/script.php?script_id=69
> but again, still have to deal with the learning curve.
> 
> Having complained enough, I still think that if I do not give up this time, I 
> will be better off with this editor as my primary.
> 
> Best,
> AJ

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



Re: UK-based Django Host?

2011-05-25 Thread Simon Connah
On 24 May 2011, at 18:03, Nan wrote:

> I know this question has been asked before, but the most recent thread
> I can find in the archives is from 2007, and presumably the landscape
> has changed since then.
> 
> I'm looking for a Webfaction-like host with servers in the UK.  It
> needs to allow long-running processes, of course, and would ideally be
> (like Webfaction) fully managed.  (We don't have the staff to keep a
> server updated or tuned).  We need plenty of memory, shell access (of
> course), and preferably mod_wsgi.
> 
> Does anyone have any recommendations of hosts they've worked with?
> 
> Thanks!
> -Nan

I use Linode (US based host) with a VPS in their London datacentre. It's 
fantastic. The IRC channel is chock full of Python programmers as well :).

Simon.

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



Re: Is there an HTML editor that's Django-aware

2011-05-24 Thread Simon Connah

On 24 May 2011, at 18:49, AJ wrote:

> Simon,
> 
> Can you please give details of plugins that you use for Python/Django in 
> MacVim?
> 
> Thanks,
> AJ

Sure.

I use this plugin collection:

https://github.com/carlhuda/janus

as well as this extra plugin:

http://www.vim.org/scripts/script.php?script_id=2441

I'm positive there are more out there and I have tried various code folding 
plugins but they just slowed me down. If anyone else has any more tips I'd like 
to know what the consensus is with vim users for Python / Django development. 
My .vimrc file is as follows if you want that as well (it has some stuff for 
Haskell in it as well which you can remove):

set nocompatible
set columns=80
if has("colorcolumn")
set colorcolumn=80
else
au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1)
endif
set guifont=Monaco:h14
set guioptions=aAce
set shiftwidth=4
set tabstop=4
set softtabstop=4
set expandtab
set undolevels=1000
set history=1000
set hlsearch
set showmatch
set title
set visualbell
set noerrorbells
set wildignore=*.o,*.swp,*.pyc,*.pyo,*.hg,*.git,*.bak,*.class
filetype on
filetype plugin indent on
" enable omni completion for python
au FileType python set omnifunc=pythoncomplete#Complete
" pyflakes is an intellisense checker for python
let g:pyflakes_use_quickfix = 0
syntax on
au Bufenter *.hs compiler ghc
set confirm
set number
set nowrap
set nobackup
set nowritebackup
set noswapfile
set pastetoggle=
let g:haddock_browser = "open"
let g:haddock_browser_callformat = "%s %s"

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



Re: Is there an HTML editor that's Django-aware

2011-05-24 Thread Simon Connah

On 20 May 2011, at 21:18, Kevin Monceaux wrote:

> On Fri, May 20, 2011 at 07:51:06AM -0400, Brian Bouterse wrote:
> 
>> +1 for vim
> 
> I'll second that motion.  I've tried numerous other editors and keep
> sticking with vim for almost everything.  I do use emacs for my e-mail
> editor, with Mutt as my mail client.
> 

Yep, vim (and in particular MacVim) is awesome for Python / Django work. 
Especially when you install all the Python plugins and source code checkers 
that are available that highlight any mistakes you make in your work.

Couldn't live without it. I just wish it was as good for Objective-C, then I'd 
use it all the time.

Simon.

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



Re: Experiences with virtualenv + Django?

2011-05-24 Thread Simon Connah
On 24 May 2011, at 12:34, Stuart MacKay wrote:
> 
> The only problem you might come across is when updating source code from a 
> repository is that any changes you make will be overwritten. So for example 
> to use staticfiles with django 1.3 I had to rename directories in 
> django-autocomplete so the javascript and css files would be found 
> automatically. Any time I deploy a new release and update the installed 
> packages using pip then I have to rename the directories again since pip 
> effectively does a clean install.

Fabric and a simple shell script would sort that one out. Just automate the 
updating of your packages with Fabric and then once all the packages have been 
updated, use Fabric to run your shell script (or Python script) to rename the 
folders as required.

Simon.

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



Re: Django SEO - feedback

2011-05-22 Thread Simon Connah
On 23 May 2011, at 00:28, Evan Ingam wrote:

> I am trying to evaluate whether to go with Django SEO (http://django-
> seo.readthedocs.org/en/latest/contents.html) or to create my own by
> embedding the relevant meta data fields as values in the models. Doing
> a search across the threads, there are not too many discussions on
> this. Looking for feedback on usage of Django SEO from this community
> including whether there are any alternatives.
> Cheers.

Since it is pretty common knowledge that Google makes no use of meta data 
fields at all other than occasionally replacing the test displayed under links 
in the search results page with the meta description and possibly making use of 
the author field I'm not entirely convinced of the need for doing any extensive 
work for this other than the bare minimum needed.

What benefit do you expect to get from having all the meta data fields set? It 
certainly won't help boost your search ranking and the keywords field is 
completely ignored by Google.

Simon.

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



Re: how to save image in postgreSQL database

2011-05-19 Thread Simon Connah
On 19 May 2011, at 20:38, ramnivas indani wrote:

> ok thanks, is there any online tutorial for that from where i can learn about 
> URI?


This is a good introduction to the subject:

http://en.wikipedia.org/wiki/Uniform_Resource_Identifier

Simon.

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



Re: how to save image in postgreSQL database

2011-05-19 Thread Simon Connah
On 19 May 2011, at 14:30, Ram wrote:

> hello everyone i am studying python for my college project in which i
> am sending some text and image in URL i want to store it to postgreSQL
> database i know how to read data from URL but not about images how can
> i perform it please help.

Don't.

Save the filesystem path or some other URI to the image in the database and 
then use that in your code to get the image itself. Saving images directly in 
the database is a bad idea.

Simon.

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



Re: Django FCGI process randomly dying

2011-05-18 Thread Simon Connah

On 18 May 2011, at 10:14, Vincent den Boer wrote:

> On Monday 16 of May 2011 14:12:45 Alexander Schepanovski wrote:
>> Do you log django's stdout/stderr. You could do that with --outlog and
>> --outerr options of runfcgi command
> 
> It's running with those options now. And I'm waiting for it to die again ;).

Just as an aside you might want to look into something like daemontools which 
will automatically restart services that have died. I know it is better to fix 
the problem at hand but sometimes a quick fix solution like that can save you 
some unnecessary downtime.

http://cr.yp.to/daemontools/faq/create.html#why

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