Re: Possible Django bug I am considering raising

2020-06-05 Thread René Fleschenberg
Hi,

the code you posted on stackoverflow is not sufficient to reproduce the
problem. It would be good to provide a minimal reproducible example (see
also https://stackoverflow.com/help/minimal-reproducible-example).

Regards,
René

-- 
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/85bf94fa-d3ae-6b10-dae4-6c52aa58b3c3%40fleschenberg.net.


Re: SHA-512 in django model? Optimization help?

2019-04-08 Thread René Fleschenberg
Hi again!

Something I forgot to mention earlier: If the files are not too big,
consider generating the SHA-512 on the fly instead of storing it.
Space-wise, it is the best possible optimization, obviously. And it
frees you from having to ensure consistency between the file and the hash.


René


On 4/8/19 3:12 AM, Benjamin Schollnick wrote:
> Right now, I’m generating a SHA-512 of a file in my Django model, but
> that requires a string of 128 bytes…
> 
> I’m not positive on a better way to store the sha-512 in my model?  Can
> anyone suggest a method / design that would be better optimized?
> 
> A quick test, looks like I might be able to store this in a blob of 64
> bytes, which would be a considerable savings…
> 
> t = hashlib.sha512(test.encode("utf-16”))
> digest = t.digest()
> len(digest)
> 64
> 
> t = hashlib.sha512(test.encode("utf-16”))
> hexdigest = t.hexdigest()
> len(hexdigest)
> 128
> 
> But thinking about it, I could convert the hex digest to an integer?
> 
> int(hexdigest,16)
> 4298666745768817459166789395753510504053621749752930724783367173454957154660445390018210346619930005782627382250329880502243093184532984814018267510704707
> z = int(hexdigest,16)
> type(z)
> 
> 
> 
> ‘52137203c3c4b62bc981fd9c8770952bfd1984ee9ce6e33ec94e485bc31a5631b6c6d15c1a2646f39c887575b576e66ed1ddbd96112d5355e574f06df8878a43'
> 0x52137203c3c4b62bc981fd9c8770952bfd1984ee9ce6e33ec94e485bc31a5631b6c6d15c1a2646f39c887575b576e66ed1ddbd96112d5355e574f06df8878a43
> 
> They convert identically, but I’m not sure that converting to integer
> would keep the integrity of the sha-512?
> 
> Can anyone make any sort of suggestion on the best way to handle this?
> 
> - Benjamin
> 
> -- 
> 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
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com
> <mailto: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/61a7c17c-7c23-49ca-9cdb-0df325672ed5%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/61a7c17c-7c23-49ca-9cdb-0df325672ed5%40googlegroups.com?utm_medium=email_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

-- 
René Fleschenberg

Rosastrasse 53, 45130 Essen, Germany
Phone: +49 1577 170 7363
https://fleschenberg.net
E-mail: r...@fleschenberg.net

-- 
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/14b71fcc-57e5-e0ae-b86b-61dfffbce362%40fleschenberg.net.
For more options, visit https://groups.google.com/d/optout.


Re: SHA-512 in django model? Optimization help?

2019-04-08 Thread René Fleschenberg
Hi

Assuming you are on Postgres, Using BinaryField(max_length=64) should be
good if you want to optimize for size. According to the Postgres docs,
it will use "1 or 4 bytes" plus the actual string.

It is also reasonably convenient to work with:

instance.hashfield = hashlib.sha512(b'test').digest()
instance.save()

And if you want to output for display:

print(instance.hashfield.encode('hex'))

An integer is not going to work, since you need 64 bytes (512 / 8 = 64)
and the largest integer type can only hold 8 bytes.


René


On 4/8/19 3:12 AM, Benjamin Schollnick wrote:
> Right now, I’m generating a SHA-512 of a file in my Django model, but
> that requires a string of 128 bytes…
> 
> I’m not positive on a better way to store the sha-512 in my model?  Can
> anyone suggest a method / design that would be better optimized?
> 
> A quick test, looks like I might be able to store this in a blob of 64
> bytes, which would be a considerable savings…
> 
> t = hashlib.sha512(test.encode("utf-16”))
> digest = t.digest()
> len(digest)
> 64
> 
> t = hashlib.sha512(test.encode("utf-16”))
> hexdigest = t.hexdigest()
> len(hexdigest)
> 128
> 
> But thinking about it, I could convert the hex digest to an integer?
> 
> int(hexdigest,16)
> 4298666745768817459166789395753510504053621749752930724783367173454957154660445390018210346619930005782627382250329880502243093184532984814018267510704707
> z = int(hexdigest,16)
> type(z)
> 
> 
> 
> ‘52137203c3c4b62bc981fd9c8770952bfd1984ee9ce6e33ec94e485bc31a5631b6c6d15c1a2646f39c887575b576e66ed1ddbd96112d5355e574f06df8878a43'
> 0x52137203c3c4b62bc981fd9c8770952bfd1984ee9ce6e33ec94e485bc31a5631b6c6d15c1a2646f39c887575b576e66ed1ddbd96112d5355e574f06df8878a43
> 
> They convert identically, but I’m not sure that converting to integer
> would keep the integrity of the sha-512?
> 
> Can anyone make any sort of suggestion on the best way to handle this?
> 
> - Benjamin
> 
> -- 
> 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
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com
> <mailto: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/61a7c17c-7c23-49ca-9cdb-0df325672ed5%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/61a7c17c-7c23-49ca-9cdb-0df325672ed5%40googlegroups.com?utm_medium=email_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

-- 
René Fleschenberg

Rosastrasse 53, 45130 Essen, Germany
Phone: +49 1577 170 7363
https://fleschenberg.net
E-mail: r...@fleschenberg.net

-- 
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/b4bcaa0d-507b-7ffb-1b99-571f1bfb84d1%40fleschenberg.net.
For more options, visit https://groups.google.com/d/optout.


Re: PasswordResetConfirmView doesn't work through redirect in newest Safari

2019-01-30 Thread René Fleschenberg
Hi,

I am currently using the code below as a workaround.

Please be super-careful with this. I did not test this extensively. Do
not use it if your password reset page requests external resources. Make
sure you understand the security implications before you deploy it.

apollo13 suggested this on IRC as a temporary fix, but any bugs in the
implementation are mine. Obviously, no warranty ;)


```
from django.contrib.auth import views as auth_views
from django.contrib.auth.views import INTERNAL_RESET_SESSION_TOKEN
from django.utils.decorators import method_decorator
from django.views.decorators.cache import never_cache
from django.views.decorators.debug import sensitive_post_parameters


class PasswordResetConfirmView(auth_views.PasswordResetConfirmView):

# https://code.djangoproject.com/ticket/29975

@method_decorator(sensitive_post_parameters())
@method_decorator(never_cache)
def dispatch(self, *args, **kwargs):
assert 'uidb64' in kwargs and 'token' in kwargs

self.validlink = False
self.user = self.get_user(kwargs['uidb64'])

if self.user is not None:
token = kwargs['token']
if self.token_generator.check_token(self.user, token):
self.validlink = True
form = self.get_form()
if form.is_valid():
self.request.session[
INTERNAL_RESET_SESSION_TOKEN
] = 'dummy'
return self.form_valid(form)
return self.form_invalid(form)

return self.render_to_response(self.get_context_data())
```


-- 
René Fleschenberg

-- 
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/6898cb45-0128-9648-9b70-3294ff6c58a4%40fleschenberg.net.
For more options, visit https://groups.google.com/d/optout.


Re: Django Tutorial Issues

2017-05-04 Thread René Fleschenberg
Hi Ivan,

It is very likely that your problem is caused by one of these:

- `question` is not assigned to the template context
- `question` is assigned to the template context, but it has a wrong
   value (e.g. `None`)
- the question has no `id` (it is not saved to the database yet).


This then results in this line:

`{% url 'polls:vote' question.id %}`

being something like

{% url 'polls:vote' "" %}

which does not match your URL pattern, because the pattern wants an
integer for the id.

I hope this helps!

René


On 04.05.2017 08:32, Ivan Cox wrote:
> Hi i am new to Django and in the process of going through the django
> tutorial at https://www.djangoproject.com/ 
> I have however run into problems on Part 4. I have added the following
> code to the detail.html page 
> 
> |
> {{ question.question_text }}
> 
> {% if error_message %}{{ error_message }}{% endif %}
> 
> 
> 
> {% csrf_token %}
> {% for choice in question.choice_set.all %}
>  value="{{ choice.id }}" />
> {{ choice.choice_text
> }}
> {% endfor %}
> 
> 
> 
> |
> 
> But when i click on the links on the polls home page i get the following
> error
> 
> 
>   NoReverseMatch at /polls/3/


-- 
René Fleschenberg

Am Stadtgarten 28, 45276 Essen, Germany
Phone: +49 1577 170 7363
E-Mail: r...@fleschenberg.net

-- 
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/70d0da5f-afd3-1d4c-5426-f93d8d6851cd%40fleschenberg.net.
For more options, visit https://groups.google.com/d/optout.


Re: Yet Another Can't get static files to show up in shared linux website on Godaddy

2017-04-12 Thread René Fleschenberg
Hi,

Do *not* put your project into the webserver's document root. Doing so
will likely expose secret data (your source code including the database
password and SECRET_KEY).

Your STATIC_ROOT must be a location that your webserver serves under
STATIC_URL. If you cannot configure your webserver to do this, you can
use http://whitenoise.evans.io/en/stable/.

However, you will probably run into the same limitation when you want to
serve user-uploaded files ("media"), and whitenoise cannot help you
there. You will have to serve your media files from an external server,
such as Amazon S3.

I recommend deploying to an environment with WSGI support, btw. FCGI is
not supported anymore:
https://docs.djangoproject.com/en/1.8/howto/deployment/fastcgi/. If you
do not want to setup your own server, PythonAnywhere and Heroku are
popular choices.

Regards,
René


On 04/10/2017 07:47 AM, Anthony Percy wrote:
> Hi all,
> Sorry to ask this question but I cant get my static files in Mezzanine
> to show up on a Godaddy hosted site e.g http://www.murraybridge.co
> <http://www.murraybridge.co/>
> I have had to use "pip install flup" and "pip
> install django-fastcgi-server" as Godaddy seems to have the fcgi module
> active on the apache webserver which I understand is now deprecated.
> The .htaccess file is in ~/public_html is ;
> 
> AddHandler fcgid-script .fcgi
> RewriteEngine On
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteRule ^(.*)$ mezproject.fcgi/$1 [QSA,L]
> 
> My "mezproject.fcgi" file in ~/public_html is;
> 
> /#!/home/vk2acp/code/mez/bin/python/
> /import sys, os/
> /# Add a custom Python path./
> /sys.path.insert(0, "/home/vk2acp/code/mezproject")/
> /# Switch to the directory of your project. (Optional.)/
> /os.chdir("/home/vk2acp/code/mezproject")/
> /# Set the DJANGO_SETTINGS_MODULE environment variable./
> /os.environ['DJANGO_SETTINGS_MODULE'] = "mezproject.settings"/
> /from django_fastcgi.servers.fastcgi import runfastcgi/
> /from django.core.servers.basehttp import get_internal_wsgi_application/
> /wsgi_application = get_internal_wsgi_application()/
> /runfastcgi(wsgi_application, method="prefork", daemonize="false",
> minspare=1, maxsp/
> /are=1, maxchildren=1)/
> 
> The "static" dir exists in the mezproject dir after I did "python
> manage.py collectstatic"
> I have tried copying  static dir to the public_html dir with no effect.
> Obviously I cant add the "Alias" directive as I have no control over the
> http.conf file.
> It seems a pity to get this far and run into this brick wall!!!
> Do I have to run the whole mez project from the public_html dir???
> Any suggestions?
> 
> Best Regards
> 
> Anthony
> 
> -- 
> 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
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com
> <mailto: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/a38ab714-1903-4c92-a5d0-0b1455c29a75%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/a38ab714-1903-4c92-a5d0-0b1455c29a75%40googlegroups.com?utm_medium=email_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

-- 
René Fleschenberg

Am Stadtgarten 28, 45276 Essen, Germany
Phone: +49 1577 170 7363
E-Mail: r...@fleschenberg.net

-- 
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/ea4d419a-513c-4e03-571b-05311e51b4bd%40fleschenberg.net.
For more options, visit https://groups.google.com/d/optout.


Re: [BUG] Django 1.11 backward compatibility bug when several authentication backends are in use

2017-04-07 Thread René Fleschenberg
Hi Raffi,

Thanks for taking the time to report this. Can you please file an issue
at https://code.djangoproject.com/? The people who deal with triaging
and fixing bugs may not be following the django-users list.

Thanks!
René


On 04/07/2017 03:43 PM, Raffi Enficiaud wrote:
> Hi Django list!
> 
> I am using a django-crowd authentication backend and the deployment
> today was not working with our setup. I nailed it down to the fact that
> the backward compatibility is not working as expected for 1.11 for the
> authenticate method:
> 
> https://docs.djangoproject.com/en/1.11/topics/auth/default/#django.contrib.auth.authenticate
> 
> Step to reproduce:
> - add an authentication backend using Django < 1.11 API at the end of
> the authentication backend list supplied by AUTHENTICATION_BACKENDS. At
> the end, or at least not in the first position, is important here
> - try to log in with a user in this backend
> 
> Expected result:
> - the authenticate method is called for this authentication backend
> 
> What happens:
> - the authentication backend is discarded as it does not (supposedly)
> have the right API. It works as expected if the authentication backend
> is first in the list.
> 
> Bug explanation:
> * the credential dictionary is polluted by the "request" argument after
> the first iteration in django/contrib/auth/__init__.py line 92
> * after the first loop, all calls to
> "inspect.getcallargs(backend.authenticate, **credentials)" (line 81,
> same file) with the Django <= 1.10 API can only fail because they raise
> the exception TypeError indicating that they do not support this API
> 
> The fix needs to move to the new API, I think it should at least be
> advertised as a breaking change in the release notes, or this bug should
> be fixed by not adding the "request" to the "credentials" dict.
> 
> Thanks for the wonderful work on Django, I am so much in love with this!
> 
> Best regards,
> Raffi Enficiaud
> 
> -- 
> 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
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com
> <mailto: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/18df46d6-aeab-4cd0-8c2a-7cdaa4d78469%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/18df46d6-aeab-4cd0-8c2a-7cdaa4d78469%40googlegroups.com?utm_medium=email_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

-- 
René Fleschenberg

Am Stadtgarten 28, 45276 Essen, Germany
Phone: +49 1577 170 7363
E-Mail: r...@fleschenberg.net

-- 
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/1024611c-9806-a683-890b-f8c547db8740%40fleschenberg.net.
For more options, visit https://groups.google.com/d/optout.


Re: Downloaded Django but the command prompt wont recognize commands

2016-08-07 Thread René Fleschenberg
Hi Owen,

> I went through a tutorial for downloading python, pip and Django.  All
> seemed to be going well until I attempted to put command lines 
through the
> command window
> 
> So when I try to create a project via these instructions below
> 
> $ django-admin startproject mysite
> 
> 
> It gives an error

Can you give us a link to the tutorial you are following?

Did you maybe forget to activate your virtualenv?


René

-- 
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/6340590.7ojJnfTlfd%40rene-laptop.
For more options, visit https://groups.google.com/d/optout.


Re: Mobile eCommerce with Django

2016-03-25 Thread René Fleschenberg
Hey Jordan,

On Wednesday 23 March 2016 17:03:59 Jordan Koncz wrote:
> I'm now looking at the option of Django Shop, which [according to the
> documentation](http://django-shop.readthedocs.org/en/latest/reference/seri
> alizers.html) seems like it would support using all of its functionality
> via a REST API. Does anyone have experience with using Django Shop like
> this?

Co-maintainer of django-shop here. The current django-shop codebase is still 
pretty new (the old django-shop 0.2 code was more or less completely 
redesigned and rewritten by Jacob Rief). Personally, I know of two 
deployments in production right now, and two more likely going online within 
a few weeks after Djangocon Europe. So far, I don't know of any "mobile 
only" deployments, but that is definitely a use-case we do want to support.

I believe it should be possible to use django-shop as it is right now for 
your use-case. Since django-shop itself does not define any concrete models, 
you should be able to hook in the models of your choice, including any 
relationships you chose to define. Should any part of django-shop's 
functionality not be available via the REST API, we consider that a bug and 
will fix it ASAP.

That said, honesty demands that I mention that you should be prepared to 
handle a few rough edges here and there, since this is still basically a new 
project. However, Jacob and me will gladly help out if you run into any 
trouble, and we are usually quite quick in reacting to user feedback and 
fixing bugs.

Oddly enough, just today, I started to work on some documentation that may 
be interesting for your use-case. I hope to finish this documentation over 
the course of this weekend. You can watch the progress on this branch:

https://github.com/rfleschenberg/django-shop/tree/manual-install-docs

At the moment, the particular file is:

https://github.com/rfleschenberg/django-shop/blob/manual-install-docs/docs/reference/manual-installation.rst

Feel free to contact me if you want to discuss things further. Good ways to 
reach me are e-mail, #django-shop on Freenode or the Gitter room at 
https://gitter.im/awesto/django-shop

Cheers,
-- 
René Fleschenberg

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


Re: MySql Memory tables doubt...

2016-03-19 Thread René Fleschenberg
Hi,

On Wednesday 16 March 2016 12:58:17 Jose Galvan wrote:
> I am developing a web site to make queries and create new entries  in a
> old Mysql order entry system so I need to use the Raw SQL django
> functionality more than ORM.

Are you sure that you cannot use the ORM? Maybe you can just use unmanaged 
models?

https://docs.djangoproject.com/ja/1.9/ref/models/options/#managed

> In the process I need to use a temporary mysql table ( like a memory table
> that  is alive while the session is active), my question is : In order to
> manipulate it, Do I need to declare this table in the models.py like any
> other table ?

Take a look at Django's multi-database support:

https://docs.djangoproject.com/en/1.9/topics/db/multi-db/

Yes, you should probably write models for the temporary table.

-- 
René

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


Re: advanced beginner / early intermediate Django users

2016-03-19 Thread René Fleschenberg
Hi,

On Friday 18 March 2016 11:35:13 Becka R. wrote:
> Some of the issues I really struggled with, and had blocks on included:
> -  deployment

There are many different ways to deploy Django (or actually, Python/WSGI) 
applications. You have to chose the one that suits your case best. It might 
be a good idea to use a PaaS like Heroku or Pythonanywhere, so you can focus 
your time on actual development.

> - switching to Postgres

I recommend to use Postgres from day 1, also for local development. That 
said, Django's dumpdata / loaddata commands can often be used to easily 
migrate data to a different database. Did you try dumpdata / loaddata and 
run into trouble?

> -  allowing a user to edit data in a modelform where there was a foreign
> key

I am not sure what exactly your problem was here. By default, you should get 
a ModelChoiceField, and it should just work. If you want to edit objects on 
the other side of the relationship, you can use an inline formset:

https://docs.djangoproject.com/en/1.9/topics/forms/modelforms/#django.forms.models.BaseInlineFormSet

> I'm guessing these are all very common use cases, and that there are more
> which could be better documented.  I'm interested in helping to make it
> easier for people at my level to find resources and code samples,and I
> have two questions for the group:
> 
> 1.  What are some of the common use cases you've struggled with?
> 2. What resources, beyond the docs and official tutorial have you found to
> be helpful, accurate, and up to date with Django 1.9 (or 1.8) and
> associated packages?

To be honest, most of the time, my problem was that I did not take the time 
to read the official documentation carefully enough :) If you have 
suggestions on how to improve the documentation, it would be great if you 
open a pull request on Github, or maybe initiate a discussion here or on 
django-developers.

I also keep a small list of blog posts that cover some less common cases 
that the official docs don't mention.

For "advanced" things, the IRC channel #django on freenode can also be quite 
helpful.

The Django Girls tutorial is also very good. 
http://tutorial.djangogirls.org/

-- 
René

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


Re: Beginner, Adding a feature in a Django based website

2016-03-12 Thread René Fleschenberg
Hi Sourav,

> I require some help in the issue given here
> <https://github.com/NeuroVault/NeuroVault/issues/420>.We wish to implement
> a closing account feature in a Django Website.So far, I know that the
> corresponding database entry for the user must be deleted from the
> database.But I require some help in making it possible.

Can you tell us what exactly is giving you trouble?

Some general hints:

- To delete an object from the database, you can call something like 
  ``MyModel.objects.get(username=theusername).delete()``

- There also is a generic class-based view (CBV) for deleting objects:
  
https://docs.djangoproject.com/en/1.9/ref/class-based-views/generic-editing/#deleteview

- Of course, you must protect the feature, such that users cannot delete
  other users' accounts.

Have fun!
René

-- 
René Fleschenberg

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


Re: Where does the static files reside

2015-11-07 Thread René Fleschenberg
Hi Gary,

> ├── archive
> │   ├── archive
> │   │   ├── __init__.py
> │   │   ├── settings.py
> │   │   ├── urls.py
> │   │   └── wsgi.py
> │   ├── home
> │   │   ├── __init__.py
> │   │   ├── static
> │   │   │   ├── home.css
> │   ├── manage.py

In your first example, "home" is an app (not a project) that has some static 
files. "archive" is your project. 

Your "home" app doesn't follow the recommended filesystem structure, though. 
You should do this:

archive/
  home/
__init__.py
static/
  home/
home.css

Note that there is no need to have an __init__.py file in any of your static 
dirs.

In your second example:

> ├── archive
> │   ├── archive
> │   │   ├── __init__.py
> │   │   ├── settings.py
> │   │   ├── urls.py
> │   │   └── wsgi.py
> │   ├── home
> │   ├── static
> |   | |___home
> │   │ ├── home.css
> │   │ ├── images

you have what I would call a "global" static files directory. Files from 
this directory will only be found if you configure that directory in your 
settings:

STATICFILES_DIRS = (
os.path.join(BASE_DIR, "static"),
)

This is because that directory is not part of any app that is listed in 
INSTALLED_APPS.

BASE_DIR is the top-level "archive" directory, by the way (the first 
"archive" in the tree).

I hope this helps.


Because this gets asked so often, I am trying to  to sump it up here:

https://fleschenberg.net/django-staticfiles/

I'd love to hear your feedback about this article, i.e. if it clarifies 
things for you, or how to improve it.

-- 
René Fleschenberg

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


Re: Alternative to fabric

2014-11-17 Thread René Fleschenberg
Hi,

On Monday 17 November 2014 17:42:22 Brad Pitcher wrote:
> I agree Ansible is a good fit for your situation. Since Ansible works from
> yaml files, you don't have to write any Python 2.x compatible code as you
> would with Fabric.

I agree that Ansible is a nice tool, but AFAIK, it is not Python 3 compatible.

http://docs.ansible.com/intro_installation.html

Best regards,
René


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


Re: Alternative to fabric

2014-11-17 Thread René Fleschenberg
Hi Andreas,

If you like fabric, why not just use Python 3 for your project and Python 2 
for fabric? You can easily have multiple Python interpreters installed. Just 
install Python 2 to a path like ~/local and give fabric its own virtualenv.

Best regards,
René


On Monday 17 November 2014 12:28:27 Andreas Kuhne wrote:
> Hi all,
> 
> We are just about ready to release our newly rewritten website. It is based
> on Django 1.6 and Python 3.
> 
> We have worked through all of the problems with using python 3 (migrated
> some plugins ourselves, other plugins were updated during the course of the
> project). The only problem we have left is a good deployment plugin, so
> that we easily can deploy new versions of our site.
> 
> We previously used fabric, but that doesn't work with python 3. So I was
> wondering if anyone has any python 3 compatible fabric alternative that
> they are using?
> 
> Regards,
> 
> Andréas

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


Re: Django-Registration compatible with 1.5.2?

2013-09-11 Thread René Fleschenberg
Hi,

Andre Lopes:
> I need to user a registration app for Django 1.5.2. I'm a little bit
> confused on what app to use.

I use django-registration==1.0 from PyPi with Django 1.5. Works for me.

Regards,
René

-- 
René Fleschenberg

Am Stadtgarten 28, 45276 Essen, Germany
Phone: +49 1577 170 7363
E-Mail: r...@fleschenberg.net

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ImportError: No module named django.core.management

2013-07-27 Thread René Fleschenberg
Hi,

vinoth job:
>  python manage.py syncdb
> 
> Traceback (most recent call last):
>   File "manage.py", line 8, in 
> from django.core.management import execute_from_command_line
> ImportError: No module named django.core.management

This error can also occur if the virtualenv is not actviated. Did you run 
``source bin/activate`` (or the appropriate ``workon`` command, in case you're 
using virtualenv-wrapper)? Does your shell prompt show the name of the 
virtualenv?

If the virtualenv is activated: is Django really installed in the virtualenv? 
What's the output of ``pip freeze|grep -i django`` (with the virtualenv being 
active)?


-- 
René Fleschenberg

Am Stadtgarten 28, 45276 Essen, Germany
Phone: +49 1577 170 7363
E-Mail: r...@fleschenberg.net

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.