Re:

2019-07-29 Thread Suraj Thapa FC
Actually I'm asking to store multiple files in a single model field and
handling each of them

On Mon, 29 Jul, 2019, 9:05 PM Jani Tiainen,  wrote:

> My mistake.
>
> I thuought that OP was asking about uploading and storing multiple files
> to model.
>
> First part (uploading) is easy since docs do cover that.
>
> Second part is tricky since it requires data structure capable of storing
> multiple files and there are so many ways to do that.
>
>
>
> ma 29. heinäk. 2019 klo 18.22 Aldian Fazrihady 
> kirjoitti:
>
>> Multiple file uploads already there for many years. The link I shared
>> above show you how to do that the Django way.
>>
>> Regards,
>>
>> Aldian Fazrihady
>> http://aldianfazrihady.com
>>
>> On Mon, 29 Jul 2019, 21:52 Jani Tiainen,  wrote:
>>
>>> Hi.
>>>
>>> TL; DR; you can't.
>>>
>>> You though can upload multiple files just fine you just need to handle
>>> them manually.
>>>
>>> Also if you plan to keep files around your models must enable that.
>>>
>>>
>>> ma 29. heinäk. 2019 klo 15.48 Suraj Thapa FC 
>>> kirjoitti:
>>>
 How can I create a file field which one can upload Multiple files in
 it...

 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAPjsHcE%2BMSVGHiQ0bx4z_2pxMMiE57FD44kFn4hE%3DsSLaj66kw%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/CAHn91of_AD_METU8A3J4qhHo_E93Qd4hJyS73uRQh43GpRsAgg%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/CAN7EoAYAh%2Bou8fyzcBhyHn25SDx7%3D3Vw%2BY7OGY2%2B%3D3fjk-C0kg%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/CAHn91odErG3F4HGUCBFFh6oQdmg3CEDC2N3gCLNUUeUPrm1bbw%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/CAPjsHcHmsSHpz5CQ2%3DiUaBBEu7YBu-x2yQq6DFkD5jN2ZRM2rg%40mail.gmail.com.


Re: forms - switch off the validation

2019-07-29 Thread Aldian Fazrihady
You probably can extend the form class and override the is_valid method.
Make the new is_valid to always return True.

On Tue, Jul 30, 2019 at 11:42 AM Kai Kobschätzki 
wrote:

> Heiho,
>
> I wrote a form in forms.py with some validation stuff, especially with
> def clean_field(). All fine. But in some usecases I would prefare to
> switch off at least some of the validation. For example it make no sense
> to check for a double id when I want to delete a reccord. Is it possible
> to swith them off with reuse the form and not with write nearly the same
> form (don't repeat yourself..).
>
> Thanks and Greetings,
>
> bengoshi
>
>
>
> --
> 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/41b2edc1-307a-a0e6-d389-a0051d38c787%40gmail.com
> .
>


-- 
Regards,

Aldian Fazrihady
http://aldianfazrihady.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/CAN7EoAY8Xq7hW_9DPw0gwvLBdF9JiXuN1%2B%3DWNTBcM%2BqAVcFsFA%40mail.gmail.com.


forms - switch off the validation

2019-07-29 Thread Kai Kobschätzki
Heiho,

I wrote a form in forms.py with some validation stuff, especially with
def clean_field(). All fine. But in some usecases I would prefare to
switch off at least some of the validation. For example it make no sense
to check for a double id when I want to delete a reccord. Is it possible
to swith them off with reuse the form and not with write nearly the same
form (don't repeat yourself..).

Thanks and Greetings,

bengoshi



-- 
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/41b2edc1-307a-a0e6-d389-a0051d38c787%40gmail.com.


Re: Only for specific region

2019-07-29 Thread Andrew C.
https://pypi.org/project/django-ip-restriction/
Try just searching up “Django ip restrict” or “django ip restriction” or
“django ip block”

There are plenty of options out there. As for why this might be needed, you
can blame China with all these bot attacks on websites :P It can also be
for other reasons.

On Mon, Jul 29, 2019 at 9:07 PM Sebastian Jung 
wrote:

> Hello,
>
> I want that my Website only German user can Open it and another User from
> Others Region a template Show, that they Not live in Germany.
>
> Regards
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3191e21a-4b74-415a-ba1f-8c5dee0ed606%40googlegroups.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/CAJVmkNkQzBXi3nT5L_SCKMcB-5-KdQao5S6vuzziNEoogi%2Bk7w%40mail.gmail.com.


Re: Only for specific region

2019-07-29 Thread Aldian Fazrihady
Huge app such as Netflix tries to do that, and people always can find
workaround. Why do you also want such feature?  Licensing limitation such
as Netflix?

On Tue, Jul 30, 2019 at 8:08 AM Sebastian Jung 
wrote:

> Hello,
>
> I want that my Website only German user can Open it and another User from
> Others Region a template Show, that they Not live in Germany.
>
> Regards
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3191e21a-4b74-415a-ba1f-8c5dee0ed606%40googlegroups.com
> .
>


-- 
Regards,

Aldian Fazrihady
http://aldianfazrihady.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/CAN7EoAb_Y-usVgE41RN%3DFTx0P5hcuMgVZ_L8vuPyhjukkghcGA%40mail.gmail.com.


Only for specific region

2019-07-29 Thread Sebastian Jung
Hello,

I want that my Website only German user can Open it and another User from 
Others Region a template Show, that they Not live in Germany.

Regards

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3191e21a-4b74-415a-ba1f-8c5dee0ed606%40googlegroups.com.


Re: Defining Models outside models.py

2019-07-29 Thread Andréas Kühne
Hi,

I definitely wouldn't recommend  doing what you want to do, for several
reasons:
1. It will be hard to find the model when you need to update it.
2. Django is built with defaults in mind - and when you go outside the
defaults you are working against the framework and not with it.

But that being said, you can probably do what you want with the help of the
meta options on a django model:
https://docs.djangoproject.com/en/2.2/ref/models/options/

Specifically the app_label property - you should be able to use. The only
thing you need to do then is make sure that the file is "loaded" when
django starts up somehow.

Regards,

Andréas


Den tors 25 juli 2019 kl 18:58 skrev Sam Taiwo :

> Hi everyone,
>
> I know there are currently 3 ways to define a model in Django
> 1) Define it directly in the models.py file
> 2) Define it directly in a models package in the same directory as your
> other app files
> 3) Define it somewhere completely different and just import the models
> into the models.py
>
> My question is, is there a way to write a model in any arbitrary file in
> you directory and link it to your app without having to use models.py file
> or directory.
> For example is there a way to write a model directly in the views file and
> then add some config to the settings or elsewhere to enable Django to know
> of it's existence and pick up any changes that happen to it.
> I don't mind if it's a complete hack
> 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/95f073eb-8309-4454-8cfd-b190dde90cef%40googlegroups.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/CAK4qSCfm1%2BOx-_VHaHfgAqeoJ%2BySwvS7T3rnqT4D9KSs%2B%3DwfGg%40mail.gmail.com.


Re: Simple project, URL porblems

2019-07-29 Thread Andréas Kühne
Hi,

The reason you are having problems is that the last item in your URLs is a
catch all - it will get all items that aren't found previously. So if you
want to go to admin, you need to add the admin urls BEFORE your catchall.

Also - the way that you are handling getting the categories or tutorials
isn't really good.

You should do something like this:
category =
TutorialCategory.objects.filter(category_slug=single_slug).first()

if category:
  # Show the category

tutorial = Tutorial.objects.filter(tutorial_slug = single_slug).first()

if tutorial:
  # Show the tutorial

raise Http404

This code will make sure that you first get the first tutorial category
(you can only have one with each slug). If found it will show the category
page (the same code you have, except that you already have the category).
If the category is not found, it will check if there is a tutorial with the
slug. If there isn't anything the code then raises a Http404 exception -
which means that the item cannot be found.

Regards,

Andréas


Den mån 29 juli 2019 kl 14:48 skrev Marsel Beqiri <
marselbeqiri@gmail.com>:

> Hi, i;m new here, also in django developing,
>
> Lastly i tried to create an app, something like a blog.  And I have
> created a Model with FK relations like this:
> *Category=>Subcategory=>Post.*
> Till here everything is fine, also when I create a Post in Admin Panel
> there is a char field to put the post url ex. post-nr-1
>
> But  I want to make my app URL, friendly, just Url no '/ ' (single slug) .
> like this
>
> *click on category:  main/category-title-1*
>
> *click on post: main/post-title-1 *
>
> So just one URL, not slashing.
>
> urlpatterns = [
>   path("", views.homepage, name = "homepage"),
>   path("register/",views.register, name = "register"),
>
> path("logout/", views.logout_request, name = "logout"),
>
> path("login/", views.login_request, name = "login"),
>
> path("/", views.single_slug, name="single_slug"),
>
> ]
>
>
>
>
>  View function mentioned before
> def single_slug(request, single_slug): # Mund te pranojme single_slug si
> variabel neper  URL path
> # Me poshte kemi nje comprehensice List
> categories = [c.category_slug for c in TutorialCategory.objects.all()] #
> c.category_slug : do marri vetem URL (slug) dhe do i ruaj ne liste. Pra
> shmang te dhena qe sna duhen
> # c.category_slug => Bene te mudnur qe gjat ciklit for te zgjighen vetem
> category_slug ne objekte
> if single_slug in categories:
> matching_series =
> TutorialSeries.objects.filter(tutorial_category__category_slug=single_slug)
> series_urls = {}
> for m in matching_series.all():
> part_one =
> Tutorial.objects.filter(tutorial_series__tutorial_series=m.tutorial_series).earliest("tutorial_published")
> series_urls[m] = part_one.tutorial_slug
> return render(request,"main/category.html",{"part_ones": series_urls})
>
> tutorials = [t.tutorial_slug for t in Tutorial.objects.all()]
> if single_slug in tutorials:
> this_tutorial = Tutorial.objects.get(tutorial_slug = single_slug)
> return render(request,
>   "main/tutorial.html",
>   {"tutorial": this_tutorial})
>
> return HttpResponse(f"{single_slug} does not correspond to anything!")
>
>
>
>
> *Now the posts and the category response ok, but if i try to go at  /admin
> or /login or  /logout  I get the response  ex. *admin does not correspond
> to anything!
> *Even Even if I type a random url, it shows * {single_slug} does not
> correspond to anything!
>
> I think You understand me, waiting for a reply please
>
> Images:
>
> --
> 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/61ea7af0-bc85-4238-ac3c-2c767dcaeca6%40googlegroups.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/CAK4qSCccu3V_jhhzUtS_dAzHMXf6nn2qq22JE3vhXQJuTqZm%3Dw%40mail.gmail.com.


Using multiple models in for loop on template

2019-07-29 Thread Keegen Knapp
I'm trying to create a detail view for the model PROJECT. In the detail 
view, I want to also include a model TASK and all the related objects in 
ATTACHMENTS to each task.
I'd like to do something like this -
{for task in task list}
{task}
{for attachments in task}
{attachment}
{end for}
{end for}


Here are snippets of the working files. Thanks in advance for any help!!

Models.py - *Project*
class Project(NamedModel):
"""An Asana project in a workspace having a collection of tasks."""
layout_choices = (
('board', _('board')),
('list', _('list')),
)

archived = models.BooleanField(default=False)
color = models.CharField(choices=COLOR_CHOICES, max_length=16, 
null=True, blank=True)
created_at = models.DateTimeField(auto_now_add=True)
current_status = models.ForeignKey(
'ProjectStatus', null=True, on_delete=models.SET_NULL, 
related_name='current_status')
custom_field_settings = models.ManyToManyField(
'CustomField', through='CustomFieldSetting', 
related_name='custom_field_settings')
due_date = models.DateField(null=True, blank=True)
due_on = models.DateField(null=True, blank=True)
followers = models.ManyToManyField('User', 
related_name='projects_following', blank=True)
html_notes = models.TextField(null=True, blank=True)
layout = models.CharField(choices=layout_choices, max_length=16)
members = models.ManyToManyField('User', blank=True)
modified_at = models.DateTimeField(auto_now=True)
notes = models.TextField(null=True, blank=True)
owner = models.ForeignKey(
'User', to_field='remote_id', related_name='projects_owned',
null=True, on_delete=models.SET_NULL)
public = models.BooleanField(default=False)
resource_type = models.CharField(max_length=24, null=True, blank=True, 
default='project')
start_on = models.DateField(null=True, blank=True)
team = models.ForeignKey('Team', to_field='remote_id', null=True, 
on_delete=models.SET_NULL)
workspace = models.ForeignKey('Workspace', to_field='remote_id', 
on_delete=models.CASCADE)

def asana_url(self, **kwargs):
"""Returns the absolute url for this project at Asana."""
return '{}{}/list'.format(ASANA_BASE_URL, self.remote_id)


Models.py - Task
class Task(Hearted, NamedModel):
"""An Asana task; something that needs doing."""
status_choices = (
('inbox', _('inbox')),
('upcoming', _('upcoming')),
('later', _('later')),
)
subtype_choices = (
('default_task', _('default task')),
('section', _('section')),
)

assignee = models.ForeignKey(
'User', to_field='remote_id', related_name='assigned_tasks', 
null=True, blank=True,
on_delete=models.SET_NULL)
assignee_status = models.CharField(choices=status_choices, 
max_length=16)
completed = models.BooleanField(default=False)
completed_at = models.DateTimeField(null=True, blank=True)
custom_fields = models.TextField(null=True, blank=True)
created_at = models.DateTimeField(auto_now_add=True)
dependencies = models.ManyToManyField('self', symmetrical=False, 
related_name='dependents')
due_at = models.DateTimeField(null=True, blank=True)
due_on = models.DateField(null=True, blank=True)
followers = models.ManyToManyField('User', 
related_name='tasks_following')
html_notes = models.TextField(null=True, blank=True)
modified_at = models.DateTimeField(auto_now=True)
notes = models.TextField(null=True, blank=True)
parent = models.ForeignKey(
'self', to_field='remote_id', null=True, blank=True, 
on_delete=models.SET_NULL)
projects = models.ManyToManyField('Project')
resource_subtype = models.CharField(
choices=subtype_choices, max_length=24, default='default_task')
resource_type = models.CharField(max_length=24, null=True, blank=True, 
default='task')
start_on = models.DateField(null=True, blank=True)
tags = models.ManyToManyField('Tag')

def _asana_project_url(self, project):
return '{}{}/{}/list'.format(ASANA_BASE_URL, 
project.workspace.remote_id, self.remote_id)

def asana_url(self, **kwargs):
"""Returns the absolute url for this task at Asana."""
if 'project' in kwargs:
return self._asana_project_url(kwargs['project'])
projects = self.projects.all()
if len(projects) == 1:
project = projects[0]
return self._asana_project_url(project)
return super(Task, self).asana_url()

def delete_from_asana(self, *args, **kwargs):
"""Deletes this task from Asana and then deletes this model 
instance."""
client = client_connect()
client.tasks.delete(self.remote_id)
logger.debug('Deleted asana task %s', self.name)
return self.delete(*args, **kwargs)

def due(self):
return self.due_at or self.due_on
due.admin_order_field = 'due_on'

def refresh_from_asana(self):

Re: BigAutoField not working

2019-07-29 Thread Chetan Ganji
If you cant see it in your table in dbms, you probably have not run
makemigrations and migrate commands.

If you have done that, you should grab the migration file when that field
was first created and paste that code here. Also paste your old n new code
from the models.py file. So that someone can help you.

On Mon, Jul 29, 2019, 10:03 PM Akshaya Krishnan 
wrote:

> Hi all,
>
> I am trying to create a field in Django 2.2 with BigAutoField as the
> datatype. The backend is MySql. And I am using the mysql.connector.
>
> When I try to add datatype as BigAutoField for the column, I cannot see
> that column in my table.
>
> If I alter it from 'AutoField' to 'BigAutoField', it throws an error:
>
> ValueError: Cannot alter field TableName.columName into
> TableName.columName  - they do not properly define db_type (are you using a
> badly-written custom field?)
>
>
> Thanks in advance
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/2ab746fb-70c9-4979-a557-db83f39d00c7%40googlegroups.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/CAMKMUjvVKZRs0WjP2QuRnffLfbUHC2%2B0xcM4bsSa_MkPnPDnEw%40mail.gmail.com.


BigAutoField not working

2019-07-29 Thread Akshaya Krishnan
Hi all, 

I am trying to create a field in Django 2.2 with BigAutoField as the 
datatype. The backend is MySql. And I am using the mysql.connector. 

When I try to add datatype as BigAutoField for the column, I cannot see 
that column in my table.

If I alter it from 'AutoField' to 'BigAutoField', it throws an error:

ValueError: Cannot alter field TableName.columName into 
TableName.columName  - they do not properly define db_type (are you using a 
badly-written custom field?)


Thanks in advance



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2ab746fb-70c9-4979-a557-db83f39d00c7%40googlegroups.com.


Re:

2019-07-29 Thread Jani Tiainen
My mistake.

I thuought that OP was asking about uploading and storing multiple files to
model.

First part (uploading) is easy since docs do cover that.

Second part is tricky since it requires data structure capable of storing
multiple files and there are so many ways to do that.



ma 29. heinäk. 2019 klo 18.22 Aldian Fazrihady 
kirjoitti:

> Multiple file uploads already there for many years. The link I shared
> above show you how to do that the Django way.
>
> Regards,
>
> Aldian Fazrihady
> http://aldianfazrihady.com
>
> On Mon, 29 Jul 2019, 21:52 Jani Tiainen,  wrote:
>
>> Hi.
>>
>> TL; DR; you can't.
>>
>> You though can upload multiple files just fine you just need to handle
>> them manually.
>>
>> Also if you plan to keep files around your models must enable that.
>>
>>
>> ma 29. heinäk. 2019 klo 15.48 Suraj Thapa FC 
>> kirjoitti:
>>
>>> How can I create a file field which one can upload Multiple files in
>>> it...
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAPjsHcE%2BMSVGHiQ0bx4z_2pxMMiE57FD44kFn4hE%3DsSLaj66kw%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/CAHn91of_AD_METU8A3J4qhHo_E93Qd4hJyS73uRQh43GpRsAgg%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/CAN7EoAYAh%2Bou8fyzcBhyHn25SDx7%3D3Vw%2BY7OGY2%2B%3D3fjk-C0kg%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/CAHn91odErG3F4HGUCBFFh6oQdmg3CEDC2N3gCLNUUeUPrm1bbw%40mail.gmail.com.


Re:

2019-07-29 Thread Aldian Fazrihady
Multiple file uploads already there for many years. The link I shared above
show you how to do that the Django way.

Regards,

Aldian Fazrihady
http://aldianfazrihady.com

On Mon, 29 Jul 2019, 21:52 Jani Tiainen,  wrote:

> Hi.
>
> TL; DR; you can't.
>
> You though can upload multiple files just fine you just need to handle
> them manually.
>
> Also if you plan to keep files around your models must enable that.
>
>
> ma 29. heinäk. 2019 klo 15.48 Suraj Thapa FC 
> kirjoitti:
>
>> How can I create a file field which one can upload Multiple files in
>> it...
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAPjsHcE%2BMSVGHiQ0bx4z_2pxMMiE57FD44kFn4hE%3DsSLaj66kw%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/CAHn91of_AD_METU8A3J4qhHo_E93Qd4hJyS73uRQh43GpRsAgg%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/CAN7EoAYAh%2Bou8fyzcBhyHn25SDx7%3D3Vw%2BY7OGY2%2B%3D3fjk-C0kg%40mail.gmail.com.


Error: No module named allauth

2019-07-29 Thread Karreerchange
Hi, 

updated the 'allauth' app to installed apps in settings.py
getting the error 'No module named 'allauth'

Tried pip installing, but no matches returned.

keans-air:bnt ProductionEnv$ pip3 install django allauth

Requirement already satisfied: django in 
/usr/local/lib/python3.7/site-packages (2.2.3)

Collecting allauth

  ERROR: Could not find a version that satisfies the requirement allauth 
(from versions: none)

ERROR: No matching distribution found for allauth


Has anyone experienced this, please can you advise how you resolved?


Best,


K

-- 
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/1701d324-2896-4a4e-b888-2cc647dfff42%40googlegroups.com.


Re:

2019-07-29 Thread Jani Tiainen
Hi.

TL; DR; you can't.

You though can upload multiple files just fine you just need to handle them
manually.

Also if you plan to keep files around your models must enable that.


ma 29. heinäk. 2019 klo 15.48 Suraj Thapa FC 
kirjoitti:

> How can I create a file field which one can upload Multiple files in it...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPjsHcE%2BMSVGHiQ0bx4z_2pxMMiE57FD44kFn4hE%3DsSLaj66kw%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/CAHn91of_AD_METU8A3J4qhHo_E93Qd4hJyS73uRQh43GpRsAgg%40mail.gmail.com.


Re: Django Project Server not starting when running on linux server but running on local windows desktop

2019-07-29 Thread abhijithez
Thank You! The issue is solved now.

I removed the Anaconda installation and installed Python 3.6.3.
Also I downgraded to Django 2.1.10.

On Saturday, July 27, 2019 at 12:21:49 PM UTC+5:30, jlgimeno71 wrote:
>
>
>
> On Fri, Jul 26, 2019, 8:22 PM Abhijith E > 
> wrote:
>
>> It's the latest version.
>> Also I am using Anaconda Distribution with Python 3.5
>>
>> On Sat, Jul 27, 2019, 8:44 AM Jorge Gimeno > > wrote:
>>
>>> What version of Django are you running?
>>>
>>> On Fri, Jul 26, 2019, 7:34 AM abhijithez >> > wrote:
>>>
 Hi All,

 I have created a Django Project that is working fine on local desktop 
 but when I am starting the same on linux server using python manage.py 
 runserver it shows the following:

 $python manage.py runserver

 Watching for file changes with StatReloader
 Performing system checks...
 System check identified no issues (0 silenced).
 Traceback (most recent call last):
   File "manage.py", line 21, in 
 main()
   File "manage.py", line 17, in main
 execute_from_command_line(sys.argv)
   File 
 "/home/mluser/anaconda3/lib/python3.5/site-packages/django/core/managemen  

  

  
t/__init__.py", line 381, in execute_from_command_line
 utility.execute()
   File 
 "/home/mluser/anaconda3/lib/python3.5/site-packages/django/core/managemen  

  

  
t/__init__.py", line 375, in execute
 self.fetch_command(subcommand).run_from_argv(self.argv)
   File 
 "/home/mluser/anaconda3/lib/python3.5/site-packages/django/core/managemen  

  

  
t/base.py", line 323, in run_from_argv
 self.execute(*args, **cmd_options)
   File 
 "/home/mluser/anaconda3/lib/python3.5/site-packages/django/core/managemen  

  

  
t/commands/runserver.py", line 60, in execute
 super().execute(*args, **options)
   File 
 "/home/mluser/anaconda3/lib/python3.5/site-packages/django/core/managemen  

  

  
t/base.py", line 364, in execute
 output = self.handle(*args, **options)
   File 
 "/home/mluser/anaconda3/lib/python3.5/site-packages/django/core/managemen  

  

  
t/commands/runserver.py", line 95, in handle
 self.run(**options)
   File 
 "/home/mluser/anaconda3/lib/python3.5/site-packages/django/core/managemen  

  

  
t/commands/runserver.py", line 102, in run
 autoreload.run_with_reloader(self.inner_run, **options)
   File 
 "/home/mluser/anaconda3/lib/python3.5/site-packages/django/utils/autorelo  

  

  
ad.py", line 587, in run_with_reloader
 start_django(reloader, main_func, *args, **kwargs)
   File 
 "/home/mluser/anaconda3/lib/python3.5/site-packages/django/utils/autorelo  

  

  
ad.py", line 572, in start_django
 reloader.run(django_main_thread)
   File 
 "/home/mluser/anaconda3/lib/python3.5/site-packages/django/utils/autorelo  

  

  
ad.py", line 290, in run
 self.run_loop()
   File 
 "/home/mluser/anaconda3/lib/python3.5/site-packages/django/utils/autorelo  

  

  

Re:

2019-07-29 Thread Aldian Fazrihady
https://docs.djangoproject.com/en/2.2/topics/http/file-uploads/

On Mon, Jul 29, 2019 at 7:48 PM Suraj Thapa FC 
wrote:

> How can I create a file field which one can upload Multiple files in it...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPjsHcE%2BMSVGHiQ0bx4z_2pxMMiE57FD44kFn4hE%3DsSLaj66kw%40mail.gmail.com
> 
> .
>


-- 
Regards,

Aldian Fazrihady
http://aldianfazrihady.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/CAN7EoAYOWne%3D0Zj3Ma3K5nJpGhUbXE59--f29HE1bnpduDW44A%40mail.gmail.com.


[no subject]

2019-07-29 Thread Suraj Thapa FC
How can I create a file field which one can upload Multiple files in it...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPjsHcE%2BMSVGHiQ0bx4z_2pxMMiE57FD44kFn4hE%3DsSLaj66kw%40mail.gmail.com.


Simple project, URL porblems

2019-07-29 Thread Marsel Beqiri
Hi, i;m new here, also in django developing,

Lastly i tried to create an app, something like a blog.  And I have created 
a Model with FK relations like this:  *Category=>Subcategory=>Post.*
Till here everything is fine, also when I create a Post in Admin Panel 
there is a char field to put the post url ex. post-nr-1

But  I want to make my app URL, friendly, just Url no '/ ' (single slug) . 
like this 

*click on category:  main/category-title-1*

*click on post: main/post-title-1 *

So just one URL, not slashing. 

urlpatterns = [
  path("", views.homepage, name = "homepage"),
  path("register/",views.register, name = "register"),  
   
path("logout/", views.logout_request, name = "logout"),
  
path("login/", views.login_request, name = "login"),
   
path("/", views.single_slug, name="single_slug"),
 
]




 View function mentioned before
def single_slug(request, single_slug): # Mund te pranojme single_slug si 
variabel neper  URL path 
# Me poshte kemi nje comprehensice List
categories = [c.category_slug for c in TutorialCategory.objects.all()] # 
c.category_slug : do marri vetem URL (slug) dhe do i ruaj ne liste. Pra 
shmang te dhena qe sna duhen
# c.category_slug => Bene te mudnur qe gjat ciklit for te zgjighen vetem 
category_slug ne objekte
if single_slug in categories:
matching_series = 
TutorialSeries.objects.filter(tutorial_category__category_slug=single_slug)
series_urls = {}
for m in matching_series.all():
part_one = 
Tutorial.objects.filter(tutorial_series__tutorial_series=m.tutorial_series).earliest("tutorial_published")
series_urls[m] = part_one.tutorial_slug
return render(request,"main/category.html",{"part_ones": series_urls})

tutorials = [t.tutorial_slug for t in Tutorial.objects.all()]
if single_slug in tutorials:
this_tutorial = Tutorial.objects.get(tutorial_slug = single_slug)
return render(request, 
  "main/tutorial.html",
  {"tutorial": this_tutorial})

return HttpResponse(f"{single_slug} does not correspond to anything!") 




*Now the posts and the category response ok, but if i try to go at  /admin 
or /login or  /logout  I get the response  ex. *admin does not correspond 
to anything!
*Even Even if I type a random url, it shows * {single_slug} does not 
correspond to anything! 

I think You understand me, waiting for a reply please

Images: 

-- 
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/61ea7af0-bc85-4238-ac3c-2c767dcaeca6%40googlegroups.com.


Re: LANGUAGE_CODE

2019-07-29 Thread Yves de Champlain
Hi

Thanks a lot !

yves

> Le 28 juill. 2019 à 22:56, Aldian Fazrihady  a écrit :
> 
> Hi Yves, please clear cookies and refresh your django app page afterwards.
> 
> It is possible to not use cookies at all regarding i18n if you use language 
> code as part of URL. I always prefer using URL for i18n. 
> 
> On Mon, Jul 29, 2019 at 1:08 AM Yves de Champlain  > wrote:
> HI
> 
> Django translation works very well for me, except that when I try to change 
> LANGUAGE_CODE in settings.py, my site remains in French. I need to change my 
> OS system settings to see the English version.
> 
> I have two languages, English as default and a French Translation.
> 
> LANGUAGES = (
> ('en', _('English')),
> ('fr', _('French')),
> )
> 
> LANGUAGE_CODE = 'en'
> 
> Thanks for your insights !
> 
> yves
> 
> 
> 
> -- 
> 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/3a301603-3237-4674-9d8d-2f6362d3154e%40googlegroups.com
>  
> .
> 
> 
> -- 
> Regards,
> 
> Aldian Fazrihady
> http://aldianfazrihady.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/CAN7EoAbuxKZ%3DzrmnAMAWxGpcFe-sFvu9x16VWRQe%3DWa8NrLUPw%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/C2AB6E38-A093-4709-8C3B-D45744C2B3A4%40gmail.com.


Django Rest Framework

2019-07-29 Thread Soumen Khatua
Hi Folks,
I extended User model by Profile Model but mu requirement is like If I'm
creating any resource it should is_your_friend equals True or yes but for
others it should show  is_your_friend equals to False or No. Also one
column is there called mutual friend if this friend common for me and
others it should show Mutual Friend equals to friend name like that. How i
can do that using Django Rest Framework,Please help me guys,it's urgent!!!


Thank You

Regards,
Soumen

-- 
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/CAPUw6WZsbQ%2By9bjhwLnk3TqpBwrPAjh3V47LzdyFeEVm3u5OEg%40mail.gmail.com.


Re: Django inbuilt Model

2019-07-29 Thread Soumen Khatua
Thank you for your response.

Regards,
Soumen

On Sun, 28 Jul 2019, 23:27 Juhana Jauhiainen, 
wrote:

> Hi Soumen,
>
> You could try with
>
> profiles = Profile.objects.filter(user__username=username)
>
>
> I would also suggest changing your model definition to something like
>
> class Profile(models.Model):
> user = models.OneToOneField(User, on_delete=models.CASCADE)
>
> Then you will have exactly one Profile per User and you can also access
> the Profile from user object with
>
> user.profile
>
> FYI, related_name defines the name of reverse relation. So in your case it
> would mean you can access the profile from a user object with
>
> user.user_model
>
> Which is probably not what you want..
>
> -Juhana
>
> On Sun, Jul 28, 2019 at 7:49 PM Soumen Khatua 
> wrote:
>
>> Hi Folks,
>> I Extended Profile Model from dajngo inbuilt User model but Now I want
>> call all the details those are associated with Username in Profile model. I
>> got the username but how i cann call it in Profile model.
>>
>> Ex:
>> class Profile(models.Model):
>> user = models.ForeignKey(User,related_name = 'user_model,..)
>>
>> data = Profile.objects.filter(user = username)
>>
>> But it's not working please help me guys.
>>
>> Thank You
>>
>> Regards,
>> Soumen
>>
>> --
>> 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/CAPUw6WY%2BUNTU6UOAKyOxMWg24dAsmc7eB7%3D9kZTDjiukn3%2BKJQ%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/CABScFx851WQseNsCYf%3DYdW6eAYiPW05EQg-qEk%2B%2BTSZNVAXGuQ%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/CAPUw6WY%3DX6_moHtc%2BdJYqE2R3TnKVuc-SNPfXHx_d9oGqVCd-g%40mail.gmail.com.