Re: trying to install a database for settings.py what should i do?

2009-01-14 Thread Prashanth

On Wed, Jan 14, 2009 at 11:37 PM, bconnors  wrote:
>
>  i'm trying for a free download of mysql from the internet. the 1st 3
> tries i've failed on.
>

You dint bother to explain how you tried and beyond that you are
asking this in the django mailing list which is no way related to
Mysql.



-- 
regards,
Prashanth

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



Re: AttributeError when trying to run syncdb after installing django-friends

2009-10-18 Thread Prashanth

Hi Gezim,

On Sun, Oct 18, 2009 at 7:58 AM, Gezim Hoxha  wrote:
> I also added "friends" to the INSTALLED_APPS.
> That all went fine. However running syncdb gave me this error:

Is friends django application or your custom application? looks like
you got the path in the installed_apps wrong can you paste the
installed apps from the setting file?

-- 
regards,
Prashanth
twitter: munichlinux
blog: prashanthblog.appspot.com
irc: munichlinux, JSLint, munichpython.

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



Re: Join .Net Community

2009-10-20 Thread Prashanth

On Tue, Oct 20, 2009 at 4:00 PM, Shawon_  wrote:
>
> Join .Net Community
>
> This group represents the Microsoft .Net community. All .net
> programmers all around the world are welcome here. In this group
> you'll find the latest releases of .Net related products, frameworks,
> Upgradation, technologies, IDEs etc. You also can share your
> experiences and problems you are facing. You can discuses about
> C#.Net, VB.net, ASP.Net and .Net frameworks, .net in other operating
> system etc. topics.

what a funky spam, admin action please


-- 
regards,
Prashanth
twitter: munichlinux
blog: prashanthblog.appspot.com
irc: munichlinux, JSLint, munichpython.

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



Re: django on jython

2009-11-27 Thread Prashanth
On Sat, Nov 28, 2009 at 6:20 AM, Xbiton  wrote:
> by setting the DATABASE_ENGINE = 'doj.backends.zxjdbc.mysql' and
> starting

You just say the engine as mysql

\> Error was: No module named mysql
>
\

Its clearly the issue "No module name mysql" install python-mysql
using easy-install or download and compile.


-- 
regards,
Prashanth
twitter: munichlinux
blog: prashanthblog.appspot.com
irc: munichlinux, JSLint, munichpython.

--

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




Re: WebFaction warning

2009-11-27 Thread Prashanth
Hi Kennath,

On Sat, Nov 28, 2009 at 11:14 AM, Kenneth Gonsalves  wrote:
>
> Please refrain from spreading FUD from one instance.

what do you mean? He is not spreading FUD, service is what we all pay
for, if it happens it is, let that be one or multiple instances. He is
just sharing his bad experience.

-- 
regards,
Prashanth
twitter: munichlinux
blog: prashanthblog.appspot.com
irc: munichlinux, JSLint, munichpython.

--

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




Re: IE9 and dev server errors

2010-09-17 Thread Prashanth
Hi,

On Sat, Sep 18, 2010 at 4:41 AM, TheIvIaxx  wrote:

> Hello all, I just downloaded the IE9 beta to see if everything worked
> as expected.  However when going to 127.0.0.1 with IE9 using the
> django dev server, i get:
>
> [Errno 10054] An existing connection was forcibly closed by the remote
> host
>
> Not sure what is going on.  Any ideas?
>
>
Are you using windows? Try disabling the firewall. Make sure about the port
as well.



-- 
regards,
Prashanth
twitter: munichlinux
blog: honeycode.in
irc: munichlinux, JSLint, munichpython.

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



Re: Query help

2010-11-02 Thread Prashanth
On Tue, Nov 2, 2010 at 9:35 AM, Itai Tavor  wrote:

> Hi people,
>
> Given this:
>
> class Category(models.Model):
>name = models.CharField()
>parent = models.ForeignKey('self', blank=True, null=True)
>tree_path = models.CharField() # //...///
>
> class Item(models.Model):
>name = models.CharField()
>categories = models.ManyToManyField(Category)
>
> I need a Category queryset, with each category annotated with a count of
> items which have categories whose tree_path starts with the tree_path of the
> current category, and with categories for which this count is 0 filtered
> out.
>
> In case that wasn't clear - I need an efficient way to do this:
>
>

You probably need to use annotate
http://docs.djangoproject.com/en/dev/ref/models/querysets/#annotate-args-kwargs


-- 
regards,
Prashanth
twitter: munichlinux
blog: honeycode.in
irc: munichlinux, JSLint, munichpython.

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



Re: rabbitmq + celery + django + celery.views.task_status ... simple example?

2010-11-02 Thread Prashanth
On Tue, Nov 2, 2010 at 10:42 PM, wawa wawawa  wrote:

> Hi All,
>
> So, I've got my django app, rabbitmq and celery working and processing
> my uploaded files. Next step is to get the client to display status
> results provided by JSON, ultimately refreshing to a results page when
> complete.
>
> I'm a little new to JSON / AJAX (AJAJ!) and I'm struggling a little
> with the templates and views part.
>
> Are there any easy examples out there?
>
>

Is the expectation like user will upload a file and will see a result? if
that is case why are using celery? b-list has a ajax example[1]. BTW,  if
you are trying to upload a file using ajax you need to create iframe using
javascript, you might want to use jsupload[2]


[1]
http://www.b-list.org/weblog/2006/jul/31/django-tips-simple-ajax-example-part-1/
[2] http://valums.com/
-- 
regards,
Prashanth
twitter: munichlinux
blog: honeycode.in
irc: munichlinux, JSLint, munichpython.

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



Re: Problem with Django

2010-01-20 Thread Prashanth
Hi,

On Thu, Jan 21, 2010 at 10:53 AM, Meenu  wrote:
>
> I've noticed that my form submission seems to randomly fail on the
> line var response_obj = eval('(' + o.responseText + ')'); in my
> javascript. My form contains date and decimal fields.
>

Pretty hard to figure out just with the javascript line though eval
looks fine, print the response that you are getting from django and
try to debug or if you want people to point out do a pastebin of your
view and response that you are doing in the javascript.

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




Re: Ajax with Django

2010-02-04 Thread Prashanth
On Fri, Feb 5, 2010 at 2:49 AM, Rohan Shah  wrote:
> Any good documentation available on how to implement AJAX with Django ?
>

http://www.b-list.org/weblog/2006/jul/31/django-tips-simple-ajax-example-part-1/


-- 
regards,
Prashanth
twitter: munichlinux
blog: prashanthblog.appspot.com
irc: munichlinux, JSLint, munichpython.

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



Re: How to create a simple PDF

2007-01-15 Thread prashanth


On 1/15/07, conrad22 <[EMAIL PROTECTED]> wrote:


Please could anyone give me a quick how to on PDF outputting. I've
looked at the official documentation around Report Lab, but remain
clueless.
If you have a simple model: eg a list of contacts, how do you 'draw'
the PDF?
With thanks in advance


-


u want to create PDF from what? if u are going to do a fresh work i
suggest u to use latex. I use it for presentation and many more
work.  u have the option of creating a pdf

--
regards,

|Prashanth|

http://munichlinux.blogspot.com

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



Re: jquery problem

2011-01-16 Thread Prashanth
Hi Tony,

On Mon, Jan 17, 2011 at 8:57 AM, Tony  wrote:

>  Unfortunately, I can't get any other plugins to work that I download.  No
> other jquery
> plugins seem to work and Im pretty sure I have the directory paths
> right and everything.



Very lame, How would someone know why something dint work?




> Then I try to add other plugins and none will work.
>
>
How is this related to Django? Hit Jquery mailing list.

-- 
regards,
Prashanth
twitter: munichlinux
blog: honeycode.in
irc: munichlinux, JSLint, munichpython.

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



Re: persistent db connections and postgresql_psycopg2 InterfaceError

2013-12-17 Thread Prashanth
I suspect restarting your Web server will fix it as you'll get fresh
connections. What is your CONN_MAX_AGE?
On Dec 17, 2013 4:57 AM, "Pavel Lurye"  wrote:

> Hi,
> does anyone have used django1.6 persistent connections with postgresql?
> I've done a simple test and I'm not sure, that django behaves correctly.
> Django can't recover after DB restart, and all further db requests lead to
> server error:
> ---
> Traceback (most recent call last):
>   File
> "/venv/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py",
> line 194, in __call__
> signals.request_started.send(sender=self.__class__)
>   File
> "/venv/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py",
> line 185, in send
> response = receiver(signal=self, sender=sender, **named)
>   File "/venv/local/lib/python2.7/site-packages/django/db/__init__.py",
> line 95, in close_old_connections
> conn.close_if_unusable_or_obsolete()
>   File
> "/venv/local/lib/python2.7/site-packages/django/db/backends/__init__.py",
> line 466, in close_if_unusable_or_obsolete
> if self.is_usable():
>   File
> "/venv/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py",
> line 196, in is_usable
> self.connection.cursor().execute("SELECT 1")
> psycopg2.InterfaceError: connection already closed
> ---
>
> So, InterfaceError is not catched by django in
> postgresql_psycopg2.DatabaseWrapper.is_usable.
>
> My test environment is:
> Ubuntu 13.10
> postgresql 9.1
>
> Django==1.6.1
> psycopg2==2.5.1
> uWSGI==1.9.21.1
>
>  --
> 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/77922966-a48e-4284-badd-e93f052fff54%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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/CAFrSFCBC0ryuVtSytyCGoxD1uzwRf-VtP7QL4%2BTNB-5hJ3Mdeg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Which Real Time Communications Protocol

2013-12-21 Thread Prashanth
Id pick Json over xml too as it's easier to manipulate and debug Json
serializable python objects. You can also write your own encoders/decoders,
might help: http://pymotw.com/2/json/
On Dec 21, 2013 8:01 AM, "Liam Thompson"  wrote:

> you could try http://json-rpc.org/
>
> On Friday, 20 December 2013 18:58:39 UTC+2, Mario Osorio wrote:
>>
>> My app will have to communicate different customers (Linux devices,
>> Windoze devices, iOS devices and Android devices at least).
>>
>> Overall, any of these customer devices will start one of many processes
>> and some of the other devices are required to respond by letting their
>> users know about the just initialized event. The original event might in
>> turn start related events with more or less the same behavior.
>>
>> I will be using email and SMS as 'secondary weapons', but I need some
>> sort of real time communications protocol as primary so whatever devices
>> that are connected and need, will be notified immediately. (I'm not sure
>> I'm making much sense at this point)
>>
>> What communications protocol can I use so that it:
>>
>>- offers real time response
>>- is as simple as possible
>>- works in as many different customers as possible
>>
>> Thanks a lot in advanced!
>>
>  --
> 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/ae5d4dd1-2134-4522-bf1f-f6094bc05ebe%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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/CAFrSFCBMCJ%3DkffNep345NP8-DEM0Xi73yfP-c7tXQWtT-rm4%2Bg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Models

2022-01-21 Thread Prashanth Patelc
Dear Django users,

I need some information regarding Django models, I would  like to  know is 
there any way to 
create Django models through frontend or can we create models by super 
admin. Kindly share any tutorials or any examples available.

Example:
we are create models in django
like below  fields 
===
class modelname(models.Model):
   id = models.PrimeryKey(auto_now_add=true)
   name =models.CharField()
   salary =models.DecimalField()

But my concern is create model name and fields like in html or super admin 
can do

===
=> he will enter values in variables  with appropriate field type.
 for  eg., "name char  type", "Salary decimal field" and so on..
=>When the user enter data into application it should directly store in 
database in the form of tables and rows..

Regards;
Prashanth
email : prashanthpat...@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/f065b2d2-6f1b-4a06-8302-e0ca5014ed2cn%40googlegroups.com.


Database design

2022-01-23 Thread Prashanth Patelc
Dear Django users,

I need some information regarding Django models, I would like to know is
there any way to
create Django models through frontend or can we create models by super
admin. Kindly share any tutorials or any examples available.

Example:
we are create models in django
like below fields
===
class modelname(models.Model):
   id = models.PrimeryKey(auto_now_add=true)
   name =models.CharField()
   salary =models.DecimalField()

But my concern is create model name and fields like in html or super admin
can do

===
=> he will enter values in variables with appropriate field type.
 for eg., "name char type", "Salary decimal field" and so on..
=>When the user enter data into application it should directly store in
database in the form of tables and rows..

Regards;
Prashanth
email : prashanthpat...@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/CAMCU6Co2CysGZ_ZHrFW5XJEregFhR6pdZS3i%2BJkLvVsvBqnUOQ%40mail.gmail.com.


create super user

2022-01-24 Thread Prashanth Patelc
im getting this error
==
match = date_re.match(value)
TypeError: expected string or bytes-like object


this is my user profile model
===

class UserManager(BaseUserManager):
use_in_migrations = True

def _create_user(self, email, password, **extra_fields):
"""
Creates and saves a User with the given mobile and password.
"""
if not email:
raise ValueError('The given email must be set')
# email = self.normalize_email(email)
user = self.model(email=email, **extra_fields)
user.set_password(password)
user.save(using=self._db)
return user

def create_user(self, email, password=None, **extra_fields):
extra_fields.setdefault('is_superuser', False)
return self._create_user(email, password, **extra_fields)

def create_superuser(self, email, password, **extra_fields):
extra_fields.setdefault('is_superuser', True)
extra_fields.setdefault('is_staff', True)

if extra_fields.get('is_superuser') is not True:
raise ValueError('Superuser must have is_superuser=True.')

return self._create_user(email, password, **extra_fields)

class Teams(models.Model):
teamname = models.CharField(max_length=100,unique=True)
team_description = models.CharField(max_length=1024)
def __str__(self):
return self.teamname


class UserProfile(AbstractBaseUser, PermissionsMixin):
id=models.AutoField(primary_key=True)
username = models.CharField(max_length=200, unique=True,
null=True, blank=True)
fullname = models.CharField(_('name'), max_length=200, blank=True,
null=True)
mobile = models.CharField(_('mobile'), unique=True, max_length=10,
blank=True, null=True)
email = models.EmailField(_('email address'),  unique=True,
blank=True, null=True)
password = models.CharField(_('password'),max_length=25,blank=True,
null=True)
date_joined = models.DateTimeField(verbose_name="date joined",
auto_now_add=True,)
is_verified = models.BooleanField(default=True,)
is_active = models.BooleanField(_('active'), default=True)
is_staff = models.BooleanField(_('is_staff'), default=True)
is_admin = models.BooleanField(_('is_Admin'), default=False,
blank=True, null=True)
is_manager = models.BooleanField(_('is_Manger'), default=False,
blank=True, null=True)
is_tl = models.BooleanField(_('is_Tl'), default=False, blank=True,
null=True)
is_agent = models.BooleanField(_('is_Agent'), default=False,
blank=True, null=True)
orginization = models.CharField(max_length=200, null=True, default=False)
dob=models.DateField(default=False)
GENDER_CHOICES = (
('Male', 'Male'),
('Female', 'Female'),
)
Roles = (
('Manager', 'Manager'),
('TL', 'TL'),
('Admin', 'Admin'),
('Agent', 'Agent'),)

gender = models.CharField(max_length=8, choices=GENDER_CHOICES, null=True)
team_name = models.ForeignKey(Teams, on_delete=models.CASCADE,
default=False, null=True, related_name='person_team')
role = models.CharField(max_length=100, null=True, choices=Roles,
default=False)
objects =  UserManager()

USERNAME_FIELD = 'email'  # User should be able to login with
REQUIRED_FIELDS = []

class Meta:
verbose_name = _('user')
verbose_name_plural = _('users')

def get_full_name(self):
'''
Returns the first_name plus the last_name, with a space in between.
'''
full_name = '%s %s' % (self.name)
return full_name.strip()

def get_short_name(self):
'''
Returns the short name for the user.
'''
return self.name

def create_superuser(self, password, email):
"""
Creates and saves a superuser with the given username and password.
"""
user = self.create_user(
email=email,
password=password,
)
user.is_superuser = True
user.is_staff = True
user.save(using=self._db)
return user

remaining models also there with date and time field

-- 
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/CAMCU6Cr8U3ZN1GGUVkPCnXwEJTyOm7BV3Vxx742sZ%3DfPSX4Fjw%40mail.gmail.com.


How to validate xl data

2022-02-13 Thread Prashanth Patelc
i am working on xl sheets , when im uploading the xl sheet it is storing
into the models but i need before storing into the models validate the data

eg:
username : ,must be str not int
reference id : ,must be int not str
email : ,contains @gmail.com , not strt not int

i need to validate like above


*this is code my code *
*working but i need validations*


class UploadPersonView(APIView): permission_classes = [IsAuthenticated,
IsAdminPermission | IsSuperAdminPermission]
serializer_class = PersonUploadSerializer
def post(self, request, *args, **kwargs):
serializer = self.serializer_class(data=request.data)
serializer.is_valid(raise_exception=True)
dataset = Dataset()
file = serializer.validated_data['file']
imported_data = dataset.load(file.read(), format='xlsx')
'''uploading xl file with particular data what user mentioned in xl we are
looping the xl data
and appending into the database with same fields''' # validate data here
before upload
for data in imported_data:
person_data = UserProfile(username=d,
fullname=data[1],
mobile=d2,
email=data[3],
password=make_password(data[4]),
date_joined=data[5],
is_verified=data[6],
is_active=data[7],
is_admin=data[8],
is_manager=data[9],
is_tl=data[10],
is_agent=data[11],
orginization=data[12],
dob=data[13],
gender=data[14],
team_name_id=data[15],
role=data[16]
)
person_data.save()
return Response({'sucessfully uploaded your file'}, status=status.
HTTP_200_OK)
except:
return Response({'message': 'aaa'}, status=status.HTTP_404_NOT_FOUND)

-- 
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/CAMCU6CrvCJzSCNjGTQ%2BgWjZ9ZURC%3Dk3H304WZ6vdQ5w812sisA%40mail.gmail.com.


how to use migrations in runtime for models creation?

2022-02-23 Thread Prashanth Patelc
hey ,
im working on dynamic models , im receiving model name and fields in
front-end

eg:
class Users(models.Model):
 name=models.Charfield(max_length=30)
 last_name=models.Charfield(max_length=30)
 ,,,
after this i dont need to save into the models.py i need to store the
data(create the table name with some fields into)postgreesql db
i need to migrate all the table(makemigrations,&migrate)

this is my code please check

from django.core.management import call_command

class CreateQueries(APIView):
def post(self, request, format=None):

table_name = request.data['table_name'] # im getting the table
name here
print(table_name,'here printing')
# model_name = '%d_%s' % (connection.tenant.id, table_name)
class Meta:
db_table = table_name
managed = False
attrs = {
'u_id': models.CharField(max_length=200),
'u_name': models.CharField(max_length=200),
'u_email': models.CharField(max_length=200),
'u_password': models.CharField(max_length=200),
'__module__': 'dynamicapp.models',
'Meta': Meta
} this is my cutom fields ,further i will receive from front-end


model = type(str(table_name), (models.Model,), attrs)


call_command('makemigrations')
call_command('migrate')

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/CAMCU6Cr_zUvnbhxKL-2k6mw7Rah9MLq%3DFZeGpBf-u1zt9EaBVg%40mail.gmail.com.


How to create dynamic models in django??

2022-02-26 Thread Prashanth Patelc
How to create dynamic models in django rest framework?
Is there any chance to create dynamic models with APIs

Any examples please send me thanks in advance..

1) Requirement is need create table name and fields in frontend
2) we are  getting the data and store in to the db create db structure
3) get the table name and fields create table in backend &postgresql store
to
4)this code don't update or add into the models
5)store the data into the tables
4)get the data into the tables using orm or any raw queries

-- 
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/CAMCU6Coop%3DVU67%2B1Ui%2BswvA2xijUYcre%2B%3D-Z_CzLnf-1pRRXUw%40mail.gmail.com.


Re: How to create dynamic models in django??

2022-02-28 Thread Prashanth Patelc
Any example?

On Mon, Feb 28, 2022, 5:27 PM Clive Bruton  wrote:

>
> On 27 Feb 2022, at 17:54, Steve Smith wrote:
>
> > ...the documentation on Formsets is scarce in my opinion and to get
> > them to work is a lot of trial and error...
>
> To massively simplify formsets try django-extra-views
>
>
> -- Clive
>
> --
> 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/5F1D5ACB-C5D8-460A-B471-D4B537A010F6%40indx.co.uk
> .
>

-- 
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/CAMCU6Cr5p9FjVLtwuTNEmB6w3v2wCVpPmwQb_dzx3ZgsEoXyNw%40mail.gmail.com.


Re: Got an error creating the test database: database "" already exists

2022-03-17 Thread Prashanth Patelc
Check your settings.py once
Add auth_user='app.UserModel'

Or
1) delete database and migrations
2) create new db
3) python manage.py makemigration
4) python manage.py migrate


On Thu, Mar 17, 2022, 9:35 AM Avinash Alanjakar 
wrote:

>
> Their are lots of pre-bulit apps in django so you need to migrate them
> first.
> In your case you are using the authentication with migrating their tables
> with database.
>
> Try to run command in this sequence. This might be solve your problem.
>
>
> python manage.py migrate
>
> python manage.py makemigrations
>
> python manage.py migrate
>
>
> Thanks,
> Avinash
>
> On Thu, 17 Mar, 2022, 8:53 am Salima Begum, 
> wrote:
>
>> Yes I run migrations still I am seeing the new issue below
>> ```
>> django.db.utils.ProgrammingError: relation "auth_user" does not exist
>> ```
>> Thank you
>> ~Salima
>>
>> On Wed, Mar 16, 2022 at 9:23 PM DJANGO DEVELOPER 
>> wrote:
>>
>>> you need to run migrations first and then run the tests. if the issue
>>> still persists. let me know
>>>
>>> On Wed, Mar 16, 2022 at 2:15 PM Sebastian Jung <
>>> sebastian.ju...@gmail.com> wrote:
>>>
 Hey salima,

 This error is strange. Django try to use a Relation in postgresql which
 doesn't exist.

 I have only tip that you cam reset database. I would delete database in
 postgresql and create it new with psql tool. After this you must reset all
 migrations:


 https://simpleisbetterthancomplex.com/tutorial/2016/07/26/how-to-reset-migrations.html

 And after this when you migrate it, then structure is created in new
 database.

 I am sorry i have no idea how yoz can fix relation exception manual.

 Regards


 Salima Begum  schrieb am Mi., 16. März
 2022, 06:51:

> Hi all,
> After writing test cases I run test cases I am getting an error below
> ```
> Python manage.py behave
> ```
> After running the above command I am getting this error.
> ```
> Creating test database for alias 'default'...
> Got an error creating the test database: database "test_newDataBase"
> already exists
>
> Type 'yes' if you would like to try deleting the test database
> 'test_newDataBase', or 'no' to cancel: yes
> Destroying old test database for alias 'default'...
> Traceback (most recent call last):
>   File "C:\Users\USER
> 1\PycharmProjects\behaveproject\venv\lib\site-packages\django\db\backends\utils.py",
> line 86, in _execute
> return self.cursor.execute(sql, params)
> psycopg2.errors.UndefinedTable: relation "trades_trade_table" does not
> exist
> .
> .
> django.db.utils.ProgrammingError: relation "trades_vk_trade_table"
> does not exist
> ```
> Please help me to resolve this issue.
>
> Thank you
> ~Salima
>
> --
> 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/CAMSz6b%3DTEv%3DH25L7giQV6w%3DYw6%3D6GJrvh5zPezqQWMger3VNzQ%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/CAKGT9mx2sRizWo8Qd%3Dn6yYFKUB1KvjKH%2Bi92Hj_fdoStRYc%3DWg%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/CAKPY9pkx0hJ3U_DFCia_UUY-ecieMJ0%2BE3uE75aTziehr1KWSg%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/CAMSz6b%

DJANGO_SETTINGS_MODULE error

2022-03-23 Thread Prashanth Patelc
*I am getting this error *
*please solve any one thanks in advance.*


django.core.exceptions.ImproperlyConfigured: Requested setting
REST_FRAMEWORK, but settings are not configured. You must either define the
environment variable DJANGO_SETTINGS_MODULE or call settings.configure()
before accessing settings.

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


How to test urls

2022-03-23 Thread Prashanth Patelc
Hi all,

how test the urls in django rest , i need each url response how to write
one file for each url response

need to write a URL in our application, which will return working or
something as a response  ?

* not test cases

-- 
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/CAMCU6CrXiOE2YLjzfN7ObnHSzeqg-_eytqvnc%2BPFLOwT08hr_Q%40mail.gmail.com.


CICD Pipeline(Heroku)Yml, error

2022-06-02 Thread Prashanth Patelc
I am hosting my app in Heroku using CICD Pipeline
I am getting this error .Please help to solve this issue.

Already up to date.
43
Everything
up-to-date
44
fatal:
couldn't find remote ref main
45
Error:
Process completed with exit code 1.

This is my yml file
=
name: Django CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
git fetch --unshallow origin
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run migrations
run: python manage.py makemigrations
- name: Run migrations
run: python manage.py migrate
- name: Run Tests
run: |
python manage.py test
- name: Add remote origin
if: github.event.ref == 'refs/heads/main' && job.status == 'success'
run: |
git remote add heroku https://heroku:${{ secrets.HEROKU_API_KEY }}@
git.heroku.com/${{ secrets.HEROKU_APP_NAME }}.git
- name: Deploy to Heroku
run: |
git config --global user.email "my ema...@some.com"
git config --global user.name "Prashanyh"
git config --list
git prune
git remote add upstream projecturl
git pull origin main
git push origin main
git pull heroku main
git push heroku main
git fetch upstream

-- 
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/CAMCU6CoE37ef4fg118w%3DwYEDUw%3D9w-ErtnkFtjK-QyoEY4YwPg%40mail.gmail.com.


Sockets

2022-07-20 Thread Prashanth Patelc
Hi users,
without serializers , can I use sockets?

How to use sockets in django rest api( notification purpose),  front-end is
Vue js.
any tutorials or any blogs sample codes please share with me.

Thanks

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


How to convert 24 hours time to 12 hours ?

2022-07-22 Thread Prashanth Patelc
how to use time in pandas  (convert 24 hours time to 12 hours)

Login time  table
==
userid logindate  logintime
22022-13-07  18:30:00.490337

Logout time table
==

userid logindate  logintime
22022-14-07  02:36:03.450327


output:
   login_date  user__username   user  diiffrences
0  2022-07-14  neilneil   -1
days +07:26:47.027887

How to convert above atbles time:  ?

nee output like this type
==
 login_date  user__username   user  diiffrences
0  2022-07-14  neilneil
08:03:47.027887



df['logout_time'] = pd.to_timedelta(df['logout_time'].astype(str))

df['login_time'] = pd.to_timedelta(df['login_time'].astype(str))


df['diiffrences'] = df['logout_time'] - df['login_time']

-- 
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/CAMCU6CpwW9q9z_pBdgf%3Do5dEzvET5qqvddopjNQtGwuxm5RUjA%40mail.gmail.com.


How to convert text file data into Excel file?

2022-12-29 Thread Prashanth Patelc
Hi all,

How to conver below text file data into xl file using pandas or python
script?

Host address all related values host address decimal and also remaining all
..
Show in Excel data header below related values.

Text file data :
---

Host address - 123457

Host address (decimal) - 111

Host address (hex) - 11

Network adr - 8

Xl Output :
-
Host address Host address
123457 111
(decimal) remaining,

-- 
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/CAMCU6CrJ%3DVoP57kwj5natqCfSH94tqXD7kHujmw2fy_gLxnq5g%40mail.gmail.com.


How to extract data in text.file and convert excel in python or pandas ?

2022-12-30 Thread Prashanth Patelc
Hi all,

How to conver below text file data into xl file using pandas or python
script?

Host address all related values host address decimal and also remaining all
..
Show in Excel data header below related values.

Text file data :
---

Host address - 123457

Host address (decimal) - 111

Host address (hex) - 11

Network adr - 8

Xl Output :
-
Host address Host address
123457 111
(decimal) remaining,

-- 
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/CAMCU6CpLXCztOoC_%3D8322ZM9SZG4Re7q_as1TDzMmpDxnjjcBw%40mail.gmail.com.


How Filter rows in django?

2023-01-08 Thread Prashanth Patelc
Hi ,


How to filter table rows in django using html , bootstrap and js?

Example :
I have table called some , contains 50 rows a , b, c, d, e ,,,more

If I select a,b row need to show both rows data only also remaining as per
selection need to show ?

-- 
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/CAMCU6CqM7BSonJrqTFnvde0PYcmQj23sTXzXP6PESkCxqNZcVw%40mail.gmail.com.


How to fetch 10000 above record within second in django?

2023-01-16 Thread Prashanth Patelc
Hi all,

How to fetch the data from db (mysql) above 1 records within second,

I written query it's taking more time like 38 seconds, how to to fetch the
lac of records within seconds any example in django using orm or MySQL
query ?

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


Re: How to fetch 10000 above record within second in django?

2023-01-16 Thread Prashanth Patelc
I'm using orm query fetching all data and showing into html templates ,
it's taking more time for get the data ,

On Tue, Jan 17, 2023, 12:40 PM Clive Bruton  wrote:

>
> On 17 Jan 2023, at 05:01, Prashanth Patelc wrote:
>
> > I written query it's taking more time like 38 seconds, how to to
> > fetch the lac of records within seconds any example in django using
> > orm or MySQL query ?
>
> Are you saying that you have a raw SQL query, or you are using a
> Django query?
>
> My experience is that the biggest lag in database retrieval is the
> amount of data retrieved, so if you can reduce the number of fields
> returned, that would be a good start.
>
> If you are using a Django query, and it has related elements, then
> the biggest boost you can give is using "select_related" and
> "prefetch_related".
>
>
> -- Clive
>
> --
> 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/9EF46118-6870-46AD-BF58-12AEC8C6A518%40indx.co.uk
> .
>

-- 
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/CAMCU6CrAKQL6qA6hWHPDFbfpCT1R9v5%2BY_Qi-HOkPf%3DOXYt2yA%40mail.gmail.com.


Re: How to fetch 10000 above record within second in django?

2023-01-17 Thread Prashanth Patelc
I'm already using pagination but when I hiting particular url it is taking
more than 1minute for loading the data and displaying in html .

On Tue, Jan 17, 2023, 5:37 PM Ayanfeoluwa Koyinsola <
ayanfeoluwakoyins...@gmail.com> wrote:

> You might now have to display all the data at once, see if you can use
> paginisation to reduce the numbers of queries
>
> On Tue, Jan 17, 2023, 12:39 Clive Bruton  wrote:
>
>> The easiest way to debug this is to install django_debug_toolbar and
>> look at the sql queries to see where the hold-up is.
>>
>> As previously, restrict the number of fields returned using "values"
>> and/or use "select_related" or "prefetch_related" to get related data
>> in one or two queries, rather than having Django getting that data on
>> (potentially) multiple queries per record.
>>
>>
>> -- Clive
>>
>> On 17 Jan 2023, at 07:43, Prashanth Patelc wrote:
>>
>> > I'm using orm query fetching all data and showing into html
>> > templates , it's taking more time for get the data ,
>> >
>> > On Tue, Jan 17, 2023, 12:40 PM Clive Bruton  wrote:
>> >
>> > On 17 Jan 2023, at 05:01, Prashanth Patelc wrote:
>> >
>> > > I written query it's taking more time like 38 seconds, how to to
>> > > fetch the lac of records within seconds any example in django using
>> > > orm or MySQL query ?
>> >
>> > Are you saying that you have a raw SQL query, or you are using a
>> > Django query?
>> >
>> > My experience is that the biggest lag in database retrieval is the
>> > amount of data retrieved, so if you can reduce the number of fields
>> > returned, that would be a good start.
>> >
>> > If you are using a Django query, and it has related elements, then
>> > the biggest boost you can give is using "select_related" and
>> > "prefetch_related".
>> >
>> >
>> > -- Clive
>> >
>> > --
>> > 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/9EF46118-6870-46AD-BF58-12AEC8C6A518%
>> > 40indx.co.uk.
>> >
>> > --
>> > 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/CAMCU6CrAKQL6qA6hWHPDFbfpCT1R9v5%2BY_Qi-HOkPf%
>> > 3DOXYt2yA%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/52330EF7-BBD9-44E6-94E3-C0A733F4EF36%40indx.co.uk
>> .
>>
> --
> 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/CAK-XCvfn84Xy%3D8kRpt%2BfJ_DmwUMxkeZ9iTnaGuUV5M3SNN-Twg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAK-XCvfn84Xy%3D8kRpt%2BfJ_DmwUMxkeZ9iTnaGuUV5M3SNN-Twg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAMCU6CoWgqWc%2Bc%3DZe15nvZZc-cZ%3DcYG6jOUU2o3SXftPPRZTGg%40mail.gmail.com.


Orm query

2023-02-17 Thread Prashanth Patelc
Hi all,

This is my model if model contain previous month dates I need to and store
the data If user is new previous data is not available I need to store
directly to db .
How to write orm query?


Attendance.object.filter(user=emp,date=enddate,crea_date=strdate)



If dates is not available in attendance model how to write orm query?

-- 
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/CAMCU6CpfDPBznuRHVuz%3DbaJF8-R4Zn2U9GamBfm52fRMQqZ9rQ%40mail.gmail.com.


How to create orm query if data is exist or not ?

2023-02-23 Thread Prashanth Patelc
Hi all,

How to create orm query with data exist or not ?

How to check if approval_status Pending and Rejected with same user
contains

from_date   approval_status   User
2023-01-20  - ApprovedNewUser
2023-01-12  - Rejected   NewUser
2023-01-06  -Approved   NewUser



If User contains above details in month between Create "
Timesheet Model" Eg:
Timesheet.objects.create(date=date,emaployee=emp,status=1)

leave_data =
EmployeeLeaves.objects.filter(~Q(approval_status='Approved'),~Q(approval_status='Cancelled'),~Q(approval_status='Rejected'),

 from_date__gte=month_first_date, to_date__lte=month_last_day,
   employee=request.user).


If User Contains Pending Don't create Model

leaves_data = EmployeeLeaves.objects.filter(~Q(approval_status='Pending'),

from_date__gte=month_first_date, to_date__lte=month_last_day,
employee=request.user).

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


Fwd: How to create orm query if data is exist or not ?

2023-02-23 Thread Prashanth Patelc
-- Forwarded message -
From: Prashanth Patelc 
Date: Thu, Feb 23, 2023 at 5:11 PM
Subject: How to create orm query if data is exist or not ?
To: 


Hi all,

How to create orm query with data exist or not ?

How to check if approval_status Pending and Rejected with same user
contains

from_date   approval_status   User
2023-01-20  - ApprovedNewUser
2023-01-12  - Rejected   NewUser
2023-01-06  -Approved   NewUser



If User contains above details in month between Create "
Timesheet Model" Eg:
Timesheet.objects.create(date=date,emaployee=emp,status=1)

leave_data =
EmployeeLeaves.objects.filter(~Q(approval_status='Approved'),~Q(approval_status='Cancelled'),~Q(approval_status='Rejected'),

 from_date__gte=month_first_date, to_date__lte=month_last_day,
   employee=request.user).


If User Contains Pending Don't create Model

leaves_data = EmployeeLeaves.objects.filter(~Q(approval_status='Pending'),

from_date__gte=month_first_date, to_date__lte=month_last_day,
employee=request.user).

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


How to write query user between dates no leaves?

2023-02-24 Thread Prashanth Patelc
How to write orm query?

User don't have any leave between two dates in django ?

leave_data =
EmployeeLeaves.objects.filter(~Q(approval_status='Approved'),~Q(approval_status='Cancelled'),~Q(approval_status='Rejected'),

 from_date__gte=month_first_date, to_date__lte=month_last_day,
   employee=request.user)

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


Update in django value

2023-03-07 Thread Prashanth Patelc
How to update single record particular value in django..

h_date=Holiday.objects.filter(start_date=month_start,end_date=month_end).values_list('date',flat=True)

for h_date in holiday:


Model.objects.filter(emp=request.user). update(date =h_date,in_time=None)

This above query is updating all dates I want to update particular date is
available then update record..

-- 
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/CAMCU6CoHk8rsnAzijp4UFYqtv6i7Gkq74yaLXp4iXH-Puu-6XQ%40mail.gmail.com.


User creation

2023-03-27 Thread Prashanth Patelc
Hi all,

I'm creating new user fields like email username firstname after creating
user I need to send password creation email to end user ?

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


Django forms data save using ajax

2023-04-15 Thread Prashanth Patelc
Hi all,

How to save employees information using ajax with django form , id should
automatic generation ?

-- 
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/CAMCU6CpTGfaJR3HtDzcnZAtp9hhHFhH_OgNvFZ14ZgAmFF-1og%40mail.gmail.com.


Re: DAILY,MONTHLY AND ANNUAL REPORTS

2023-07-21 Thread Prashanth Patelc
Write a condition based on paidon date filed like filter date ,
If date is today get last 7days report and get last month report.

On Fri, Jul 21, 2023, 11:12 PM Abdou KARAMBIZI 
wrote:

> Hello Friends,
>
> How can I get weekly,Monthly and annual reports? from the following model.
> I want to get the total amount paid in the week,month and year
>
>
> class Payments(models.Model):
> id = models.AutoField(primary_key = True)
> amount = models.IntegerField()
> paidon = models.DateField(auto_now=True)
>
> def __str__ (self):
> return self.id
>
>
> --
> 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/CABnE44wPtzkAL5YJ4uh3eRpupXUpH%3DkTJL71obTpTthorCdrTw%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/CAMCU6Co%2B8t1OZYAavf0CvhU6S9Boe2-%2B71fynpxiYWeiGDGijw%40mail.gmail.com.


Logout time

2023-07-28 Thread Prashanth Patelc
Hi all,

How to get logout time based on login time in python?

I'm storing hour in one column
Eg ; hour
8
Based on 8 Calculate logout time

My login time 10:00:00

I need 6: 00:00 (based 8)

-- 
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/CAMCU6Cpe32Pcs5PAmbx8LDcJzqqPwuhJVzrz%2B%3D67-tEMBychOw%40mail.gmail.com.


Re: Problems in Django login authentication

2023-07-29 Thread Prashanth Patelc
Use default django user model

from django.contrib.auth.models import User
# Create your models here.
class Registration (models.Model):
author = models.ForeignKey(User, on_delete=models.CASCADE)

# write your fields here



In settings.py


AUTH_USER_MODEL = app name . Modelname

On Sun, Jul 30, 2023, 10:57 AM Mohammad Ehsan Ansari 
wrote:

> First extend abstract user model or abstract base user model in your user
> model and after that define auth.model in settings.py hope its work
>
> Sent from my iPhone
>
> On 30-Jul-2023, at 10:45 AM, Abdulrahman Abbas 
> wrote:
>
> 
> Can you login with superuser?
>
> On Sun, Jul 30, 2023, 02:32 Mh Limon  wrote:
>
>> Views.py file
>>
>> from django.shortcuts import render,HttpResponse,redirect
>> from .models import registration
>> from django.contrib.auth import authenticate,login
>>
>> def home(request):
>> return render(request,'home.html')
>>
>> def log_in(request):
>> if request.method == 'POST':
>> username = request.POST.get('username')
>> password = request.POST.get('password')
>>
>> user = authenticate(request, username=username, password=
>> password)
>>
>> if user is not None:
>> login(request, user)
>> return redirect('home')
>> else:
>> return HttpResponse("You have incorrect Username or password"
>> )
>>
>> return render(request, 'log_in.html')
>>
>>
>> def sign_up(request):
>> if request.method == 'POST':
>> name = request.POST.get('fullname')
>> username = request.POST.get('username')
>> email = request.POST.get('email')
>> pass1 = request.POST.get('password')
>> pass2 = request.POST.get('confirm_password')
>>
>> if pass1 != pass2:
>> return HttpResponse("Password not matched")
>> else:
>> db = registration()
>>
>> db.Name = name
>> db.username = username
>> db.Email = email
>> db.Password = pass1
>>
>> db.save()
>>
>> return redirect('log_in')
>>
>>
>> return render(request,'sign_up.html')
>>
>> This is models.py for sqlite database:
>> from django.db import models
>>
>> class registration(models.Model):
>> Name = models.CharField(max_length=100)
>> username = models.CharField(max_length=100)
>> Email = models.CharField(max_length=100)
>> Password = models.CharField(max_length=100)
>>
>>
>> when providing the correct username and password, the system consistently
>> displays an error message stating "You have incorrect Username or password."
>>
>> please help me to solve this error.
>>
>>
>>
>> --
>> 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/4003937f-9045-4cea-bd6c-b071d7b1a6c3n%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/CAGGqo0MMu55nqSSKhW2%2BjGgGCGf62JJoBuCZA2wgK3NONCxzCg%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/BF995111-54EC-4CD1-A3E8-FE4F35AE49B1%40gmail.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/CAMCU6CrPDJKA0riTFhZcPLp8MAhqRs3-XZiDrgZNF2PNWAz2Zw%40mail.gmail.com.


Re: Logout time

2023-07-31 Thread Prashanth Patelc
Thank you all.

 Thank you # madhusudan (I got on idea through you shared the code)

On Fri, Jul 28, 2023, 8:16 PM Madhusudhan Reddy 
wrote:

> To get Logout time based on login time,
>
> login time = some thing
>
> logout time = login time + 8 hours
>
> use datetime timedelta module in python,
>
> >>> CODE <<<
> from datetime import datetime, timedelta
> login_time = datetime.now()
> logout_time = login_time + timedelta(hours=8)
> >>> CODE <<<
>
>
>
>
>
>
>
>
>
> On Fri, 28 Jul 2023 at 20:05, Prashanth Patelc 
> wrote:
>
>> Hi all,
>>
>> How to get logout time based on login time in python?
>>
>> I'm storing hour in one column
>> Eg ; hour
>> 8
>> Based on 8 Calculate logout time
>>
>> My login time 10:00:00
>>
>> I need 6: 00:00 (based 8)
>>
>> --
>> 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/CAMCU6Cpe32Pcs5PAmbx8LDcJzqqPwuhJVzrz%2B%3D67-tEMBychOw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMCU6Cpe32Pcs5PAmbx8LDcJzqqPwuhJVzrz%2B%3D67-tEMBychOw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> --
> Best regards,
> Madhusudhan
> +91 90007 79457
> Gmail  | LinkedIn
> <https://www.linkedin.com/in/msreddygone/>
>
>
> --
> 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/CAFwQctLwNxagOX-QKVUdp58gk4px0M_qftqU3rnHayGaJ9BjAw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAFwQctLwNxagOX-QKVUdp58gk4px0M_qftqU3rnHayGaJ9BjAw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAMCU6CpehgV_0BzNKSRFLZbgTb0z3hSkXQWmSEfK1v11-_oLPA%40mail.gmail.com.


Re: Post multiple data

2023-08-08 Thread Prashanth Patelc
I'm not able to send multiple data in front -end .

On Tue, Aug 8, 2023, 5:21 PM Mz Gz  wrote:

> Check the object sent from frontend using developer tools in browser.
>
> If the object is sent correctly to backend.
>
> Just access is from POST dict
>
> On Tue, 8 Aug 2023, 1:19 pm Prashanth Patelc, 
> wrote:
>
>> Hi all,
>>
>> I'm sending multiple rows data through html but I'm unable to save data
>> in django I'm not receiving proper data.how to send multiple shifts names
>> and times through ajax or html in django.
>>
>> I'm adding multiple shift name and in-time out-time .
>>
>> Please find the attached screenshot
>>
>> --
>> 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/CAMCU6CqWJme8fg-JuZJ%2BQnTBk63_f4%3DZMYTO7GFnRChOMt1teQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAMCU6CqWJme8fg-JuZJ%2BQnTBk63_f4%3DZMYTO7GFnRChOMt1teQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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/CAHV4E-fOikH7dWcJYkjyOQobj57%2BJ5Zef0y3PzfsoJN0gVgEhQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAHV4E-fOikH7dWcJYkjyOQobj57%2BJ5Zef0y3PzfsoJN0gVgEhQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAMCU6CrNoyoRykrSmABgwWwpWL5o-bhqpcMpL4YPj-v%3D%2BsA0tA%40mail.gmail.com.


Re: IMPORT PROBLEM

2024-09-02 Thread Prashanth Patelc
Use like this
path('pen/',views.land,name='pen'),

On Mon, Sep 2, 2024, 1:14 PM Heman Okumbo  wrote:

> Homeland is my project directory,there is another folder in the same
> directory with the same name,my apps directory is named land and its where
> i am trying to import views from.
> I get the below traceback error when i try the import.
>
> On Mon, Sep 2, 2024, 09:46 Augusto Domingos <
> augustodomingosva...@gmail.com> wrote:
>
>>
>> can you send some screenshots showings how you are importing the view?
>> Em segunda-feira, 2 de setembro de 2024 às 07:50:38 UTC+2, Heman Okumbo
>> escreveu:
>>
>>> My project url cannot import views from the app folder, what ks the
>>> problem?
>>>
>> --
>> 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/64c28c86-41d4-4242-a8bf-05862a4b18fbn%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/CAJt9CbgRWLxuLN4BsLhSSo1t4frUEkrSdhY91DbZ7aNQSGYt_g%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/CAMCU6Cq4O56%3Dw8mEHpMpW0Lu5YwCECMAERdXMXoQf5YCRgvdCw%40mail.gmail.com.