Re: Django admin unable to edit site - CMS links always redirect login page

2019-02-20 Thread gilwell muhati
Hello Angela,

Your Apache is acting up, please fix it then we can solve the other issue.



*Regards,Gilwell Muhati | +254 710 739 116 | *
*~~“The mind is its own place and in itself can make a heaven of hell, a
hell of heaven…”~~John Milton *


On Wed, Feb 20, 2019 at 5:16 AM Angela Checa  wrote:

> Dear every one:
>
> I've been searching for a solution for this problem but I can find an
> answer, please help me. The CMS does not allow to edit sites or do anything
> and always redirect to login page. I have a main site with an app, the
> domain is something like www.sitioprincipal.com and inside this portal I
> have three links for access other apps like this:
>
> www.sitioprincipal.co/app2
>
> www.sitioprincipal.co/app3
>
> www.sitioprincipal.co/app4
>
> All the apps were configured in Apache and for sometime the accesss to CMS
> (admin of the site) worked fine, but recently (i dont know why) when I
> loggin into any of the cms of app2, app3 and app4 after correct login it
> displays the first admin interface of site
> http://www.sitioprincipal.com/es/admin/ with the list of administration
> options and links:
>
> Authentication and Authorization Groups
> Users
> Cmsplugin_Filer_Image Thumbnail options
> django CMS Pages
> Static placeholders
> Filer Folders
> Thumbnail options
> Sites Sites
>
> but all the links and buttons seems to be bad because always redirects to
> login page again and it is imposible to edit the site pages or do anything
> else.  This happend in CMS of all sites but not in the main site
> www.sitioprincipal.com, in that CMS everything works well.  Please help
> me to find out how to fix this problem.
>
> This is the version I have:
>
> django-cms 3.2.5
>
> Django 1.9.5
>
> This is a part of the settings.py file of the main site
> www.sitioprincipal.com
>
> # Application definition
>
> INSTALLED_APPS = [
> 'cms',
> 'treebeard',
> 'menus',
> 'sekizai',
> 'easy_thumbnails',
> 'filer',
> 'mptt',
> 'cmsplugin_filer_image',
> 'cmsplugin_filer_link',
> 'djangocms_admin_style',
> 'reversion',
> 'djangocms_text_ckeditor',
> 'djangocms_flash',
> 'coleccionesonline.apps.ColeccionesonlineConfig',
> 'django.contrib.admin',
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> 'django.contrib.sites',
> ]
>
> # Módulos de migración para los plugins de django-filer
> MIGRATION_MODULES = {
> 'cmsplugin_filer_image': 'cmsplugin_filer_image.migrations_django',
> 'cmsplugin_filer_link': 'cmsplugin_filer_link.migrations_django'
> }
>
> MIDDLEWARE_CLASSES = [
> 'cms.middleware.utils.ApphookReloadMiddleware',
> 'django.middleware.security.SecurityMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.common.CommonMiddleware',
> 'django.middleware.locale.LocaleMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware',
> 'django.middleware.clickjacking.XFrameOptionsMiddleware',
> 'cms.middleware.user.CurrentUserMiddleware',
> 'cms.middleware.page.CurrentPageMiddleware',
> 'cms.middleware.toolbar.ToolbarMiddleware',
> 'cms.middleware.language.LanguageCookieMiddleware',
> ]
>
> # Módulo de urls
> ROOT_URLCONF = 'sitioprincipal.urls'
>
> # Sessión manejada por cookies
> SESSION_ENGINE = 'django.contrib.sessions.backends.signed_cookies'
>
> TEMPLATES = [
> {
> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
> 'DIRS': [os.path.join(BASE_DIR,'sitioprincipal','templates'),],
> 'APP_DIRS': True,
> 'OPTIONS': {
> 'context_processors': [
> 'django.template.context_processors.debug',
> 'django.template.context_processors.request',
> 'django.contrib.auth.context_processors.auth',
> 'django.contrib.messages.context_processors.messages',
> 'sekizai.context_processors.sekizai',
> 'cms.context_processors.cms_settings',
> ],
> },
> },
> ]
>
> WSGI_APPLICATION = 'sitioprincipal.wsgi.application'
>
> # CMS settings
> SITE_ID = 1
>
> ...
>
> Thanks for any kind of help.
>
>
> Angela.
>
> --
> 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
> 

Re: Django : use openstreetMap and postgis to add geolalization field to localizate my users in a country

2019-02-20 Thread Jani Tiainen
Hi.

Definitely it is possible and it isn't even very hard to do.

ke 20. helmik. 2019 klo 12.31 abdouramane mahamane 
kirjoitti:

> I'm new in django and i want to use openstreetMap parameters into users
> field city or street.
> This localization will allow me to find them and to measure the distance
> between their entreprises.
> It's for an crossdocking app.
> What do you thing about this idea ? is ti possible with OpenstreetMap in
> django?
> thanks :)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b5a8843f-1458-4ed6-8d14-a702ad7fdc9c%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/CAHn91oeONzo%2B72rkkx%3DAtqovcZJHho%3DyFLW1%2BXKtL4fdQ7ajEQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: passing django models data to python script

2019-02-20 Thread Mike Dewhirst

On 20/02/2019 6:39 pm, Ousmane Baricisse wrote:

Hi,
I would like to implement a web app using reactjs and django. I have a 
python script which does some sort of optimization and stores the 
final output in a list and returns it. Right now everything is static 
in the python script and I would like to make it dynamic so that i can 
get a user input (from a web browser) and with that, run the python 
script internally, and pass back the data to the django models, which 
will update the values in the API.

so far, I know how to:
build a REST API with django,
get user input using reactjs,
make post and get request to get data from the API or update the API 
data from user input,
However, I do not know how to access the models values in my python 
script, run the python script with django, and update the API with so 
that it contains the output in order for me to be able fetch the 
output with react.


I am not sure if im doing this the easiest way, as it sounds so 
complicated, but I am open to suggestions on better ways of doing this.


I would probably take my python script and convert it into one or more 
model methods. In principle, if the data needs to be manipulated the 
model should do the heavy lifting. It can be argued that database 
procedures should do it but that is a rare art and the Django ORM (and 
model methods) make it much easier to maintain.


At some point it needs to be saved to the database so the broad idea is 
to put the user input into a model field then override the model's 
save() method to call model methods to do the manipulation and perhaps 
fill up some other fields before or add child records after the save 
actually happens.


My typical pattern for such a save is ...

    def save(self, *args, **kwargs):
    # need to pass links across the super boundary
    links = self.make_useful_links()
    super(Substance, self).save(*args, **kwargs)
    self.create_child_records(links)

... where Substance is the model name and 'links' is returned from a 
model method. The call to super() triggers the normal Substance.save() 
method. Because child records need the substance id for their FK, they 
cannot be created until after the actual save() beyond which we can 
guarantee the substance.id is not None.


There are also pre_save and post_save signals available but I prefer the 
above because I find it easier to see what the code is doing.


Your question about how to access the model values in your script is 
solved if you embed the script in a model method. Every model method 
should have 'self' as the first arg. 'self' is the model instance so 
every field is available via self.field. For example if the Substance 
name is used to generate a bunch of URLs pointing to a bunch of public 
databases containing information on that substance ...


    def make_useful_links(self):
        links = list()
    for database in databases:
            links.append(self.assemble_url())
            # self.assemble_url() has access to self.name and 
self.cas_no fields

    return links

As it happens this could be done after the super() call but if you want 
to save anything on the model, those fields have to be complete before 
the save()


hth



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/394fd1d7-a2e2-4c59-ba9f-ba35d7eba9cd%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/48fd56c6-3636-149e-f942-3c96ff02933c%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: Image Upload in admin panel

2019-02-20 Thread Ryan Nowakowski
Check out ImageField:
https://docs.djangoproject.com/en/2.1/ref/models/fields/#imagefield

On February 14, 2019 12:37:04 PM CST, Surajeet Das  
wrote:
>How do I upload images from admin panel and retrieve from a html page ?
>
>-- 
>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/6f4b3bcd-fdb8-4c25-8c89-e0e18f9c6da9%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/72EB91EF-237A-4D6F-A963-1D259D449438%40fattuba.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django ForeignKey field name “check” raises SystemCheckError

2019-02-20 Thread Tim Graham
I believe the warning is incorrect. See 
https://code.djangoproject.com/ticket/23615 for the disucssion.

On Wednesday, February 20, 2019 at 12:25:46 PM UTC-5, Eric Palmitesta wrote:
>
> The Django docs (
> https://docs.djangoproject.com/en/1.11/topics/db/models/#field-name-restrictions)
>  
> state there are only two restrictions on model field names:
>
>
>1. A field name cannot be a Python reserved word
>2. A field name cannot contain more than one underscore in a row
>
>
> However, given the following example, it doesn't look like I can use the 
> field name `check` as a ForeignKey.
>
> class Check(models.Model):
>
>
> name = models.CharField(max_length=100)
>
>
> class MyModel(models.Model):
>
>
> # this works fine
> #check = models.BooleanField()
> 
> # this breaks
> check = models.ForeignKey(Check, on_delete=models.PROTECT, 
> related_name='+')
>
> Here's the error:
>
> $ python manage.py check
> SystemCheckError: System check identified some issues:
>
>
> ERRORS:
> myapp.MyModel: (models.E020) The 'MyModel.check()' class method is 
> currently overridden by  ForwardManyToOneDescriptor object at 0x03A818D0>
>
>
> Are the docs wrong, or am I doing something wrong?
>
> This project is using Python 2 and Django 1.11
>
> Here's the StackOverflow question: 
> https://stackoverflow.com/questions/54681167/
>

-- 
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/6a98e996-5f00-4be4-88e0-456dcff7ba96%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django ForeignKey field name “check” raises SystemCheckError

2019-02-20 Thread Eric Palmitesta
The Django docs 
(https://docs.djangoproject.com/en/1.11/topics/db/models/#field-name-restrictions)
 
state there are only two restrictions on model field names:


   1. A field name cannot be a Python reserved word
   2. A field name cannot contain more than one underscore in a row


However, given the following example, it doesn't look like I can use the 
field name `check` as a ForeignKey.

class Check(models.Model):


name = models.CharField(max_length=100)


class MyModel(models.Model):


# this works fine
#check = models.BooleanField()

# this breaks
check = models.ForeignKey(Check, on_delete=models.PROTECT, 
related_name='+')

Here's the error:

$ python manage.py check
SystemCheckError: System check identified some issues:


ERRORS:
myapp.MyModel: (models.E020) The 'MyModel.check()' class method is 
currently overridden by 


Are the docs wrong, or am I doing something wrong?

This project is using Python 2 and Django 1.11

Here's the StackOverflow question: 
https://stackoverflow.com/questions/54681167/

-- 
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/5c3a58d0-3a5b-4703-b478-7f4d2cf1dd05%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Question on implementing a Django auction site

2019-02-20 Thread beneficialmusic
I'm relatively new to Django and have been learning with a long term 
interest in developing an auction site. I can't seem to find any up to date 
existing auction projects available for reference. There are some on Git 
Hub, but most are outdated or not very developed.

My question is: since my auction site would need a lot of functionality 
used in a typical e-commerce site (shopping cart, payments, shipping 
details, etc), would it be best to start from an existing open source 
e-commerce project and modify that for auction purposes, and if so, which 
would you recommend (Django Shop, Shuup, Satchless, something else)?

-- 
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/6a9a7a21-8560-4374-9403-044872cfa05c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django scheduling/calendaring

2019-02-20 Thread Jason
Why are you making your own learning management system when there’s 
https://open.edx.org?

-- 
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/0738fe06-0bef-4467-941e-cc742bc05046%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django CRM Tool

2019-02-20 Thread Anusha
Hi,

This thread is outdated. But here the perfect answer for your thread.

https://github.com/MicroPyramid/Django-CRM - It's a open source you can 
download the code.

On Saturday, June 2, 2012 at 10:30:49 PM UTC+5:30, Zeeshan Syed wrote:
>
> Hey everyone, 
>
> I've been asked to create a CRM tool using Django. Just wondering what 
> route I should take. Would it be wise to start from scratch? Should I 
> play around with Django admin and mess around with that? I've looked 
> at the django-crm project, has anyone had any experience with that? 
>
> Any help is much appreciated. 
>
> Thanks, 
> Zee

-- 
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/2b55034e-8270-42e0-beac-f1d04d4527ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re:

2019-02-20 Thread Gil Obradors
Or  python manage.py  or python3 manage.py

Or you not have manage.py inside your dir

Not recommended( i think isn best practice to put +x the file manage.py and
execute directly ./manage.py )

Can you paste ls ?
El dc., 20 de febr. 2019, 13:16, bhushan patil  va
escriure:

> Guys I am not able to run the file manage.py on runserver.Its showing that
> no such file or directory.Can anyone help me with this
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJ%3Ds-My__xLUdSt6vV%2BJ%2B1AAir8LAfFxX7P9kxf5cG-eFCKEHA%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/CAK-JoTSn%2BKYp7Cef_sFmpfmM6mZFkf6h1SRZdF1vbjjXMeBb_w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re:

2019-02-20 Thread PARTH PATIL
Hey bhushan you might be running the command in wrong directory, open the 
terminal into the django project directory and and then run ./manage.py 
runserver

If you are still stuck you can upload some screenshots so that we can 
better help you

On Wednesday, February 20, 2019 at 5:46:58 PM UTC+5:30, bhushan patil wrote:
>
> Guys I am not able to run the file manage.py on runserver.Its showing that 
> no such file or directory.Can anyone help me with this
>

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


[no subject]

2019-02-20 Thread bhushan patil
Guys I am not able to run the file manage.py on runserver.Its showing that
no such file or directory.Can anyone help me with this

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


passing django models data to python script

2019-02-20 Thread Ousmane Baricisse
Hi,
I would like to implement a web app using reactjs and django. I have a 
python script which does some sort of optimization and stores the final 
output in a list and returns it. Right now everything is static in the 
python script and I would like to make it dynamic so that i can get a user 
input (from a web browser) and with that, run the python script internally, 
and pass back the data to the django models, which will update the values 
in the API. 
so far, I know how to: 
build a REST API with django, 
get user input using reactjs, 
make post and get request to get data from the API or update the API data 
from user input, 
However, I do not know how to access the models values in my python script, 
run the python script with django, and update the API with so that it 
contains the output in order for me to be able fetch the output with react.

I am not sure if im doing this the easiest way, as it sounds so 
complicated, but I am open to suggestions on better ways of doing this.
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/394fd1d7-a2e2-4c59-ba9f-ba35d7eba9cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django : use openstreetMap and postgis to add geolalization field to localizate my users in a country

2019-02-20 Thread abdouramane mahamane
I'm new in django and i want to use openstreetMap parameters into users 
field city or street.
This localization will allow me to find them and to measure the distance 
between their entreprises.
It's for an crossdocking app.
What do you thing about this idea ? is ti possible with OpenstreetMap in 
django?
thanks :)

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


Re: Best option for wrapping a wsgi app

2019-02-20 Thread Avraham Serour
I recommend nginx+uwsgi


On Tue, Feb 19, 2019 at 3:09 PM Anton Melser  wrote:

> Hi,
>
> I searched high and low but my Google-foo must be lacking. I want to wrap
> a wsgi app (https://github.com/tsudoko/anki-sync-server) and serve it
> under my Django site. After wasting large amounts of time working around
> this thinking it wasn't possible, I stumbled across
> https://github.com/2degrees/django-wsgi, which does the trick nicely (at
> least it appears to for what I need, though I have only tested locally).
> Unfortunately, the last commit was 3-4 years ago, and it doesn't support
> Django 1.10+ (is_authenticated() vs is_authenticated). I have submitted a
> PR and am currently using a fork but the project appears completely dead.
>
> What are other people using, if anything?
>
> Cheers,
> Anton
> --
> echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D4D465452snlbxq' | dc
> This will help you for 99.9% of your problems ...
>
> --
> 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/CAKywjPrsXNN1ve8PFYr9M%2BpbTHqA4T2xuwPAm%3DmJR13trp2meQ%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/CAFWa6t%2BYGDV3E_wrkqvHqwBu9kRvzvANdbfO_drxYrfKEkJj4Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to create model for this json data

2019-02-20 Thread 'Amitesh Sahay' via Django users
Hi,
First, try to understand the error messages. It says there are fields that are 
required, but you are leaving them blank. Then, there are some fields those 
cannot have "null", but soemhow you are adding null values to them.
I would suggest using below Django CLI commands to add the data to your table
python manage.py loaddata .
Below is the link that will guide you with further informationDjango dumpdata 
and loaddata (Example)


| 
| 
| 
|  |  |

 |

 |
| 
|  | 
Django dumpdata and loaddata (Example)

A protip by itseranga about django, database, model, and dumpdata.
 |

 |

 |


I hope that will come handy to you.
Regards,
Amitesh Sahay91-750 797 8619 

On Wednesday, 20 February, 2019, 12:31:23 pm IST,  
wrote:  
 
 

On Tuesday, February 19, 2019 at 10:02:32 PM UTC+5:30, optvi...@gmail.com wrote:
Hi I have data like this
{
"Name" : "pk",
"Applist" : ["zom","bc"],
 "Url":   ["As","de"]

}

How to define field name for list I am not getting

i define a class with foreign key but still getting error?

class keywordfield(models.Model):
keyword=models.CharField(max_length=50,null=True)
appNamefield=models.ForeignKey("appNamefield", on_delete=models.CASCADE)






class appNamefield(models.Model):
appName = models.CharField(max_length=50,null=True)


serializer class
class appDetailsSearilizer(serializers.ModelSerializer):
class Meta:
model = keywordfield


fields = ('id','keyword','appNamefield')

json data

{
  
"keyword": "food",
  "appNamefield":["j","l"]

  
}


error
dict_items([('required', 'This field is required.'), ('null', 'This field may 
not be null.'), ('invalid', 'Invalid data. Expected a dictionary, but got 
{datatype}.')])
 



 

-- 
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/914062e6-1475-4653-8010-58a43b5bacb6%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/1172024440.2200567.1550650685702%40mail.yahoo.com.
For more options, visit https://groups.google.com/d/optout.